/* ============================================================
   Élan — feuille de style
   Encre indigo + brume, jaune soleil réservé à la progression,
   10 couleurs de tâches. Mobile d'abord, barre latérale sur PC.
   ============================================================ */

:root {
  --ink: #1C2147;
  --ink-2: #4B5180;
  --ink-3: #8A8FB2;
  --bg: #EEF0F8;
  --surface: #FFFFFF;
  --surface-2: #F4F5FB;
  --line: #E0E3F0;
  --band: #1C2147;
  --band-2: #2A3170;
  --band-ink: #F4F5FF;
  --band-ink-2: #B9BEE6;
  --sun: #FFC53D;
  --sun-deep: #F2A900;
  --sun-ink: #4D3600;
  --danger: #E5484D;
  --ok: #1FAF6E;

  --c-violet: #7B61FF;
  --c-bleu: #3D7BFD;
  --c-cyan: #0FAFC6;
  --c-vert: #1FAF6E;
  --c-lime: #74B52A;
  --c-jaune: #E5A600;
  --c-orange: #FF8A3D;
  --c-rouge: #EF4F5A;
  --c-rose: #E8559F;
  --c-gris: #7D84A0;
  --accent: var(--c-violet);

  --r-xl: 28px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 0 rgba(28, 33, 71, .05), 0 10px 30px -18px rgba(28, 33, 71, .35);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ECEEFC; --ink-2: #B7BBDB; --ink-3: #7C81A8;
    --bg: #12152E; --surface: #1B1F42; --surface-2: #232852; --line: #2E3466;
    --band: #262D6B; --band-2: #343C85; --band-ink: #F4F5FF; --band-ink-2: #B9BEE6;
    --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 12px 30px -16px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #ECEEFC; --ink-2: #B7BBDB; --ink-3: #7C81A8;
  --bg: #12152E; --surface: #1B1F42; --surface-2: #232852; --line: #2E3466;
  --band: #262D6B; --band-2: #343C85; --band-ink: #F4F5FF; --band-ink-2: #B9BEE6;
  --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 12px 30px -16px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- démarrage ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark, .brand-mark { display: inline-flex; align-items: flex-end; gap: 4px; height: 30px; }
.boot-mark i, .brand-mark i { display: block; width: 8px; border-radius: 4px; background: var(--sun); }
.boot-mark i:nth-child(1), .brand-mark i:nth-child(1) { height: 40%; opacity: .55; }
.boot-mark i:nth-child(2), .brand-mark i:nth-child(2) { height: 70%; opacity: .8; }
.boot-mark i:nth-child(3), .brand-mark i:nth-child(3) { height: 100%; }
.boot-mark i { animation: boot 1s ease-in-out infinite alternate; }
.boot-mark i:nth-child(2) { animation-delay: .15s; }
.boot-mark i:nth-child(3) { animation-delay: .3s; }
@keyframes boot { from { transform: scaleY(.5); transform-origin: bottom; } to { transform: scaleY(1); } }

/* ---------- coquille ---------- */
.shell { min-height: 100vh; }
.main {
  overflow-x: clip;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px);
  max-width: 1120px;
  margin: 0 auto;
}
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.nav-brand { display: none; }
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-3); text-decoration: none; font-size: 11.5px; font-weight: 600;
}
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--accent); }
.nav a[aria-current="page"] svg { transform: translateY(-1px); }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 232px 1fr; }
  .nav {
    position: sticky; top: 0; bottom: auto; height: 100vh;
    display: flex; flex-direction: column; gap: 4px; padding: 22px 14px;
    border-top: 0; border-right: 1px solid var(--line);
    background: var(--surface); backdrop-filter: none;
  }
  .nav-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; font-weight: 800; font-size: 22px; }
  .nav-brand .brand-mark { height: 24px; }
  .nav-brand .brand-mark i { width: 6px; }
  .nav a {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 11px 12px; border-radius: var(--r-md); font-size: 15px;
  }
  .nav a:hover { background: var(--surface-2); color: var(--ink); }
  .nav a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 12%, transparent); }
  .nav a[aria-current="page"] svg { transform: none; }
  .main { padding: 0 32px 48px; width: 100%; }
}

