/* ==========================================================================
   Élan — feuille de style
   Direction : carnet d'entraînement. Papier chaud, encre, une seule couleur
   d'accent (orange brûlé) réservée à la progression. Titres en serif,
   interface en sans-serif système, chiffres tabulaires. Pas de dégradés,
   pas d'ombres portées : des filets fins et de la hiérarchie typographique.
   ========================================================================== */

/* ---------- Jetons ---------- */
:root {
  --bg: #f3f1ec; --bg2: #ebe8e1; --card: #fbfaf7; --card2: #f3f1ec; --line: #e0dbd1; --line2: #cdc6b8;
  --text: #1c1b19; --muted: #6e695f; --faint: #a39d91;
  --ink: #1c1b19; --ink-text: #fbfaf7;
  --accent: #c94f12; --accent2: #a8400c; --accent-soft: #f5e2d4;
  --green: #2f7d4f; --green-soft: #dcefe2; --red: #b83a2b; --amber: #b8730f;
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --r: 10px; --r-sm: 7px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211; --bg2: #161614; --card: #1b1b19; --card2: #232320; --line: #2d2c29; --line2: #3d3b37;
    --text: #ece9e3; --muted: #9b968c; --faint: #6b675f;
    --ink: #ece9e3; --ink-text: #121211;
    --accent: #ee7a3b; --accent2: #ff9356; --accent-soft: #3a2417;
    --green: #56b07f; --green-soft: #1e3326; --red: #e2604f; --amber: #dda23f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121211; --bg2: #161614; --card: #1b1b19; --card2: #232320; --line: #2d2c29; --line2: #3d3b37;
  --text: #ece9e3; --muted: #9b968c; --faint: #6b675f;
  --ink: #ece9e3; --ink-text: #121211;
  --accent: #ee7a3b; --accent2: #ff9356; --accent-soft: #3a2417;
  --green: #56b07f; --green-soft: #1e3326; --red: #e2604f; --amber: #dda23f;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; }
h1 { font-family: var(--serif); font-size: clamp(1.6rem, 3.2vw, 2.1rem); letter-spacing: -.01em; }
h3 { font-size: 1.05rem; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.pos { color: var(--green); } .neg { color: var(--red); }
[hidden] { display: none !important; }
.num, .value, .save-amt, td.num { font-variant-numeric: tabular-nums; }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Mise en page ---------- */
.layout { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 12px 16px; background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 600; font-size: 1.3rem; padding: 0 10px; letter-spacing: -.01em; }
.logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--ink); color: var(--ink-text); font-family: var(--serif); font-style: italic; font-size: 1.15rem; line-height: 1; }
.logo.big { width: 52px; height: 52px; font-size: 1.9rem; border-radius: 12px; margin: 0 auto; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--muted); font-weight: 500; transition: color .12s, background .12s; }
.nav a .ic { width: 18px; height: 18px; }
.nav a:hover { color: var(--text); background: color-mix(in srgb, var(--card) 70%, transparent); }
.nav a.active { color: var(--text); background: var(--card); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-level { margin-top: auto; padding: 12px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.main { padding: 34px clamp(16px, 4vw, 44px) 100px; max-width: 1180px; width: 100%; min-width: 0; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; inset: auto 0 0 0; height: auto; flex-direction: row; padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg2) 92%, transparent); backdrop-filter: blur(10px); }
  .brand, .side-level { display: none; }
  .nav { flex-direction: row; justify-content: space-around; width: 100%; gap: 0; }
  .nav a { flex-direction: column; gap: 3px; padding: 7px 2px 5px; font-size: .64rem; flex: 1 1 0; min-width: 0; background: none !important; }
  .nav a .ic { width: 21px; height: 21px; }
  .nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav a.active { color: var(--accent); }
  .nav a.active::before { left: 30%; right: 30%; top: -4px; bottom: auto; width: auto; height: 2px; border-radius: 0 0 2px 2px; }
  .main { padding: 22px 16px 96px; }
}

