@font-face {
  font-family: 'Outfit'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/outfit-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Outfit'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/outfit-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0f1115;
  --bg2: #171a21;
  --card: #1d212a;
  --card2: #252a35;
  --line: #2c3240;
  --text: #f3f4f7;
  --muted: #8a92a6;
  --accent: #ff6b35;
  --accent2: #ffb703;
  --ok: #2ec4b6;
  --danger: #ef476f;
  --radius: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }
[hidden] { display: none !important; }

/* ---------- Connexion ---------- */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 50% 0%, #ff6b3533, transparent 60%), var(--bg);
}
.login-card { width: 100%; max-width: 360px; text-align: center; }
.login-logo { font-size: 64px; animation: pulse 2s ease-in-out infinite; }
.login h1 { font-size: 34px; margin: 8px 0 4px; font-weight: 800; }
.login p { color: var(--muted); margin: 0 0 28px; }
.login input {
  width: 100%; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--card); margin-bottom: 12px; font-size: 17px; outline: none;
}
.login input:focus { border-color: var(--accent); }
.login-err { color: var(--danger) !important; margin-top: 12px !important; min-height: 1.2em; }
@keyframes pulse { 50% { transform: scale(1.12); } }

.btn-primary {
  width: 100%; padding: 16px; border-radius: 16px; font-weight: 700; font-size: 17px;
  background: linear-gradient(135deg, var(--accent), #ff8c42); color: #fff;
  box-shadow: 0 8px 24px #ff6b3555; transition: transform .1s;
}
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .4; box-shadow: none; }
.btn-ghost {
  display: block; margin: 32px auto 0; padding: 12px 20px; color: var(--muted);
  border-radius: 12px; border: 1px solid var(--line);
}
.btn-danger { color: var(--danger); padding: 14px; width: 100%; font-weight: 600; margin-top: 4px; }

/* ---------- Layout ---------- */
#app { max-width: 560px; margin: 0 auto; }
.view {
  padding: calc(16px + var(--safe-t)) 16px calc(110px + var(--safe-b));
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }

.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 20px; }
.top h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.5px; text-transform: capitalize; }
.hello { margin: 0 0 2px; color: var(--muted); font-size: 15px; }