/* ---------- en-têtes de page ---------- */
.page-head {
  padding: calc(var(--safe-t) + 22px) 18px 6px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.page-head h1 { font-size: 30px; font-weight: 800; }
.page-head .sub { color: var(--ink-3); font-size: 14px; margin-top: 2px; }
@media (min-width: 900px) { .page-head { padding: 34px 0 10px; } }

.section { padding: 0 18px; margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-head h2 { font-size: 19px; font-weight: 800; }
.section-head .link { color: var(--accent); font-weight: 700; font-size: 14px; }
@media (min-width: 900px) { .section { padding: 0; } }

/* ---------- bandeau du jour (élément signature) ---------- */
.band {
  background: radial-gradient(120% 90% at 100% 0%, var(--band-2), transparent 60%), var(--band);
  color: var(--band-ink);
  padding: calc(var(--safe-t) + 14px) 18px 22px;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  position: relative;
}
@media (min-width: 900px) {
  .band { border-radius: 0 0 var(--r-xl) var(--r-xl); padding: 26px 28px 26px; margin: 0 0 6px; }
}
.band-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.daynav { display: flex; align-items: center; gap: 4px; min-width: 0; }
.daynav button.arrow {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--band-ink);
}
.daynav button.arrow:hover { background: rgba(255, 255, 255, .08); }
.daynav .when { text-align: left; padding: 2px 6px; border-radius: 10px; position: relative; }
.daynav .when strong { display: block; font-size: 22px; font-weight: 800; line-height: 1.1; }
.daynav .when span { display: block; font-size: 13px; color: var(--band-ink-2); }
.daynav .when input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.band .back-today {
  font-size: 13px; font-weight: 700; color: var(--band); background: var(--band-ink);
  padding: 7px 12px; border-radius: 999px;
}
.band .me-chip { font-size: 24px; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.1); text-decoration: none; }
@media (min-width: 900px) { .band .me-chip { display: none; } }

.score { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 18px; }
.score-main { display: flex; align-items: baseline; gap: 8px; }
.score-main .big { font-size: 54px; font-weight: 800; line-height: .9; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.score-main .of { font-size: 18px; color: var(--band-ink-2); font-weight: 700; }
.score-label { font-size: 14px; color: var(--band-ink-2); margin-top: 6px; }
.streak-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px 7px 10px; border-radius: 999px;
  background: rgba(255, 197, 61, .14); color: var(--sun); font-weight: 800; font-size: 15px; white-space: nowrap;
}
.streak-pill.off { background: rgba(255, 255, 255, .08); color: var(--band-ink-2); }

.gauge { display: flex; gap: 5px; margin-top: 14px; height: 22px; }
.gauge .seg {
  flex: 1 1 0; min-width: 6px; border-radius: 7px; background: rgba(255, 255, 255, .12);
  position: relative; overflow: hidden;
}
.gauge .seg i {
  position: absolute; inset: 0 auto 0 0; width: 0; background: var(--c);
  border-radius: inherit; transition: width .45s cubic-bezier(.2, .8, .2, 1.2);
}
.gauge .seg.full i { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .14), inset 0 2px 0 rgba(255, 255, 255, .25); }
.gauge.empty { align-items: center; color: var(--band-ink-2); font-size: 14px; }
.band.perfect .gauge .seg { animation: glow 1.4s ease-out 1; }
@keyframes glow { 0% { filter: brightness(1); } 40% { filter: brightness(1.5) saturate(1.2); } 100% { filter: brightness(1); } }

.levelrow { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.lvl-badge {
  flex: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px;
  background: var(--sun); color: var(--sun-ink); padding: 5px 10px; border-radius: 999px;
}
.xpbar { flex: 1; }
.xpbar .track { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.xpbar .track i { display: block; height: 100%; width: 0; background: var(--sun); border-radius: inherit; transition: width .6s ease; }
.xpbar .lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--band-ink-2); margin-top: 5px; }

/* ---------- mise en page jour sur PC ---------- */
.today-grid { display: block; }
@media (min-width: 1100px) {
  .today-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
  .today-grid > aside { position: sticky; top: 18px; }
}

/* ---------- frise horaire ---------- */
.timeline { display: flex; flex-direction: column; gap: 8px; }
.tl-group { font-size: 14px; font-weight: 800; color: var(--ink-3); margin: 16px 0 2px 2px; }
.tl-group:first-child { margin-top: 0; }