/* ---------- En-têtes & cartes ---------- */
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.page-h p { margin: 6px 0 0; }
.eyebrow { display: block; font-size: .72rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; }
.card > h2 { margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  font-size: .74rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.card > h2 .small, .card > h2 .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 14px; }
@media (max-width: 400px) { .grid2, .grid3 { grid-template-columns: 1fr; } .grid4 { grid-template-columns: 1fr 1fr; gap: 10px; } .card { padding: 16px; } }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .label { color: var(--muted); font-size: .8rem; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.stat .label .ic { color: var(--faint); }
.stat .value { font-size: 1.65rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.stat .sub { font-size: .8rem; color: var(--muted); }
a.card { transition: border-color .12s; }
a.card:hover { border-color: var(--line2); }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line2); background: var(--card); cursor: pointer; font-weight: 550; font-size: .92rem; transition: background .12s, border-color .12s; white-space: nowrap; }
.btn:hover { background: var(--card2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--card2); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: .84rem; }
.icon-btn { display: inline-grid; place-items: center; background: none; border: 0; cursor: pointer; padding: 6px; border-radius: var(--r-sm); color: var(--faint); min-width: 32px; min-height: 32px; }
.icon-btn:hover { background: var(--card2); color: var(--text); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 5px; font-size: .74rem; font-weight: 550; background: var(--card2); color: var(--muted); border: 1px solid var(--line); }
.chip.accent { color: var(--accent2); background: var(--accent-soft); border-color: transparent; }

.bar { height: 6px; border-radius: 3px; background: var(--card2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.bar > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .4s ease; }
.bar.green > span { background: var(--green); }
.bar.lg { height: 10px; border-radius: 5px; }

.empty { text-align: center; color: var(--muted); padding: 26px 12px; font-size: .92rem; }
.empty .empty-ic { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--card2); color: var(--faint); margin-bottom: 10px; }
.empty .empty-ic .ic { width: 22px; height: 22px; }
.empty u { text-decoration-color: var(--accent); text-underline-offset: 3px; }