.streak {
  display: flex; align-items: center; gap: 4px; padding: 8px 14px 8px 10px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-size: 18px;
}
.streak.hot { background: linear-gradient(135deg, #ff6b3533, #ffb70322); border-color: #ff6b3566; }
.streak.hot .flame { animation: pulse 1.6s ease-in-out infinite; display: inline-block; }
.streak b { font-weight: 800; }

/* ---------- Semaine ---------- */
.week { display: flex; align-items: center; gap: 4px; margin-bottom: 20px; }
.week-nav { width: 28px; height: 56px; color: var(--muted); font-size: 26px; flex: none; }
.week-days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; touch-action: pan-y; }
.wd {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 10px;
  border-radius: 16px; background: var(--card); position: relative; transition: background .15s, transform .1s;
}
.wd:active { transform: scale(.94); }
.wd small { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.wd b { font-size: 18px; font-weight: 700; }
.wd .dots { display: flex; gap: 2px; height: 6px; }
.wd .dots i { width: 6px; height: 6px; border-radius: 50%; }
.wd.today b { color: var(--accent); }
.wd.sel { background: var(--accent); box-shadow: 0 6px 18px #ff6b3555; }
.wd.sel small, .wd.sel b { color: #fff; }
.wd.sel .dots i { background: #fff !important; }
.wd.future { opacity: .45; }

/* ---------- Résumé du jour ---------- */
.day-summary { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.day-summary:empty { display: none; }
.chip {
  flex: none; padding: 8px 14px; border-radius: 999px; background: var(--card2); font-size: 14px; color: var(--muted);
}
.chip b { color: var(--text); font-weight: 700; }

/* ---------- Entrées ---------- */
.entries { display: flex; flex-direction: column; gap: 10px; }
.entry {
  display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius);
  background: var(--card); text-align: left; width: 100%; position: relative; overflow: hidden;
  animation: pop .3s cubic-bezier(.2, 1.4, .4, 1);
}
.entry::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.entry:active { transform: scale(.98); }
.entry .ico {
  width: 50px; height: 50px; flex: none; border-radius: 15px; display: grid; place-items: center; font-size: 26px;
  background: color-mix(in srgb, var(--c) 22%, transparent);
}
.entry .info { flex: 1; min-width: 0; }
.entry .name { font-weight: 700; font-size: 17px; }
.entry .meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.entry .note { color: var(--muted); font-size: 13px; font-style: italic; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .int { font-size: 20px; flex: none; }
@keyframes pop { from { opacity: 0; transform: scale(.92); } }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { font-size: 56px; margin-bottom: 8px; }
.empty b { display: block; color: var(--text); font-size: 19px; margin-bottom: 4px; }
.empty .btn-primary { width: auto; padding: 14px 26px; margin-top: 20px; }

/* ---------- FAB & tabbar ---------- */
.fab {
  position: fixed; right: max(20px, calc(50% - 260px)); bottom: calc(92px + var(--safe-b));
  width: 62px; height: 62px; border-radius: 22px; font-size: 34px; font-weight: 300; line-height: 1; color: #fff;
  background: linear-gradient(135deg, var(--accent), #ff8c42); box-shadow: 0 10px 30px #ff6b3577; z-index: 20;
  transition: transform .15s;
}
.fab:active { transform: scale(.9) rotate(90deg); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 19; display: flex; justify-content: center;
  padding: 8px 12px calc(8px + var(--safe-b)); background: #0f1115ee; backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 12px; color: var(--muted); padding: 6px 0; border-radius: 14px; font-weight: 600;
}
.tabbar button span { font-size: 22px; filter: grayscale(1); opacity: .6; transition: .2s; }
.tabbar button.active { color: var(--text); }
.tabbar button.active span { filter: none; opacity: 1; transform: translateY(-2px); }

/* ---------- Feuille ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: #000a; z-index: 30; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-width: 560px; margin: 0 auto;
  background: var(--bg2); border-radius: 28px 28px 0 0; padding: 8px 18px calc(20px + var(--safe-b));
  max-height: 92dvh; overflow-y: auto; transform: translateY(105%); transition: transform .32s cubic-bezier(.2, .9, .3, 1);
  overscroll-behavior: contain;
}
.sheet.open { transform: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 14px; }
.sheet h2 { margin: 0 0 4px; font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.sheet .sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.back { font-size: 15px; color: var(--muted); padding: 4px 0; margin-bottom: 8px; }

.act-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.act {
  aspect-ratio: 1; border-radius: 20px; background: var(--card); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 14px; padding: 6px;
  border: 2px solid transparent; transition: transform .1s, border-color .15s; text-align: center;
}
.act span { font-size: 34px; }
.act:active { transform: scale(.93); border-color: var(--c); }
.act.add { border: 2px dashed var(--line); color: var(--muted); }

.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 52px; height: 52px; border-radius: 16px; background: var(--card2); font-size: 26px; flex: none;
}
.stepper button:active { background: var(--line); transform: scale(.94); }
.stepper .val { flex: 1; text-align: center; }
.stepper input {
  width: 100%; text-align: center; background: none; border: 0; font-size: 34px; font-weight: 800; outline: none; padding: 0;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper .unit { font-size: 13px; color: var(--muted); margin-top: -2px; }
.quick { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.quick button { padding: 8px 14px; border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 600; color: var(--muted); }
.quick button.on { background: var(--c, var(--accent)); color: #fff; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 .stepper button { width: 40px; height: 44px; font-size: 22px; border-radius: 12px; }
.row2 .stepper input { font-size: 26px; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg button {
  padding: 12px 4px; border-radius: 16px; background: var(--card); display: flex; flex-direction: column;
  align-items: center; gap: 2px; font-size: 13px; font-weight: 600; color: var(--muted); border: 2px solid transparent;
}
.seg button span { font-size: 26px; }
.seg button.on { border-color: var(--c, var(--accent)); color: var(--text); background: var(--card2); }

.sheet textarea, .sheet input[type=text], .sheet input[type=date] {
  width: 100%; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--card);
  outline: none; resize: none; font-size: 16px;
}
.sheet textarea:focus, .sheet input:focus { border-color: var(--accent); }
.more { color: var(--muted); font-size: 14px; padding: 4px 0 14px; }

.emojis { display: flex; gap: 6px; flex-wrap: wrap; }
.emojis button { width: 44px; height: 44px; border-radius: 12px; background: var(--card); font-size: 22px; border: 2px solid transparent; }
.emojis button.on { border-color: var(--accent); background: var(--card2); }
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.colors button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; }
.colors button.on { border-color: #fff; transform: scale(1.1); }

.manage { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.manage-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.manage-row span { flex: 1; }
.manage-row button { color: var(--muted); font-size: 13px; padding: 6px 10px; border-radius: 10px; background: var(--card); }

/* ---------- Calendrier ---------- */
.cal-nav { display: flex; gap: 8px; }
.round { width: 44px; height: 44px; border-radius: 14px; background: var(--card); font-size: 22px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head span { text-align: center; color: var(--muted); font-size: 12px; font-weight: 600; padding-bottom: 6px; }
.cal-day {
  aspect-ratio: 1; border-radius: 14px; background: var(--card); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; font-weight: 600; font-size: 15px; position: relative;
}
.cal-day.out { visibility: hidden; }
.cal-day.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-day.active { background: color-mix(in srgb, var(--c) 30%, var(--card)); }
.cal-day .em { font-size: 13px; line-height: 1; height: 13px; }
.cal-day.future { opacity: .4; }
.cal-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }

/* ---------- Stats ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile, .cal-legend .tile { background: var(--card); border-radius: var(--radius); padding: 16px; }
.tile .k { color: var(--muted); font-size: 13px; font-weight: 600; }
.tile .v { font-size: 30px; font-weight: 800; margin-top: 2px; }
.tile .v small { font-size: 15px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.tile.hero { grid-column: span 2; background: linear-gradient(135deg, #ff6b35, #ff8c42 60%, #ffb703); color: #fff; }
.tile.hero .k { color: #fff; opacity: .85; }
.tile.hero .v { font-size: 42px; }
.cal-legend .tile { padding: 12px; text-align: center; }
.cal-legend .tile .v { font-size: 24px; }

.sec { font-size: 17px; margin: 28px 0 12px; font-weight: 700; }
.bars {
  display: flex; align-items: flex-end; gap: 6px; height: 160px; background: var(--card); border-radius: var(--radius);
  padding: 16px 12px 28px;
}
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar i {
  width: 100%; max-width: 22px; border-radius: 6px 6px 3px 3px; background: var(--accent); min-height: 3px;
  transform-origin: bottom; animation: grow .5s cubic-bezier(.2, .9, .3, 1) both;
}
.bar.cur i { background: var(--accent2); }
.bar.zero i { background: var(--line); }
.bar small { position: absolute; bottom: -20px; font-size: 10px; color: var(--muted); }
.bar em { font-style: normal; font-size: 10px; color: var(--muted); margin-bottom: 3px; }
@keyframes grow { from { transform: scaleY(0); } }

.act-list { display: flex; flex-direction: column; gap: 10px; }
.act-row { background: var(--card); border-radius: 16px; padding: 12px 14px; }
.act-row .t { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 8px; }
.act-row .t span:last-child { color: var(--muted); font-size: 13px; font-weight: 500; }
.act-row .track { height: 8px; background: var(--card2); border-radius: 4px; overflow: hidden; }
.act-row .track i { display: block; height: 100%; border-radius: 4px; background: var(--c); animation: growX .6s ease both; transform-origin: left; }
@keyframes growX { from { transform: scaleX(0); } }

/* ---------- Toast & confettis ---------- */
.toast {
  position: fixed; left: 50%; top: calc(16px + var(--safe-t)); transform: translate(-50%, -150%); z-index: 50;
  background: var(--card2); border: 1px solid var(--line); padding: 12px 20px; border-radius: 999px; font-weight: 600;
  transition: transform .3s cubic-bezier(.2, 1.3, .4, 1); white-space: nowrap; box-shadow: 0 10px 30px #0008;
}
.toast.show { transform: translate(-50%, 0); }
.confetti { position: fixed; z-index: 60; pointer-events: none; font-size: 22px; animation: boom 1s ease-out forwards; }
@keyframes boom {
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; }
}

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

/* ---------- v2 : catégories, recherche, réglages ---------- */
.search {
  width: 100%; padding: 13px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--card);
  outline: none; font-size: 16px; margin-bottom: 12px;
}
.search:focus { border-color: var(--accent); }
.cats {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px 14px; padding: 0 18px;
}
.cats::-webkit-scrollbar { display: none; }
.cats button {
  flex: none; padding: 9px 15px; border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 600;
  color: var(--muted); border: 1px solid var(--line); transition: background .15s;
}
.cats button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cats.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.act { font-size: 13px; line-height: 1.15; }
.act span { font-size: 30px; }
.seg4 { grid-template-columns: repeat(2, 1fr); }
.hint { margin-top: 8px; font-size: 13px; color: var(--muted); text-align: center; }
.quick button[data-fine] { background: var(--card2); color: var(--text); }

.settings { margin-top: 32px; background: var(--card); border-radius: var(--radius); padding: 4px 16px; }
.settings summary { padding: 14px 0; font-weight: 600; cursor: pointer; list-style: none; }
.settings summary::-webkit-details-marker { display: none; }
.settings form { display: flex; flex-direction: column; gap: 10px; padding-bottom: 16px; }
.settings input {
  padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg2); outline: none; font-size: 16px;
}
.settings input:focus { border-color: var(--accent); }

/* ---------- v3 : comptes ---------- */
.login input[type=email], .login input[type=text] {
  width: 100%; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--card); margin-bottom: 12px; font-size: 17px; outline: none;
}
.login input:focus { border-color: var(--accent); }
.link { color: var(--muted); font-size: 15px; padding: 10px; margin-top: 4px; text-decoration: underline; text-underline-offset: 3px; }
.login .btn-ghost { width: 100%; margin-top: 12px; }
.sent { font-size: 64px; margin: 8px 0 16px; }
#authSub { min-height: 1.2em; line-height: 1.45; }
.account { color: var(--muted); margin: 0 0 4px; font-size: 15px; word-break: break-all; }
.account b { color: var(--text); }
.settings + .settings { margin-top: 12px; }
.settings input[type=text] {
  padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg2); outline: none; font-size: 16px; width: 100%;
}
.invite-link { padding-bottom: 16px; }
.invite-link input { font-size: 13px !important; color: var(--accent2); }
.invite-actions { display: flex; gap: 10px; margin-top: 10px; }
.invite-actions .btn-ghost { margin: 0; flex: 1; }
#inviteList { padding-bottom: 12px; }
#inviteList .manage-row span { font-size: 14px; }

/* ---------- v4 : calendrier plus dense ---------- */
#view-cal .top { margin-bottom: 12px; }
.month-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.month-stats span { padding: 6px 12px; border-radius: 999px; background: var(--card2); font-size: 13px; color: var(--muted); }
.month-stats b { color: var(--text); font-weight: 700; }
.cal-grid { gap: 5px; }
.cal-day { aspect-ratio: auto; height: 52px; border-radius: 12px; gap: 1px; font-size: 14px; }
.cal-day b { font-weight: 600; }
.cal-day.active { background: color-mix(in srgb, var(--c) 32%, var(--card)); }
.cal-day.multi { background: color-mix(in srgb, var(--c) 55%, var(--card)); }
.cal-day.active b { color: #fff; }
.cal-day .em { font-size: 12px; height: 13px; }
.cal-day:active { transform: scale(.94); }

.journal .sec { margin-top: 24px; }
.j-day {
  display: flex; gap: 14px; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 8px;
  background: var(--card); border-radius: 16px; animation: pop .3s ease;
}
.j-day:active { transform: scale(.98); }
.j-date { display: flex; flex-direction: column; align-items: center; width: 34px; flex: none; padding-top: 2px; }
.j-date b { font-size: 22px; font-weight: 800; line-height: 1; }
.j-date small { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 600; margin-top: 2px; }
.j-list { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.j-item { display: flex; align-items: center; gap: 10px; }
.j-item i {
  font-style: normal; width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: 18px;
  background: color-mix(in srgb, var(--c) 22%, transparent);
}
.j-item > span { min-width: 0; display: flex; flex-direction: column; }
.j-item b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.j-item small { font-size: 13px; color: var(--muted); }
.empty.compact { padding: 28px 16px 8px; }
.empty.compact .big { font-size: 44px; }
.top h1 { font-size: clamp(24px, 7.6vw, 30px); }
#calTitle { white-space: nowrap; }
#view-cal .round { width: 40px; height: 40px; }
.cal-day .em { white-space: nowrap; font-size: 11px; letter-spacing: -2px; }
@media (max-width: 380px) {
  .month-stats span { padding: 5px 10px; font-size: 12px; }
  .cal-day { height: 46px; font-size: 13px; }
}


/* ---------- v6 : énergie, objectif, profil ---------- */
.tabbar button { max-width: 120px; }
.chip.energy { color: var(--accent2); background: #ffb7031a; }
.chip.energy b { color: var(--accent2); }

.goal { background: var(--card); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; }
.goal-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.goal-head b { color: var(--text); }
.goal-segs { display: flex; gap: 5px; }
.goal-segs i { flex: 1; height: 8px; border-radius: 4px; background: var(--card2); transition: background .3s; }
.goal-segs i.on { background: linear-gradient(90deg, var(--accent), #ff8c42); }
.goal.done { background: linear-gradient(135deg, #2ec4b622, #2ec4b60d); }
.goal.done .goal-segs i.on { background: var(--ok); }
.goal.done .goal-head span { color: var(--ok); font-weight: 600; }

.tile.wide { grid-column: span 2; }
.tile .kj, .card .kj { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 6px; }
.tile.energy .v { color: var(--accent2); }
.tip { font-size: 13px; color: var(--muted); margin: 8px 0 0; line-height: 1.45; }

.records { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.rec { background: var(--card); border-radius: 16px; padding: 12px; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.rec span { grid-row: span 2; font-size: 26px; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 22%, transparent); }
.rec b { font-size: 19px; font-weight: 800; }
.rec small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.who { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; flex: none;
  font-size: 26px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card .k { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.card .v { font-size: 30px; font-weight: 800; margin-top: 4px; }
.card .v small { font-size: 15px; color: var(--muted); font-weight: 600; }
.bmi-row { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 12px; flex-wrap: wrap; }
.bmi-v { font-size: 40px; font-weight: 800; }
.bmi-l { font-weight: 700; font-size: 16px; }
.gauge {
  position: relative; height: 10px; border-radius: 5px;
  background: linear-gradient(90deg, #3a86ff 0 17.5%, #2ec4b6 17.5% 50%, #ffb703 50% 75%, #ef476f 75% 100%);
}
.gauge i {
  position: absolute; top: -5px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%;
  background: #fff; border: 4px solid var(--bg); box-shadow: 0 2px 8px #0008;
}
.gauge-l { position: relative; height: 16px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.gauge-l span { position: absolute; transform: translateX(-50%); }
.gauge-l span:nth-child(1) { left: 0; transform: none; }
.gauge-l span:nth-child(2) { left: 17.5%; }
.gauge-l span:nth-child(3) { left: 50%; }
.gauge-l span:nth-child(4) { left: 75%; }
.gauge-l span:nth-child(5) { right: 0; left: auto; transform: none; }
.delta { display: inline-block; font-size: 13px; font-weight: 600; margin-left: 8px; padding: 3px 9px; border-radius: 999px; vertical-align: middle; }
.delta.down { color: var(--ok); background: #2ec4b61f; }
.delta.up { color: var(--accent2); background: #ffb7031f; }
.spark { width: 100%; height: 70px; margin: 10px 0 4px; display: block; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark .area { fill: #ff6b3522; }
.spark circle { fill: var(--accent); }
.weight-form { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }

.card-form { background: var(--card); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.card-form label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
.card-form label small { font-weight: 400; }
.card-form input {
  padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg2); outline: none; font-size: 16px;
  -moz-appearance: textfield;
}
.card-form input:focus { border-color: var(--accent); }
.card-form .row2 { gap: 10px; }
.seg-sex button { padding: 11px 4px; font-size: 14px; }
.goal-pick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.goal-pick button { height: 42px; border-radius: 12px; background: var(--card2); font-weight: 700; color: var(--muted); }
.goal-pick button.on { background: var(--accent); color: #fff; }
.data-actions { padding-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.data-actions .btn-ghost { margin: 0; text-align: center; text-decoration: none; }
#deleteForm { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
#deleteForm[hidden] { display: none; }

/* ================= v7 : refonte Stats & Profil ================= */
.sheet:not(.open) { visibility: hidden; transition: transform .32s cubic-bezier(.2, .9, .3, 1), visibility 0s .32s; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.card { background: var(--card); border-radius: 22px; padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.tip.pad { margin: -4px 4px 14px; }
.lifetime { text-align: center; color: var(--muted); font-size: 13px; margin: 22px 0 0; }

.mini-seg { display: flex; background: var(--bg2); border-radius: 12px; padding: 3px; gap: 2px; }
.mini-seg button { padding: 6px 11px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s; }
.mini-seg button.on { background: var(--card2); color: var(--text); box-shadow: 0 1px 4px #0006; }
.mini-seg.wide { width: 100%; }
.mini-seg.wide button { flex: 1; padding: 9px 4px; }

/* --- Stats : semaine --- */
.week-hero {
  display: flex; align-items: center; gap: 18px; padding: 18px; border-radius: 26px; margin-bottom: 14px;
  background: radial-gradient(circle at 0% 0%, #ff6b3540, transparent 60%), linear-gradient(160deg, #262b37, #1b1f27);
  border: 1px solid #ffffff0d;
}
.week-hero.done { background: radial-gradient(circle at 0% 0%, #2ec4b640, transparent 60%), linear-gradient(160deg, #262b37, #1b1f27); }
.ring { position: relative; width: 116px; height: 116px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring .track { stroke: #ffffff12; }
.ring .prog { stroke: url(#none); stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2, .9, .3, 1); animation: ringIn 1s cubic-bezier(.2, .9, .3, 1) both; }
.week-hero.done .ring .prog { stroke: var(--ok); }
@keyframes ringIn { from { stroke-dashoffset: 327; } }
.ring-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-c b { font-size: 32px; font-weight: 800; line-height: 1; }
.ring-c b small { font-size: 16px; color: var(--muted); font-weight: 600; }
.ring-c span { font-size: 12px; color: var(--muted); margin-top: 2px; }
.week-side { min-width: 0; }
.week-msg { margin: 4px 0 12px; font-size: 16px; font-weight: 700; line-height: 1.25; }
.week-kpis { display: flex; flex-direction: column; gap: 5px; }
.week-kpis span { font-size: 14px; color: var(--muted); }
.week-kpis b { color: var(--text); font-weight: 700; margin-right: 2px; }

.streaks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.streak-card { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 20px; padding: 14px; }
.streak-card > span { font-size: 26px; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--card2); flex: none; }
.streak-card.hot > span { background: #ff6b3526; }
.streak-card b { display: block; font-size: 18px; font-weight: 800; }
.streak-card small { font-size: 12px; color: var(--muted); }

/* --- Stats : graphique --- */
.chart { position: relative; display: flex; align-items: flex-end; gap: 5px; height: 150px; padding-bottom: 22px; }
.chart .bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.chart .bar i {
  width: 100%; max-width: 20px; border-radius: 7px 7px 4px 4px; min-height: 3px; background: #ff6b3566;
  transform-origin: bottom; animation: grow .5s cubic-bezier(.2, .9, .3, 1) both;
}
.chart .bar.cur i { background: linear-gradient(180deg, var(--accent2), var(--accent)); box-shadow: 0 4px 14px #ff6b3555; }
.chart .bar.zero i { background: var(--card2); }
.chart .bar em { font-style: normal; font-size: 10px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.chart .bar.cur em { color: var(--accent2); }
.chart .bar small { position: absolute; bottom: -20px; font-size: 10px; color: var(--muted); white-space: nowrap; }
.chart .bar.cur small { color: var(--text); font-weight: 600; }
.chart .ref { position: absolute; left: 0; right: 0; border-top: 1.5px dashed #ffffff30; margin-bottom: 22px; z-index: 1; pointer-events: none; }
.chart .ref span { position: absolute; right: 0; top: -17px; font-size: 10px; color: var(--muted); background: var(--card); padding: 0 4px; border-radius: 4px; }
.chart-foot { margin: 14px 0 0; font-size: 13px; color: var(--muted); }

/* --- Stats : répartition --- */
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; margin-bottom: 14px; }
.stack i { min-width: 4px; animation: growX .6s ease both; transform-origin: left; }
.legend { display: flex; flex-direction: column; }
.lg-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid #ffffff0a; }
.lg-row:first-child { border-top: 0; }
.lg-row > i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.lg-e { font-size: 20px; width: 26px; text-align: center; flex: none; }
.lg-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lg-t b { font-size: 15px; font-weight: 600; }
.lg-t small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-p { font-weight: 700; font-size: 15px; color: var(--muted); }

/* --- Stats : records --- */
.records { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 4px; scroll-snap-type: x mandatory; }
.records::-webkit-scrollbar { display: none; }
.rec {
  flex: none; width: 128px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 2px; padding: 14px;
  border-radius: 20px; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 22%, var(--card)), var(--card));
}
.rec .medal { font-size: 28px; margin-bottom: 6px; }
.rec b { font-size: 24px; font-weight: 800; }
.rec b small { font-size: 13px; color: var(--muted); }
.rec em { font-style: normal; font-size: 12px; color: var(--muted); line-height: 1.3; }

/* --- Profil : en-tête --- */
.profile-hero {
  text-align: center; padding: 24px 16px 20px; margin: 4px 0 14px; border-radius: 28px;
  background: radial-gradient(circle at 50% 0%, #ff6b3544, transparent 65%), linear-gradient(180deg, #232833, #1a1e26);
  border: 1px solid #ffffff0d;
}
.avatar-xl {
  width: 84px; height: 84px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center;
  font-size: 38px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px #ff6b3566, 0 10px 30px #ff6b3555;
}
.profile-hero h1 { margin: 0; font-size: 26px; font-weight: 800; }
.profile-hero .mail { margin: 2px 0 14px; color: var(--muted); font-size: 14px; word-break: break-all; }
.hero-chips { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.hero-chips span { padding: 7px 12px; border-radius: 999px; background: #ffffff0f; font-size: 14px; font-weight: 600; }

/* --- Profil : mesures --- */
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-card { background: var(--card); border-radius: 22px; padding: 14px; display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.m-card.wide { grid-column: span 2; align-items: stretch; text-align: left; }
.m-card .eyebrow { align-self: flex-start; }
.m-val { font-size: 30px; font-weight: 800; line-height: 1.1; }
.m-val small { font-size: 15px; color: var(--muted); font-weight: 600; }
.m-ico { font-size: 34px; margin: 10px 0 8px; }
.m-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.m-note.left { text-align: left; margin: 8px 0 4px; font-size: 13px; }
.empty-m .m-ico { opacity: .5; }
.empty-m { justify-content: flex-start; }
.badge { display: inline-block; margin-top: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--card2); color: var(--muted); }
.badge small { font-weight: 500; opacity: .8; }
.badge.down { color: var(--ok); background: #2ec4b61f; }
.badge.up { color: var(--accent2); background: #ffb7031f; }
.gauge-svg { width: 100%; max-width: 130px; margin: 6px 0 -4px; }
.gauge-svg .seg path { fill: none; stroke-width: 10; stroke-linecap: round; }
.gauge-svg .knob { fill: #fff; stroke: var(--card); stroke-width: 3; filter: drop-shadow(0 1px 3px #000a); }

.weight .w-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.weight .w-head .badge { margin-top: 18px; text-align: right; }
.spark-wrap { position: relative; margin: 10px 0 4px; }
.spark { width: 100%; height: 64px; display: block; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark circle { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
.spark-l { position: absolute; inset: 0 auto 0 0; display: flex; flex-direction: column; justify-content: space-between; font-size: 10px; color: var(--muted); pointer-events: none; }
.w-form { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #ffffff0a; }
.w-form > button[type=button] { width: 42px; height: 42px; border-radius: 13px; background: var(--card2); font-size: 22px; flex: none; }
.w-form > button[type=button]:active { transform: scale(.92); }
.w-form label { flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 4px; min-width: 0; }
.w-form input { width: 80px; background: none; border: 0; outline: none; text-align: right; font-size: 24px; font-weight: 800; padding: 0; -moz-appearance: textfield; }
.w-form input::-webkit-inner-spin-button, .w-form input::-webkit-outer-spin-button { -webkit-appearance: none; }
.w-form em { font-style: normal; color: var(--muted); font-weight: 600; }
.w-save { height: 42px; padding: 0 16px; border-radius: 13px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent), #ff8c42); flex: none; }

/* --- Profil : listes façon réglages --- */
.list { background: var(--card); border-radius: 22px; overflow: hidden; }
.list .row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; min-height: 54px;
  border-top: 1px solid #ffffff0a; font-size: 15px;
}
.list .row:first-child { border-top: 0; }
.list .row > span:first-child { color: var(--text); font-weight: 500; }
.list .row small { color: var(--muted); font-weight: 400; }
.list .row.col { flex-direction: column; align-items: stretch; }
.list .row input {
  background: none; border: 0; outline: none; text-align: right; font-size: 15px; color: var(--muted); padding: 4px 0;
  min-width: 0; width: 60%; -moz-appearance: textfield;
}
.list .row input:focus { color: var(--text); }
.list .row input::-webkit-inner-spin-button, .list .row input::-webkit-outer-spin-button { -webkit-appearance: none; }
.with-unit { display: flex; align-items: baseline; justify-content: flex-end; gap: 4px; width: 50%; }
.with-unit input { width: 100% !important; }
.with-unit em { font-style: normal; color: var(--muted); font-size: 14px; }
.list .row.save { border-top: 0; padding-top: 4px; }
.goal-pick button { height: 38px; border-radius: 11px; background: var(--bg2); }
#goalLabel { color: var(--accent); }

.row-d { border-top: 1px solid #ffffff0a; }
.row-d:first-child, .row-d[hidden] + .row-d { border-top: 0; }
.row-d summary, .row-btn {
  display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 54px; width: 100%;
  font-size: 15px; font-weight: 500; cursor: pointer; list-style: none; text-align: left;
}
.row-d summary::-webkit-details-marker { display: none; }
.row-d summary::after { content: '›'; margin-left: auto; font-size: 22px; color: var(--muted); transition: transform .2s; }
.row-d[open] summary::after { transform: rotate(90deg); }
.row-d i, .row-btn i { font-style: normal; width: 32px; height: 32px; border-radius: 10px; background: var(--card2); display: grid; place-items: center; font-size: 16px; flex: none; }
.row-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.row-body form { display: flex; flex-direction: column; gap: 10px; }
.row-body input {
  width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg2); outline: none; font-size: 16px;
}
.row-body input:focus { border-color: var(--accent); }
.row-body .btn-ghost { margin: 0; text-align: center; text-decoration: none; width: 100%; }
.row-body .tip { margin: 0; }
#resetForm, #deleteForm { border-top: 1px solid var(--line); padding-top: 12px; }
#deleteForm[hidden] { display: none; }
.row-btn { border-top: 1px solid #ffffff0a; }
.row-btn.danger { color: var(--danger); }
.row-btn.danger i { background: #ef476f1f; }

/* ---------- v8 : œil mot de passe, consentement, confidentialité ---------- */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap input { width: 100%; padding-right: 52px !important; }
.login .pw-wrap { margin-bottom: 12px; }
.login .pw-wrap input { margin-bottom: 0; }
.eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px;
  display: grid; place-items: center; border-radius: 12px; color: var(--muted);
}
.eye:active { background: var(--card2); }
.eye svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.consent { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-size: 13px; color: var(--muted); line-height: 1.45; margin: 2px 0 16px; cursor: pointer; }
.consent input { width: 20px; height: 20px; flex: none; margin: 1px 0 0; accent-color: var(--accent); }
.inline-link { color: var(--accent2); text-decoration: underline; padding: 0; font-size: inherit; display: inline; }
.link.small { font-size: 13px; text-decoration: none; display: block; margin: 8px auto 0; }
.privacy h3 { font-size: 15px; margin: 18px 0 6px; }
.privacy p, .privacy li { font-size: 14px; line-height: 1.55; color: #c9cdd8; margin: 0 0 6px; }
.privacy ul { padding-left: 18px; margin: 0; }
.privacy a { color: var(--accent2); }
.privacy b { color: var(--text); }
.privacy .btn-primary { margin-top: 18px; }