.task {
  --c: var(--accent);
  display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  background: var(--surface); border-radius: var(--r-lg); padding: 10px 10px 10px 0;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.task::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c); }
.task .time { text-align: center; font-weight: 800; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.task .time .emo { font-size: 24px; line-height: 1; }
.task .body { min-width: 0; text-align: left; padding: 2px 0; }
.task .name { font-weight: 750; font-size: 16.5px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.task .name span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 2px; font-size: 13px; color: var(--ink-3); }
.task .meta .fire { color: var(--sun-deep); font-weight: 800; }
.task .mini { height: 6px; border-radius: 9px; background: var(--surface-2); margin-top: 7px; overflow: hidden; max-width: 260px; }
.task .mini i { display: block; height: 100%; background: var(--c); border-radius: inherit; transition: width .35s ease; }
.task.done .name span.t { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: color-mix(in srgb, var(--c) 60%, transparent); }
.task.done { background: color-mix(in srgb, var(--c) 7%, var(--surface)); }

.check {
  width: 44px; height: 44px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, var(--c) 55%, var(--line));
  display: grid; place-items: center; color: transparent; transition: background .2s, border-color .2s, transform .15s;
}
.check svg { width: 22px; height: 22px; }
.check:hover { border-color: var(--c); }
.check:active { transform: scale(.9); }
.task.done .check { background: var(--c); border-color: var(--c); color: #fff; }
.task.just.done .check svg { animation: pop .35s cubic-bezier(.2, .9, .3, 1.5); }
@keyframes pop { from { transform: scale(.3); } to { transform: scale(1); } }

.counter { display: flex; align-items: center; gap: 6px; }
.counter button {
  width: 38px; height: 38px; border-radius: 12px; background: var(--surface-2); font-size: 20px; font-weight: 800;
  display: grid; place-items: center; color: var(--ink-2);
}
.counter button.plus { background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: var(--c); }
.task.done .counter button.plus { background: var(--c); color: #fff; }
.counter button:active { transform: scale(.92); }

.ring { width: 44px; height: 44px; }
.ring circle { fill: none; stroke-width: 5; }
.ring .bg { stroke: var(--surface-2); }
.ring .fg { stroke: var(--c); stroke-linecap: round; transition: stroke-dashoffset .4s ease; }
.ring-wrap { position: relative; width: 44px; height: 44px; }
.ring-wrap .ring { transform: rotate(-90deg); }
.ring-wrap span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--ink-2); }

/* objectifs de la semaine */
.wgoal { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--surface); border-radius: var(--r-lg); padding: 10px 10px 10px 12px; box-shadow: var(--shadow); --c: var(--accent); }
.wgoal .emo { font-size: 24px; text-align: center; }
.wgoal .dots { display: flex; gap: 4px; margin-top: 6px; }
.wgoal .dots i { width: 14px; height: 14px; border-radius: 5px; background: var(--surface-2); border: 2px solid color-mix(in srgb, var(--c) 35%, var(--line)); }
.wgoal .dots i.on { background: var(--c); border-color: var(--c); }
.wgoal.done .check, .wgoal .check.on { background: var(--c); border-color: var(--c); color: #fff; }

/* ---------- cartes génériques ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 10px; }
.card h3 { font-size: 16px; font-weight: 800; }

.mood { display: flex; justify-content: space-between; gap: 6px; margin-top: 10px; }
.mood button {
  flex: 1; font-size: 28px; height: 54px; border-radius: 16px; background: var(--surface-2);
  filter: grayscale(.85); opacity: .7; transition: transform .15s, filter .15s, opacity .15s, background .15s;
}
.mood button[aria-pressed="true"] { filter: none; opacity: 1; background: color-mix(in srgb, var(--sun) 30%, var(--surface)); transform: scale(1.06); }
textarea.note {
  width: 100%; margin-top: 10px; min-height: 84px; resize: vertical; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--surface-2); padding: 10px 12px; line-height: 1.45;
}
.saved-hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; min-height: 16px; }

/* ---------- état vide / démarrage ---------- */
.empty {
  text-align: center; padding: 26px 18px; border: 2px dashed var(--line); border-radius: var(--r-lg); color: var(--ink-2);
}
.empty .big-emo { font-size: 40px; }
.empty h3 { margin: 8px 0 4px; font-size: 18px; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.empty .chips { justify-content: center; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--line); font-weight: 650; font-size: 14px; color: var(--ink);
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 18px; border-radius: 14px; font-weight: 750; font-size: 15.5px;
  background: var(--surface-2); color: var(--ink); border: 1.5px solid transparent; text-decoration: none;
}
.btn:hover { border-color: var(--line); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.btn.small { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 25;
  width: 60px; height: 60px; border-radius: 22px; background: var(--accent); color: #fff;
  display: grid; place-items: center; box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--accent) 70%, transparent);
}
.fab svg { width: 28px; height: 28px; }
.fab:active { transform: scale(.94); }
@media (min-width: 900px) { .fab { bottom: 28px; right: 32px; } }