/* ---------- Formulaires & fenêtres ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { font-size: .8rem; font-weight: 500; color: var(--muted); }
input, select, textarea { width: 100%; padding: 9px 11px; border-radius: var(--r-sm); border: 1px solid var(--line2); background: var(--card); outline: none; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="range"] { padding: 0; border: 0; box-shadow: none; accent-color: var(--accent); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.modal { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); padding: 24px; width: min(460px, calc(100vw - 32px)); overflow-x: hidden; }
.modal::backdrop { background: rgba(18, 17, 15, .45); }
.modal h3 { margin-bottom: 18px; font-family: var(--serif); font-size: 1.3rem; }
.modal.wide { width: min(660px, calc(100vw - 32px)); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row > .field { min-width: 0; }
@media (max-width: 420px) { .field-row { grid-template-columns: 1fr; gap: 0; } }

/* ---------- Carte personnage ---------- */
.hero { display: flex; align-items: center; gap: 26px; margin-bottom: 14px; flex-wrap: wrap; }
.hero h2 { font-family: var(--serif); font-size: 1.35rem; }
.ring { position: relative; width: 92px; height: 92px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .lvl { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 650; font-size: 1.6rem; line-height: 1; }
a.ring { display: block; }
.lvlchip { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--ink-text); font-size: .68rem; font-weight: 650; padding: 2px 8px; border-radius: 5px; white-space: nowrap; letter-spacing: .02em; }
.hero .stats { flex: 1 1 280px; display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px 18px; }
.statrow { display: grid; grid-template-columns: 1fr auto; gap: 4px 6px; font-size: .82rem; align-items: center; }
.statrow span { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.statrow b { font-variant-numeric: tabular-nums; }
.statrow .bar { grid-column: 1 / -1; height: 4px; }
.lvl-mini { display: flex; flex-direction: column; gap: 8px; font-size: .82rem; }
a.lvl-mini { color: inherit; }
a.lvl-mini b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Listes ---------- */
.habit { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.habit:last-child { border-bottom: 0; }
.habit .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.days { display: flex; gap: 4px; }
.day { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line); background: var(--card2); cursor: pointer; display: grid; place-items: center; font-size: .7rem; color: var(--faint); padding: 0; }
.day.on { background: var(--green); border-color: var(--green); color: #fff; }
.day.today { box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--line2); }
.check { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line2); background: none; cursor: pointer; display: grid; place-items: center; flex: none; color: #fff; padding: 0; }
.check:hover { border-color: var(--green); }
.check.on { background: var(--green); border-color: var(--green); }
.check .ic { width: 15px; height: 15px; stroke-width: 2.4; }
.streak { display: inline-flex; align-items: center; gap: 3px; font-size: .78rem; font-weight: 600; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.streak .ic { width: 14px; height: 14px; }
@media (max-width: 520px) { .days .day:nth-child(-n+3) { display: none; } }

.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.avatar { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--card2); border: 1px solid var(--line); font-size: 1.1rem; flex: none; color: var(--muted); }
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; padding: 8px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
td { padding: 11px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }
.price-in { width: 100px; padding: 5px 8px; text-align: right; }

/* ---------- Objectifs, quêtes, cagnottes ---------- */
.goal { padding: 16px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card .goal { background: var(--card2); border-color: transparent; }
.goal.done { opacity: .6; }
.goal.done .gtitle { text-decoration: line-through; }
.gtitle { font-weight: 600; }
.tabs { display: inline-flex; gap: 2px; background: var(--card2); border-radius: 8px; padding: 3px; border: 1px solid var(--line); }
.tabs button, .tabs a { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 550; font-size: .88rem; }
.tabs button.active, .tabs a.active { background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.tabs .ic { width: 16px; height: 16px; }

.quest { padding: 16px; border-radius: var(--r); background: var(--card2); border: 1px solid transparent; display: flex; flex-direction: column; gap: 11px; min-width: 0; position: relative; }
.quest::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--qc, var(--accent)); }
.quest .bar { flex: 1; }
.quest.done { background: transparent; border-color: var(--line); }
.quest.done b { text-decoration: line-through; text-decoration-color: var(--faint); color: var(--muted); }
.qlvl { font-size: .7rem; font-weight: 650; padding: 2px 7px; border-radius: 5px; background: var(--card); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.qv { width: 96px; padding: 5px 8px; font-size: .85rem; }
.preset-scroll { max-height: min(60vh, 520px); overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding-right: 4px; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 8px; margin-top: 8px; }
.preset { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; text-align: left; transition: border-color .12s; }
.preset:hover { border-color: var(--line2); background: var(--card2); }
.preset span { font-size: 1.25rem; margin-bottom: 2px; }

.save-amt { font-size: 1.55rem; font-weight: 650; letter-spacing: -.02em; }
.saving.reached { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 45%, transparent); }
.saving details summary { cursor: pointer; }
.saving .hist { padding: 5px 0; border-bottom: 1px dashed var(--line); flex-wrap: nowrap; }

/* ---------- Graphiques ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--faint); font-size: 10.5px; font-family: var(--font); }
.legend { display: flex; flex-direction: column; gap: 7px; font-size: .86rem; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 8px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-wrap svg { width: 140px; flex: none; }

/* Calendrier d'activité */
.heat-wrap { overflow-x: auto; padding-bottom: 4px; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 11px); gap: 3px; width: max-content; }
.heat i { width: 11px; height: 11px; border-radius: 2px; background: var(--card2); box-shadow: inset 0 0 0 1px var(--line); }
.heat i[data-l="1"] { background: color-mix(in srgb, var(--accent) 25%, var(--card2)); box-shadow: none; }
.heat i[data-l="2"] { background: color-mix(in srgb, var(--accent) 50%, var(--card2)); box-shadow: none; }
.heat i[data-l="3"] { background: color-mix(in srgb, var(--accent) 75%, var(--card2)); box-shadow: none; }
.heat i[data-l="4"] { background: var(--accent); box-shadow: none; }
.heat i.future { visibility: hidden; }
.heat-legend { display: flex; align-items: center; gap: 3px; font-size: .74rem; color: var(--muted); }
.heat-scale { display: inline-flex; gap: 3px; margin: 0 4px; }
.heat-scale i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--card2); box-shadow: inset 0 0 0 1px var(--line); }
.heat-scale i[data-l="1"] { background: color-mix(in srgb, var(--accent) 25%, var(--card2)); box-shadow: none; }
.heat-scale i[data-l="2"] { background: color-mix(in srgb, var(--accent) 50%, var(--card2)); box-shadow: none; }
.heat-scale i[data-l="3"] { background: color-mix(in srgb, var(--accent) 75%, var(--card2)); box-shadow: none; }
.heat-scale i[data-l="4"] { background: var(--accent); box-shadow: none; }