/* ---------- formulaires ---------- */
.field { display: block; margin-top: 14px; }
.field > span, .field-label { display: block; font-size: 14px; font-weight: 750; color: var(--ink-2); margin-bottom: 6px; }
.field small { display: block; color: var(--ink-3); font-size: 12.5px; margin-top: 4px; }
.input, select.input {
  width: 100%; height: 48px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2);
  padding: 0 14px; font-size: 16px; outline: none;
}
.input:focus { border-color: var(--accent); background: var(--surface); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.seg-ctl { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-ctl button { padding: 9px 13px; border-radius: 12px; background: var(--surface-2); font-weight: 700; font-size: 14px; color: var(--ink-2); border: 1.5px solid transparent; }
.seg-ctl button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-color: var(--accent); color: var(--ink); }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekdays button { height: 42px; border-radius: 12px; background: var(--surface-2); font-weight: 800; color: var(--ink-2); }
.weekdays button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line); }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--c); }
.emoji-btn { width: 56px; height: 48px; border-radius: 14px; background: var(--surface-2); font-size: 26px; border: 1.5px solid var(--line); flex: none !important; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 14px; padding: 4px; }
.stepper button { width: 38px; height: 38px; border-radius: 10px; font-weight: 800; font-size: 18px; }
.stepper button:hover { background: var(--surface); }
.stepper output { min-width: 34px; text-align: center; font-weight: 800; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.switch input { appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; flex: none; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }
.form-error { color: var(--danger); font-weight: 650; font-size: 14px; margin-top: 12px; min-height: 0; }
details.more { margin-top: 16px; }
details.more summary { cursor: pointer; font-weight: 750; color: var(--accent); font-size: 14px; }

/* ---------- feuilles (modales) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(15, 18, 45, .45);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 10px 20px calc(20px + var(--safe-b)); animation: up .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; position: sticky; top: -10px; background: var(--surface); padding: 6px 0; z-index: 2; }
.sheet-head h2 { font-size: 21px; font-weight: 800; }
.sheet-foot { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.sheet-foot .btn.primary { flex: 1; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: var(--r-xl); padding-bottom: 22px; }
  .sheet::before { display: none; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-top: 10px; }
.emoji-grid button { font-size: 26px; height: 46px; border-radius: 12px; }
.emoji-grid button:hover { background: var(--surface-2); }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 0; right: 0; top: calc(var(--safe-t) + 12px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 14px;
  font-weight: 700; font-size: 14.5px; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5); max-width: 440px;
  animation: drop .3s cubic-bezier(.2, .9, .3, 1.3);
}
.toast.sun { background: var(--sun); color: var(--sun-ink); }
.toast.err { background: var(--danger); color: #fff; }
@keyframes drop { from { transform: translateY(-20px); opacity: 0; } }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; width: 100%; height: 100%; }

/* ---------- semaine ---------- */
.weekhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.weekhead .range { font-weight: 800; font-size: 17px; text-align: center; flex: 1; }
.week { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.wday {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 12px 14px;
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; text-align: left; width: 100%;
}
.wday .dname { font-weight: 800; text-transform: capitalize; font-size: 15px; }
.wday .dnum { font-size: 26px; font-weight: 800; line-height: 1; }
.wday.is-today { outline: 2.5px solid var(--accent); outline-offset: -2.5px; }
.wday.is-past .dnum { color: var(--ink-2); }
.wday .mini-gauge { display: flex; gap: 3px; height: 6px; margin: 4px 0 8px; }
.wday .mini-gauge i { flex: 1; border-radius: 4px; background: var(--surface-2); }
.wday .mini-gauge i.on { background: var(--c, var(--accent)); }
.wday .items { display: flex; flex-wrap: wrap; gap: 6px; }
.wday .it { --c: var(--accent); display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 4px 9px 4px 6px; border-radius: 9px; background: color-mix(in srgb, var(--c) 12%, var(--surface)); color: var(--ink); font-weight: 650; max-width: 100%; }
.wday .it b { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 750; }
.wday .it.done { background: var(--c); color: #fff; }
.wday .it.done b { color: rgba(255,255,255,.8); }
.wday .none { color: var(--ink-3); font-size: 13px; }
@media (min-width: 900px) {
  .week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
  .wday { grid-template-columns: 1fr; align-content: start; min-height: 220px; padding: 12px; }
  .wday .items { flex-direction: column; flex-wrap: nowrap; }
  .wday .it { width: 100%; }
  .wday .it span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.month .dow { text-align: center; font-size: 12px; font-weight: 800; color: var(--ink-3); padding-bottom: 2px; }
.month .mday {
  aspect-ratio: 1; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 800; font-size: 15px; position: relative;
}
.month .mday .m { font-size: 12px; line-height: 1; }
.month .mday.out { visibility: hidden; }
.month .mday.future { color: var(--ink-3); box-shadow: none; background: transparent; border: 1.5px dashed var(--line); }
.month .mday.today { outline: 2.5px solid var(--accent); outline-offset: -2.5px; }
.month .mday.perfect::after { content: "✨"; position: absolute; top: -6px; right: -4px; font-size: 13px; }

.routine { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 6px 10px 12px; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); --c: var(--accent); }
.routine + .routine { margin-top: 8px; }
.routine .emo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: color-mix(in srgb, var(--c) 16%, var(--surface)); }
.routine .t { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routine .s { font-size: 13px; color: var(--ink-3); }

.toggle-tabs { display: inline-flex; background: var(--surface-2); padding: 4px; border-radius: 14px; gap: 2px; }
.toggle-tabs button { padding: 8px 14px; border-radius: 10px; font-weight: 750; font-size: 14px; color: var(--ink-3); }
.toggle-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ---------- sport ---------- */
.prog-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.prog-strip .pd { background: var(--surface); border-radius: 14px; padding: 10px 4px; text-align: center; box-shadow: var(--shadow); min-height: 84px; }
.prog-strip .pd .l { font-size: 13px; font-weight: 800; color: var(--ink-3); }
.prog-strip .pd .e { font-size: 22px; margin-top: 6px; line-height: 1.2; }
.prog-strip .pd.today { outline: 2.5px solid var(--accent); outline-offset: -2.5px; }
.prog-strip .pd.rest .e { font-size: 13px; color: var(--ink-3); font-weight: 700; padding-top: 6px; }

.workout {
  --c: var(--c-orange); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
}
.workout + .workout { margin-top: 10px; }
.workout .top { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px; }
.workout .badge { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; background: color-mix(in srgb, var(--c) 18%, var(--surface)); }
.workout .t { font-weight: 800; font-size: 17px; }
.workout .s { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.workout .days { display: flex; gap: 4px; margin-top: 6px; }
.workout .days i { font-style: normal; width: 22px; height: 22px; border-radius: 7px; font-size: 11.5px; font-weight: 800; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); }
.workout .days i.on { background: var(--c); color: #fff; }
.workout .actions { display: flex; gap: 8px; padding: 0 14px 14px; }

.exo { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); --c: var(--c-orange); }
.exo:last-child { border-bottom: 0; }
.exo .n { font-weight: 750; }
.exo .d { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; font-size: 13px; }
.exo .d b { font-weight: 800; color: var(--ink); }
.exo .d span { background: var(--surface-2); padding: 2px 8px; border-radius: 7px; color: var(--ink-2); }
.exo.done .n { color: var(--ink-3); text-decoration: line-through; }
.exo.done .check { background: var(--c); border-color: var(--c); color: #fff; }
.run-bar { height: 10px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.run-bar i { display: block; height: 100%; background: var(--c); border-radius: inherit; transition: width .3s ease; }
.rest-btn { font-size: 13px; font-weight: 800; padding: 7px 10px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.restbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 60; width: 100%; max-width: 560px;
  padding: 14px 20px calc(14px + var(--safe-b)); background: var(--ink); color: var(--bg);
  display: flex; align-items: center; gap: 14px; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 30px -10px rgba(0,0,0,.35);
  animation: rise .25s ease;
}
@keyframes rise { from { transform: translate(-50%, 100%); } }
@media (min-width: 700px) { .restbar { bottom: 24px; border-radius: 20px; } }
.restbar .tleft { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 70px; }
.restbar .track { flex: 1; height: 8px; border-radius: 9px; background: rgba(255,255,255,.2); overflow: hidden; }
.restbar .track i { display: block; height: 100%; background: var(--sun); width: 100%; transition: width 1s linear; }
.restbar button { color: var(--bg); font-weight: 800; padding: 8px; }

.exo-edit { background: var(--surface-2); border-radius: var(--r-md); padding: 10px; margin-top: 8px; }
.exo-edit .row { margin-top: 8px; }
.exo-edit .input { height: 42px; background: var(--surface); font-size: 15px; }
.exo-edit .tools { display: flex; justify-content: flex-end; gap: 2px; margin-top: 6px; }

.history { display: flex; flex-direction: column; }
.hist { display: grid; grid-template-columns: 64px 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 2px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.hist:last-child { border-bottom: 0; }
.hist .dt { color: var(--ink-3); font-weight: 700; font-size: 13px; }
.hist .e { font-size: 22px; }
.hist .st { font-weight: 800; font-size: 13px; color: var(--ok); }
.hist .st.partial { color: var(--ink-3); }

/* ---------- progrès ---------- */
.level-card {
  background: radial-gradient(100% 120% at 0% 0%, var(--band-2), transparent 65%), var(--band); color: var(--band-ink);
  border-radius: var(--r-xl); padding: 22px; display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center;
}
.level-card .medal { width: 86px; height: 86px; border-radius: 28px; background: var(--sun); display: grid; place-items: center; font-size: 46px; box-shadow: inset 0 -6px 0 var(--sun-deep); }
.level-card .lv { font-size: 15px; color: var(--band-ink-2); font-weight: 700; }
.level-card .title { font-size: 28px; font-weight: 800; margin: 2px 0 10px; }
.level-card .track { height: 12px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; }
.level-card .track i { display: block; height: 100%; background: var(--sun); border-radius: inherit; }
.level-card .xp { display: flex; justify-content: space-between; font-size: 13px; color: var(--band-ink-2); margin-top: 6px; font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.stat { background: var(--surface); border-radius: var(--r-md); padding: 14px; box-shadow: var(--shadow); }
.stat .v { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .v small { font-size: 15px; color: var(--ink-3); font-weight: 750; margin-left: 2px; }
.stat .k { font-size: 13px; color: var(--ink-3); font-weight: 650; margin-top: 2px; }
.stat.hot .v { color: var(--sun-deep); }

.heatmap-wrap { overflow-x: auto; padding-bottom: 4px; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; width: max-content; }
.heatmap i { width: 15px; height: 15px; border-radius: 4px; background: var(--surface-2); display: block; }
.heatmap i.l1 { background: color-mix(in srgb, var(--accent) 25%, var(--surface-2)); }
.heatmap i.l2 { background: color-mix(in srgb, var(--accent) 50%, var(--surface-2)); }
.heatmap i.l3 { background: color-mix(in srgb, var(--accent) 75%, var(--surface-2)); }
.heatmap i.l4 { background: var(--accent); }
.heatmap i.perfect { background: var(--sun); }
.heatmap i.none { background: transparent; border: 1px dashed var(--line); }
.legend { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); margin-top: 10px; flex-wrap: wrap; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.bars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; align-items: end; height: 150px; }
.bars .b { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bars .b i { width: 100%; max-width: 38px; border-radius: 9px 9px 4px 4px; background: color-mix(in srgb, var(--accent) 60%, var(--surface-2)); min-height: 4px; }
.bars .b.cur i { background: var(--accent); }
.bars .b span { font-size: 11.5px; color: var(--ink-3); font-weight: 700; white-space: nowrap; }
.bars .b em { font-style: normal; font-size: 12px; font-weight: 800; color: var(--ink-2); }

.hstat { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); --c: var(--accent); }
.hstat:last-child { border-bottom: 0; }
.hstat .e { font-size: 22px; text-align: center; }
.hstat .t { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hstat .bar { height: 7px; border-radius: 9px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.hstat .bar i { display: block; height: 100%; background: var(--c); border-radius: inherit; }
.hstat .r { text-align: right; font-size: 13px; color: var(--ink-3); }
.hstat .r b { display: block; font-size: 16px; color: var(--sun-deep); }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge-c { background: var(--surface); border-radius: var(--r-md); padding: 14px 12px; box-shadow: var(--shadow); text-align: center; }
.badge-c .e { font-size: 36px; line-height: 1.1; }
.badge-c.locked .e { filter: grayscale(1); opacity: .35; }
.badge-c .n { font-weight: 800; margin-top: 6px; font-size: 14.5px; }
.badge-c .d { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.badge-c .p { height: 6px; border-radius: 9px; background: var(--surface-2); margin-top: 10px; overflow: hidden; }
.badge-c .p i { display: block; height: 100%; background: var(--sun); }
.badge-c.earned { background: color-mix(in srgb, var(--sun) 16%, var(--surface)); }

.moods { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; align-items: end; height: 70px; }
.moods i { border-radius: 4px; background: var(--surface-2); min-height: 6px; }
.moods i.m1 { height: 20%; background: #E5484D; }
.moods i.m2 { height: 40%; background: #FF8A3D; }
.moods i.m3 { height: 60%; background: #E5A600; }
.moods i.m4 { height: 80%; background: #74B52A; }
.moods i.m5 { height: 100%; background: #1FAF6E; }

.podium { display: flex; flex-direction: column; gap: 8px; }
.member { display: grid; grid-template-columns: 34px 46px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--surface); padding: 10px 14px; border-radius: var(--r-md); box-shadow: var(--shadow); }
.member .rk { font-size: 22px; text-align: center; font-weight: 800; color: var(--ink-3); }
.member .av { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: color-mix(in srgb, var(--c, var(--accent)) 18%, var(--surface)); }
.member .nm { font-weight: 800; }
.member .sm { font-size: 13px; color: var(--ink-3); }
.member .xp { font-weight: 800; color: var(--sun-deep); text-align: right; font-variant-numeric: tabular-nums; }
.member .xp small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 700; }
.member.me { outline: 2px solid var(--accent); outline-offset: -2px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 26px; }
.two-col > * { min-width: 0; }
@media (min-width: 1000px) { .two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* ---------- profil ---------- */
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head .av { width: 68px; height: 68px; border-radius: 22px; display: grid; place-items: center; font-size: 38px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.profile-head .nm { font-size: 22px; font-weight: 800; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.user-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-row .av { font-size: 26px; text-align: center; }
.user-row .nm { font-weight: 750; }
.user-row .un { font-size: 13px; color: var(--ink-3); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: var(--sun); color: var(--sun-ink); margin-left: 6px; vertical-align: 2px; }

/* ---------- connexion ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 18px;
  background: radial-gradient(90% 60% at 100% 0%, var(--band-2), transparent 60%), var(--band);
}
.auth-box { width: 100%; max-width: 400px; background: var(--surface); border-radius: var(--r-xl); padding: 26px 22px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); }
.auth-brand { display: flex; align-items: center; gap: 12px; color: var(--band-ink); justify-content: center; margin-bottom: 18px; font-size: 34px; font-weight: 800; }
.auth-brand .brand-mark { height: 34px; }
.auth-brand .brand-mark i { width: 9px; }
.auth h1 { font-size: 23px; font-weight: 800; }
.auth p.lead { color: var(--ink-2); margin-top: 6px; font-size: 15px; }
.auth .switch-link { text-align: center; margin-top: 16px; font-size: 14.5px; color: var(--ink-2); }
.auth .switch-link button { color: var(--accent); font-weight: 750; }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-pick button { width: 44px; height: 44px; border-radius: 14px; font-size: 24px; background: var(--surface-2); border: 2px solid transparent; }
.avatar-pick button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }

.loading { padding: 60px 0; display: grid; place-items: center; }
.offline-banner { background: var(--danger); color: #fff; text-align: center; font-size: 13px; font-weight: 700; padding: 6px; position: sticky; top: 0; z-index: 40; }

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