/* Bilan de la semaine */
.review { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; }
.review > div { padding: 4px 16px 4px 0; display: flex; flex-direction: column; gap: 4px; }
.review > div + div { border-left: 1px solid var(--line); padding-left: 16px; }
.review b { font-size: 1.35rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.delta { font-size: .78rem; font-weight: 600; }
.delta.up { color: var(--green); } .delta.down { color: var(--red); } .delta.eq { color: var(--faint); }
@media (max-width: 560px) { .review > div:nth-child(odd) { border-left: 0; padding-left: 0; } .review > div { padding-top: 8px; padding-bottom: 8px; } }

/* ---------- Jeux ---------- */
.game-card { display: flex; flex-direction: column; gap: 10px; }
.game-card .gicon { font-size: 1.8rem; }
.game { max-width: 560px; margin: 0 auto; text-align: center; }
.game-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; font-size: .88rem; color: var(--muted); }
.game-top b { color: var(--text); font-variant-numeric: tabular-nums; }
.calc-q { font-family: var(--serif); font-size: clamp(2.2rem, 9vw, 3.4rem); font-weight: 600; margin: 18px 0; font-variant-numeric: tabular-nums; }
.calc-form { display: flex; gap: 10px; max-width: 320px; margin: 0 auto 14px; }
.calc-form input { font-size: 1.3rem; text-align: center; }
.flash-ok { animation: ok .35s; } .flash-bad { animation: bad .35s; }
@keyframes ok { 50% { color: var(--green); } }
@keyframes bad { 25%, 75% { transform: translateX(-5px); color: var(--red); } 50% { transform: translateX(5px); } }
.mem-grid, .sch-grid { display: grid; gap: 8px; max-width: 420px; margin: 0 auto 16px; }
.mem-cell { aspect-ratio: 1; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); cursor: pointer; transition: background .12s, transform .12s; padding: 0; }
.mem-cell.on { background: var(--accent); border-color: var(--accent); transform: scale(.96); }
.mem-cell.bad { background: var(--red); } .mem-cell.hint { background: var(--green); }
.sch-cell { aspect-ratio: 1; border-radius: 8px; background: var(--card2); border: 1px solid var(--line); cursor: pointer; font-weight: 600; font-size: clamp(.9rem, 4vw, 1.25rem); padding: 0; transition: .12s; font-variant-numeric: tabular-nums; }
.sch-cell.found { background: var(--green-soft); color: var(--green); border-color: transparent; }
.sch-cell.wrong { background: var(--red); color: #fff; }
.result { padding: 26px 10px; }
.result .big { font-size: 2.6rem; }
.lvl-path { display: flex; gap: 3px; flex-wrap: wrap; }
.lvl-path span { width: 10px; height: 10px; border-radius: 2px; background: var(--card); border: 1px solid var(--line); }
.lvl-path span.on { background: var(--accent); border-color: var(--accent); }

/* ---------- Journal ---------- */
.moods { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.mood { font-size: 1.5rem; width: 50px; height: 50px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); cursor: pointer; filter: grayscale(1); opacity: .55; transition: .12s; padding: 0; }
.mood:hover { opacity: .85; }
.mood.on { filter: none; opacity: 1; border-color: var(--ink); background: var(--card); }
.entry { padding: 14px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry p { margin: 6px 0 0; white-space: pre-wrap; }

/* ---------- Avatar & profil ---------- */
.av { display: inline-grid; place-items: center; border-radius: 50%; object-fit: cover; background: var(--accent-soft); color: var(--accent2); font-family: var(--serif); font-weight: 600; flex: none; line-height: 1; overflow: hidden; }
.profile-h { align-items: center; justify-content: flex-start; gap: 18px; }
.av-btn { position: relative; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.av-edit { position: absolute; right: -2px; bottom: -2px; background: var(--card); color: var(--muted); border: 1px solid var(--line2); border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; }
.av-edit .ic { width: 14px; height: 14px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; font-size: 1.35rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card2); cursor: pointer; padding: 0; }
.emoji-grid button:hover { border-color: var(--line2); background: var(--card); }
@media (max-width: 420px) { .emoji-grid { grid-template-columns: repeat(4, 1fr); } }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 10px; margin-top: 16px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; padding: 16px 10px 14px; border-radius: var(--r); background: var(--card2); border: 1px solid transparent; }
.badge .bicon { font-size: 1.8rem; filter: grayscale(1); opacity: .35; margin-bottom: 4px; }
.badge b { font-size: .88rem; }
.badge small { font-size: .74rem; color: var(--muted); line-height: 1.35; }
.badge:not(.on) b { color: var(--muted); }
.badge.on { background: var(--card); border-color: var(--line2); }
.badge.on .bicon { filter: none; opacity: 1; }

/* ---------- Musculation ---------- */
.pday { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.workout h2 { flex-wrap: wrap; }
.ex { padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px; }
.sets { display: grid; grid-template-columns: 36px 1fr 1fr 42px 32px; gap: 6px; align-items: center; max-width: 430px; }
.sets input { padding: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.setn { text-align: center; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.setchk { width: 40px; height: 38px; border-radius: 8px; border: 1.5px solid var(--line2); background: none; cursor: pointer; color: transparent; padding: 0; display: grid; place-items: center; }
.setchk .ic { width: 18px; height: 18px; stroke-width: 2.4; }
.setchk.on { background: var(--green); border-color: var(--green); color: #fff; }
.rest { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; color: var(--accent); font-variant-numeric: tabular-nums; }
details.wk summary { list-style: none; cursor: pointer; }
details.wk summary::-webkit-details-marker { display: none; }
.wk-body { padding: 4px 0 12px 48px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- Nutrition ---------- */
.nut-hero { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.ring.big { width: 150px; height: 150px; }
.ring.big .lvl { font-size: 2rem; font-weight: 600; letter-spacing: -.02em; }
.ring.big .lvl small { display: block; font-size: .74rem; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-top: 4px; }
.foods { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.food { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 10px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; text-align: left; transition: border-color .12s, background .12s; }
.food:hover { border-color: var(--line2); background: var(--card2); }
.food:active { transform: scale(.98); }
.food span { font-size: 1.2rem; margin-bottom: 2px; }
.food b { font-size: .84rem; font-weight: 550; }
.food small { color: var(--muted); font-size: .74rem; font-variant-numeric: tabular-nums; }
.food .fav { position: absolute; top: 7px; right: 9px; font-style: normal; color: var(--accent); font-size: .8rem; }
@media (max-width: 400px) { .foods { grid-template-columns: 1fr 1fr; } }

/* ---------- Notifications & états ---------- */
.toasts { position: fixed; z-index: 100; top: 16px; right: 16px; left: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--ink-text); padding: 10px 16px; border-radius: 8px; font-weight: 550; font-size: .9rem; animation: tin .22s ease-out; max-width: min(100%, 440px); }
.toast.big { border-left: 4px solid var(--accent); font-size: 1rem; padding: 12px 18px; }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }
.save-dot { position: fixed; z-index: 30; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); opacity: .45; }
.save-dot.saving { background: var(--amber); opacity: 1; }
.save-dot.err { background: var(--red); opacity: 1; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center; padding: 34px 26px; }
.err { color: var(--red); min-height: 1.2em; margin: 0; font-size: .9rem; }

/* ---------- Accessibilité ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 200; background: var(--ink); color: var(--ink-text); padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.skip:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.main:focus { outline: none; }
button:disabled { opacity: .45; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.card > h2 .btn { text-transform: none; letter-spacing: 0; font-size: .82rem; font-weight: 550; }
.card > h2 .btn:not(.primary):not(.accent) { color: var(--text); }
