/* ============================================================
   Momentum : graphite, filets fins, un seul signal vermillon.
   Host Grotesk pour l'interface, Martian Mono pour tous les chiffres.
   ============================================================ */

@font-face {
  font-family: 'Host Grotesk';
  src: url('../assets/fonts/HostGrotesk-Variable.woff2') format('woff2');
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: 'Martian Mono';
  src: url('../assets/fonts/MartianMono-Variable.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
  size-adjust: 88%;
}

:root {
  --bg: #090a0c;
  --rail: #0b0c0f;
  --surface: rgba(14, 16, 19, 0.9);
  --surface-2: #121418;
  --raised: #171a1f;
  --field: #0c0e11;
  --line: #1e2228;
  --line-2: #2b3037;
  --text: #eceef1;
  --text-2: #a4aab4;
  --text-3: #7f8590;
  --signal: #ff5b3a;
  --signal-ink: #1a0803;
  --signal-soft: rgba(255, 91, 58, 0.14);
  --warn: #f2b84b;
  --danger: #ff7b6e;
  --r: 10px;
  --r-sm: 7px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: 'Host Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Martian Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line-2) transparent; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  caret-color: var(--signal);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid var(--bg); }
::selection { background: rgba(255, 91, 58, 0.32); color: #fff; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
kbd {
  font: 500 10.5px/1 var(--mono);
  padding: 3px 5px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  color: var(--text-3);
}

.ic { width: 16px; height: 16px; flex: none; }
.muted { color: var(--text-2); }
.spacer { flex: 1; }
.sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); margin: 0 10px; display: inline-block; vertical-align: middle; }
.tick { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--text-3)); flex: none; }

/* ---------- Fond ---------- */

#bg3d { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; display: block; pointer-events: none; }
.bg-veil {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(9, 10, 12, 0) 0%, rgba(9, 10, 12, 0.35) 55%, rgba(9, 10, 12, 0.8) 100%),
    linear-gradient(90deg, rgba(9, 10, 12, 0.45) 0%, rgba(9, 10, 12, 0) 60%);
}

/* ---------- Rail de navigation ---------- */

.sidebar {
  position: fixed; z-index: 20;
  top: 0; bottom: 0; left: 0; width: 224px;
  display: flex; flex-direction: column; gap: 28px;
  padding: 20px 12px 16px;
  background: rgba(11, 12, 15, 0.94);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.brand img { border-radius: 7px; }

.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  height: 36px; padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}
.nav a span { flex: 1; }
.nav a kbd { opacity: 0; transition: opacity 0.15s; }
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.nav a:hover kbd { opacity: 1; }
.nav a.active { color: var(--text); background: var(--raised); }
.nav a.active .ic { color: var(--signal); }

.level { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--line); }
.lv-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lv-top b { display: block; font-size: 13px; font-weight: 600; }
.lv-top small { color: var(--text-3); font: 500 11.5px var(--mono); }
.avatar {
  width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center;
  border: 1px solid var(--line-2); font: 600 12px var(--mono); color: var(--text-2);
}

/* ---------- Zone principale ---------- */

.view {
  position: relative; z-index: 1;
  margin-left: 224px;
  padding: 40px 48px 96px;
  max-width: 1180px;
  outline: none;
}
.view.enter > * { animation: enter 0.22s var(--ease) backwards; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: 28px; line-height: 1.15; letter-spacing: -0.025em; }
h1 .who { color: var(--text-2); font-weight: 500; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
.lead { margin: 8px 0 0; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.lead time, .lead b { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lead b { color: var(--text); font-weight: 500; }
.late-text { color: var(--warn); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.section { margin-top: 36px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 13px; font-weight: 500; transition: color 0.15s; }
.link:hover { color: var(--text); }
.link .ic { width: 14px; height: 14px; }
.hint { color: var(--text-3); font-size: 12.5px; margin: 12px 2px 0; }

/* ---------- Bande de chiffres ---------- */

.band {
  display: grid; grid-template-columns: 1.6fr repeat(3, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.metric { padding: 16px 18px 18px; min-width: 0; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric-label { margin: 0; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.metric-value { margin: 10px 0 0; display: flex; align-items: baseline; gap: 3px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.metric-value b { font-size: 28px; font-weight: 500; line-height: 1; letter-spacing: -0.03em; }
.metric-value span { color: var(--text-3); font-size: 14px; }
.metric-sub { margin: 8px 0 0; color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric.warn .metric-value b, .metric.warn .metric-sub { color: var(--warn); }

.segbar { display: flex; gap: 3px; margin-top: 14px; }
.segbar i { flex: 1; height: 4px; border-radius: 1px; background: var(--line-2); transition: background 0.3s var(--ease); }
.segbar i.on { background: var(--signal); }

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-weight: 500; font-size: 13px; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--raised); border-color: #3a4048; }
.btn:active { background: #1c1f25; }
.btn.primary { border-color: var(--signal); background: var(--signal); color: var(--signal-ink); font-weight: 600; }
.btn.primary:hover { background: #ff6f51; border-color: #ff6f51; }
.btn.primary:active { background: #f04e2e; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.btn.danger { color: var(--danger); border-color: rgba(255, 123, 110, 0.3); background: transparent; }
.btn.danger:hover { background: rgba(255, 123, 110, 0.08); }
.btn.danger.ghost { border-color: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn kbd { margin-left: 2px; }
.btn:disabled { opacity: 0.4; pointer-events: none; }

.icon-btn {
  width: 32px; height: 32px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: var(--r-sm); border: 1px solid transparent;
  background: transparent; color: var(--text-3);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); background: rgba(255, 123, 110, 0.08); }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 5px; }
.icon-btn.sm .ic { width: 14px; height: 14px; }
.icon-btn:disabled { opacity: 0.25; pointer-events: none; }

/* ---------- Listes ---------- */

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.list > * + * { border-top: 1px solid var(--line); }

.habit-item { display: flex; align-items: center; gap: 16px; padding: 12px 14px 12px 16px; min-height: 60px; }
.hi-title { flex: 1; min-width: 0; }
.hi-title h3 { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.2s; }
.hi-title p, .hr-title p { margin: 2px 0 0; color: var(--text-3); font-size: 12px; display: flex; align-items: center; flex-wrap: wrap; }
.hi-title p .ic, .hr-title p .ic { width: 12px; height: 12px; margin-right: 3px; }
.hi-title p .sep, .hr-title p .sep { margin: 0 7px; }
.habit-item.is-done .hi-title h3 { color: var(--text-2); }

.streak { display: inline-flex; align-items: center; gap: 5px; min-width: 52px; color: var(--text-3); font: 500 12px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.streak .ic { width: 13px; height: 13px; }
.streak b { font-weight: 500; }
.streak.live { color: var(--text-2); }
.streak.live .ic { color: var(--signal); }

.check {
  position: relative;
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  border: 1.5px solid var(--line-2);
  background: transparent; color: var(--signal-ink);
  transition: background 0.2s var(--ease), border-color 0.2s;
}
.check > .ic { width: 16px; height: 16px; stroke-width: 2.5; opacity: 0; transition: opacity 0.15s; }
.check:hover { border-color: var(--signal); }
.check:hover > .ic { opacity: 0.6; color: var(--signal); }
.check.on { background: var(--signal); border-color: var(--signal); }
.check.on > .ic { opacity: 1; color: var(--signal-ink); }
.seal { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); fill: none; stroke: var(--signal); stroke-width: 1.5; stroke-dasharray: 113.1; stroke-dashoffset: 113.1; opacity: 0; pointer-events: none; }
.check.stamp .seal { animation: seal 0.6s var(--ease) forwards; }
.check.stamp { animation: stamp 0.35s var(--ease); }
@keyframes seal {
  0% { opacity: 1; stroke-dashoffset: 113.1; }
  60% { opacity: 1; stroke-dashoffset: 0; }
  100% { opacity: 0; stroke-dashoffset: 0; transform: rotate(-90deg) scale(1.15); }
}
@keyframes stamp { 0% { transform: scale(0.86); } 100% { transform: none; } }

.counter { display: flex; align-items: center; gap: 4px; color: var(--text-3); font: 500 12px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.counter b { color: var(--text); font-weight: 500; font-size: 13px; }
.counter small { margin-left: 4px; font: 400 12px var(--font); }
.counter .icon-btn { border-color: var(--line-2); }

.meter { height: 3px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--signal); transition: width 0.4s var(--ease); }

.dots { display: flex; gap: 3px; }
.dot {
  width: 22px; height: 22px; padding: 0; border-radius: 5px;
  border: 1px solid var(--line-2); background: transparent;
  display: grid; place-items: center; transition: background 0.2s, border-color 0.2s;
}
.dot span { font: 500 9.5px var(--mono); color: var(--text-3); }
.dot:hover { border-color: var(--text-3); }
.dot.done { background: var(--signal); border-color: var(--signal); }
.dot.done span { color: var(--signal-ink); }
.dot.part { background: var(--signal-soft); border-color: rgba(255, 91, 58, 0.45); }
.dot.miss { border-style: dashed; border-color: #4a4f57; }
.dot.is-today { outline: 1px solid var(--text-3); outline-offset: 2px; }

.later { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; color: var(--text-3); font-size: 12.5px; }
.later > span { margin-right: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); font-size: 12.5px;
  transition: color 0.15s, border-color 0.15s;
}
.chip:hover { color: var(--text); border-color: #3a4048; }

/* ---------- Tâches (liste) ---------- */

.task-row {
  --pc: var(--text-3);
  display: flex; align-items: center; gap: 14px; padding: 11px 16px; min-height: 56px;
  cursor: pointer; transition: background 0.15s;
}
.task-row:hover { background: rgba(255, 255, 255, 0.02); }
.tcheck {
  width: 18px; height: 18px; flex: none; border-radius: 4px; padding: 0;
  border: 1.5px solid var(--line-2); background: transparent;
  display: grid; place-items: center; color: var(--signal-ink); transition: background 0.15s, border-color 0.15s;
}
.tcheck .ic { width: 12px; height: 12px; stroke-width: 3; opacity: 0; }
.tcheck:hover { border-color: var(--signal); }
.tcheck.on { background: var(--signal); border-color: var(--signal); }
.tcheck.on .ic { opacity: 1; }
.tr-main { flex: 1; min-width: 0; }
.tr-title { margin: 0 0 4px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-meta { display: flex; flex-wrap: wrap; gap: 6px; }

.p0 { --pc: var(--text-3); }
.p1 { --pc: var(--text-2); }
.p2 { --pc: var(--warn); }
.p3 { --pc: var(--signal); }
.prio { display: inline-flex; align-items: center; gap: 6px; font: 500 11.5px var(--mono); color: var(--pc); }
.prio::before { content: ''; width: 6px; height: 6px; border-radius: 1px; background: currentColor; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11.5px; color: var(--text-2); border: 1px solid var(--line-2); }
.tag.doing { color: var(--text); border-color: var(--text-3); }
.due { display: inline-flex; align-items: center; gap: 5px; font: 500 12px var(--mono); color: var(--text-2); white-space: nowrap; }
.due .ic { width: 13px; height: 13px; }
.due.soon { color: var(--text); }
.due.late { color: var(--warn); }

/* ---------- Vide ---------- */

.empty { padding: 32px 24px; text-align: center; display: grid; justify-items: center; gap: 6px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r); }
.empty h3 { font-size: 14px; }
.empty p { margin: 0 0 10px; color: var(--text-2); max-width: 44ch; font-size: 13px; }

/* ---------- Page habitudes ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip-btn {
  height: 30px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--text-2); font-size: 12.5px; font-weight: 500; transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.chip-btn:hover { color: var(--text); }
.chip-btn.on { color: var(--text); background: var(--raised); border-color: var(--text-3); }

.habit-row {
  padding: 14px 16px;
  display: grid; grid-template-columns: minmax(200px, 1fr) auto auto auto; align-items: center; gap: 24px;
}
.hr-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hr-title { min-width: 0; }
.hr-title h3 { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hr-notes { color: var(--text-3) !important; }

.strip { display: flex; gap: 3px; }
.cell {
  width: 28px; height: 38px; padding: 0; border-radius: 5px; border: 1px solid var(--line-2); background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; transition: background 0.2s, border-color 0.2s;
}
.cell::before { content: attr(data-wd); font: 500 9px var(--mono); color: var(--text-3); }
.cell em { font: 500 11.5px var(--mono); font-style: normal; color: var(--text-2); }
.cell:hover { border-color: var(--text-3); }
.cell.done { background: var(--signal); border-color: var(--signal); }
.cell.done::before, .cell.done em { color: var(--signal-ink); }
.cell.part { background: var(--signal-soft); border-color: rgba(255, 91, 58, 0.45); }
.cell.miss { border-style: dashed; border-color: #4a4f57; }
.cell.off { border-color: var(--line); color: var(--text-3); } .cell.off em, .cell.off::before { color: var(--text-3); }
.cell.is-today { outline: 1px solid var(--text-3); outline-offset: 2px; }

.hr-stats { display: flex; gap: 20px; }
.hr-stats div { display: grid; min-width: 48px; }
.hr-stats b { font: 500 15px var(--mono); font-variant-numeric: tabular-nums; }
.hr-stats span { font-size: 11.5px; color: var(--text-3); }
.hr-actions { display: flex; gap: 2px; }

.archived { margin-top: 20px; padding: 2px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.archived summary { display: flex; align-items: center; gap: 8px; padding: 12px 0; cursor: pointer; color: var(--text-2); font-weight: 500; list-style: none; }
.archived summary::-webkit-details-marker { display: none; }
.arch-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.arch-row > span:first-child { display: inline-flex; align-items: center; gap: 10px; }

/* ---------- Page tâches ---------- */

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.search { flex: 1 1 240px; display: flex; align-items: center; gap: 9px; padding: 0 11px; height: 34px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line-2); color: var(--text-3); transition: border-color 0.15s, box-shadow 0.15s; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); }
.search input::placeholder { color: var(--text-3); }
.search:focus-within { border-color: var(--signal); box-shadow: 0 0 0 3px rgba(255, 91, 58, 0.15); }
select {
  height: 34px; padding: 0 30px 0 11px; border-radius: var(--r-sm); border: 1px solid var(--line-2); appearance: none; cursor: pointer; font-size: 13px;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237f8590' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center / 14px;
}
select:hover { border-color: #3a4048; }
select option { background: var(--surface-2); }

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.col { padding: 10px; min-height: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); transition: border-color 0.15s, background 0.15s; }
.col.over { border-color: var(--signal); background: rgba(255, 91, 58, 0.04); }
.col-head { display: flex; align-items: center; gap: 9px; padding: 4px 4px 12px; }
.col-head h3 { flex: 1; font-size: 13px; }
.col-dot { width: 7px; height: 7px; border-radius: 1px; background: var(--text-3); }
.col-dot.doing { background: var(--text); }
.col-dot.done { background: var(--signal); }
.count { font: 500 12px var(--mono); color: var(--text-3); padding: 0 4px; }
.col-body { display: grid; gap: 8px; }
.col-empty { margin: 0; padding: 28px 10px; text-align: center; color: var(--text-3); font-size: 12.5px; border: 1px dashed var(--line-2); border-radius: var(--r-sm); }

.task-card {
  --pc: var(--text-3);
  position: relative; padding: 12px 12px 8px; border-radius: 8px; cursor: grab;
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: border-color 0.15s, opacity 0.15s, transform 0.15s;
}
.task-card:hover { border-color: var(--line-2); }
.task-card.dragging { opacity: 0.4; }
.task-card.overdue { border-color: rgba(242, 184, 75, 0.35); }
.task-card.is-done h4 { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-3); }
.tc-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 7px; }
.task-card h4 { font-weight: 500; font-size: 13.5px; line-height: 1.4; letter-spacing: 0; }
.tc-notes { margin: 5px 0 0; color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.sub-progress { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.sub-progress .meter { flex: 1; }
.sub-progress small { color: var(--text-3); font: 500 11px var(--mono); }
.tc-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; min-height: 26px; }
.tc-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.task-card:hover .tc-actions, .task-card:focus-within .tc-actions { opacity: 1; }

/* ---------- Statistiques ---------- */

.grid-2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; margin-top: 12px; }
.band + .grid-2 { margin-top: 16px; }
.panel { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h3 { display: flex; align-items: center; gap: 8px; }
.panel-head h3 .ic { color: var(--text-3); }
.panel-head .muted { font-size: 12px; color: var(--text-3); }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); }
.chart .axis { fill: var(--text-3); font: 500 10px var(--mono); }
.chart .bar { fill: #3a3f47; }
.chart .bar.full { fill: var(--signal); }
.chart .bar.zero { fill: var(--line-2); }
.chart .avg { stroke: var(--text-2); stroke-dasharray: 3 4; }

.heatmap { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.hm-days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.hm-days span { font: 500 10px/14px var(--mono); color: var(--text-3); height: 14px; }
.hm-grid { display: flex; gap: 3px; }
.hm-col { display: grid; grid-template-rows: repeat(7, 14px); gap: 3px; }
.hm { display: block; width: 14px; height: 14px; border-radius: 2px; background: var(--line); }
.hm.none { background: #14171b; }
.hm.future { background: transparent; }
.hm.l0 { background: #22262c; }
.hm.l1 { background: rgba(255, 91, 58, 0.25); }
.hm.l2 { background: rgba(255, 91, 58, 0.48); }
.hm.l3 { background: rgba(255, 91, 58, 0.72); }
.hm.l4 { background: var(--signal); }
.hm-legend { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin-top: 12px; font-size: 11.5px; color: var(--text-3); }
.hm-legend span { margin: 0 5px; }

.rank { display: grid; gap: 12px; }
.rank-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 48px; align-items: center; gap: 12px; font-size: 13px; }
.rank-name { display: flex; align-items: center; gap: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.rank-bar span { display: block; height: 100%; background: var(--text-2); }
.rank-row b { text-align: right; font: 500 12.5px var(--mono); }

.donut-wrap { display: flex; align-items: center; gap: 24px; }
.donut { width: 112px; height: 112px; transform: rotate(-90deg); flex: none; }
.donut circle { fill: none; stroke-width: 10; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; flex: 1; }
.legend li { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; }
.legend b { margin-left: auto; color: var(--text); font: 500 13px var(--mono); }
.prio-bars { display: grid; gap: 8px; margin-top: 20px; }
.prio-bar { display: grid; grid-template-columns: 70px 1fr 24px; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); }
.prio-bar div { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.prio-bar i { display: block; height: 100%; background: var(--pc); }
.prio-bar b { text-align: right; color: var(--text); font: 500 12px var(--mono); }
.avg-key { display: inline-block; width: 14px; border-top: 1px dashed var(--text-2); vertical-align: middle; margin-right: 6px; }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.badge { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); margin: 0 -1px -1px 0; }
.badge > div { flex: 1; min-width: 0; }
.badge b { display: block; font-size: 13px; font-weight: 500; color: var(--text-3); }
.badge small { color: var(--text-3); font-size: 12px; }
.badge-ic { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--line-2); color: var(--text-3); }
.badge-state { font: 500 11px var(--mono); color: var(--text-3); }
.badge.on b { color: var(--text); }
.badge.on small { color: var(--text-2); }
.badge.on .badge-ic { color: var(--signal); border-color: rgba(255, 91, 58, 0.4); }
.badge.on .badge-state { color: var(--signal); }

/* ---------- Réglages ---------- */

.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.settings .panel { display: grid; gap: 14px; align-content: start; }
.settings .panel-head { margin-bottom: 0; }
.settings p { margin: 0; font-size: 13px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.shortcuts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.shortcuts li { display: flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 13px; }
.shortcuts li span { margin-left: 8px; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.track { width: 34px; height: 20px; border-radius: 10px; background: var(--line-2); position: relative; transition: background 0.2s; flex: none; }
.track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text); transition: transform 0.2s var(--ease); }
.switch input:checked + .track { background: var(--signal); }
.switch input:checked + .track::after { transform: translateX(14px); background: var(--signal-ink); }
.switch input:focus-visible + .track { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ---------- Formulaires ---------- */

.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > span, .field > legend, .field .label { font-size: 12.5px; font-weight: 500; color: var(--text-2); padding: 0; }
.field small { font-weight: 400; color: var(--text-3); }
.field input:not([type=radio]):not([type=checkbox]), .field textarea, .sub-input {
  width: 100%; height: 36px; padding: 0 11px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--field);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.field input::placeholder, .field textarea::placeholder, .sub-input::placeholder { color: var(--text-3); }
.field textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .sub-input:focus { border-color: var(--signal); box-shadow: 0 0 0 3px rgba(255, 91, 58, 0.15); }
.field input[type=time], .field input[type=date], .field input[type=number] { font-family: var(--mono); color-scheme: dark; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 140px; }
.field-row > .grow { flex: 3 1 200px; }

.seg { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line-2); }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px; border-radius: 5px; color: var(--text-2); font-size: 12.5px; font-weight: 500; text-align: center; cursor: pointer; transition: background 0.15s, color 0.15s; }
.seg span:hover { color: var(--text); }
.seg input:checked + span { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg input:focus-visible + span { outline: 2px solid var(--signal); }
.pdot { width: 6px; height: 6px; border-radius: 1px; background: var(--pc); }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 22px; height: 22px; border-radius: 5px; background: var(--c); transition: box-shadow 0.15s; }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 3.5px var(--text); }
.swatch input:focus-visible + span { outline: 2px solid var(--signal); outline-offset: 4px; }

.days-pick { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.days-pick label { position: relative; }
.days-pick input { position: absolute; opacity: 0; }
.days-pick span { display: grid; place-items: center; width: 42px; height: 32px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--text-2); font: 500 12px var(--mono); cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.days-pick input:checked + span { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.days-pick input:focus-visible + span { outline: 2px solid var(--signal); outline-offset: 2px; }
[data-show] { margin-top: 10px; }
[hidden] { display: none !important; }

.subtasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.subtasks li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; background: var(--field); }
.subtasks label { flex: 1; display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.subtasks input { width: 15px; height: 15px; accent-color: var(--signal); }
.subtasks li.done span { color: var(--text-3); text-decoration: line-through; }
.sub-add { display: flex; gap: 8px; }
.sub-input { flex: 1; height: 32px !important; }
.form-error { margin: 0; color: var(--danger); font-size: 13px; font-weight: 500; }

/* ---------- Fenêtres ---------- */

dialog { color: var(--text); }
.modal { border: 0; padding: 0; background: transparent; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: visible; }
.modal::backdrop, .palette::backdrop { background: rgba(5, 6, 8, 0.72); }
.modal-card {
  display: flex; flex-direction: column; max-height: calc(100vh - 32px);
  background: var(--surface-2);
  border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.75);
}
dialog[open] .modal-card, dialog[open] .palette-card { animation: dialog-in 0.18s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 4px; }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 12px 18px 4px; display: grid; gap: 16px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 18px 16px; border-top: 1px solid var(--line); margin-top: 12px; }

.palette { border: 0; padding: 0; background: transparent; width: min(580px, calc(100vw - 24px)); margin-top: 12vh; }
.palette-card { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.75); }
.pal-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--text-3); }
.pal-input input { flex: 1; border: 0; background: none; outline: none; font-size: 15px; color: var(--text); }
.pal-input input::placeholder { color: var(--text-3); }
.pal-list { list-style: none; margin: 0; padding: 6px; max-height: 380px; overflow-y: auto; }
.pal-list li { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 6px; cursor: pointer; color: var(--text-2); }
.pal-list li.sel { background: var(--raised); color: var(--text); }
.pal-list li.sel .pal-ic { color: var(--signal); }
.pal-ic { width: 20px; display: grid; place-items: center; color: var(--text-3); }
.pal-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-list small { color: var(--text-3); font-size: 11.5px; }
.pal-empty { justify-content: center; color: var(--text-3) !important; cursor: default !important; }
.pal-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 11.5px; }
.pal-foot kbd { margin-right: 3px; }

/* ---------- Notifications ---------- */

.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 380px;
  padding: 10px 10px 10px 14px; border-radius: 8px;
  background: var(--raised); border: 1px solid var(--line-2);
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.7);
  transform: translateY(8px); opacity: 0; transition: transform 0.2s var(--ease), opacity 0.2s;
}
.toast.in { transform: none; opacity: 1; }
.toast-msg { font-size: 13px; font-weight: 500; }
.toast-btn { padding: 5px 9px; border-radius: 5px; border: 0; background: transparent; font-size: 12.5px; font-weight: 600; color: var(--signal); }
.toast-btn:hover { background: var(--signal-soft); }

/* ---------- Responsive ---------- */

@media (max-width: 1320px) {
  .habit-row { grid-template-columns: 1fr auto; }
  .habit-row .strip { grid-column: 1 / -1; grid-row: 2; }
  .habit-row .hr-stats { grid-column: 1; grid-row: 3; }
  .habit-row .hr-actions { grid-column: 2; grid-row: 1; }
}
@media (max-width: 1200px) {
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 1000px) {
  .habit-item { flex-wrap: wrap; row-gap: 10px; }
  .habit-item .hi-title { flex-basis: calc(100% - 82px); }
  .habit-item .check { order: 1; }
  .habit-item .dots { order: 2; margin-left: 24px; }
  .habit-item .streak { order: 3; }
  .habit-item .counter { order: 4; margin-left: auto; }
}

@media (max-width: 860px) {
  .sidebar {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    flex-direction: row; padding: 6px 8px max(6px, env(safe-area-inset-bottom)); gap: 0;
    border-right: 0; border-top: 1px solid var(--line);
  }
  .brand, .level { display: none; }
  .nav { grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; gap: 2px; }
  .nav a { flex-direction: column; gap: 3px; height: auto; padding: 7px 2px; font-size: 10.5px; text-align: center; }
  .nav a .ic { width: 18px; height: 18px; }
  .nav a kbd { display: none; }
  .nav a.active { background: transparent; }
  .view { margin-left: 0; padding: 24px 16px 100px; }
  h1 { font-size: 24px; }
  .hide-sm { display: none !important; }
  .page-head { margin-bottom: 20px; }
  .band { grid-template-columns: 1fr 1fr; }
  .metric-main { grid-column: 1 / -1; }
  .metric + .metric { border-left: 0; }
  .band .metric { border-top: 1px solid var(--line); }
  .band .metric-main { border-top: 0; }
  .band .metric:nth-child(3) { border-left: 1px solid var(--line); }
  .band .metric:nth-child(4) { grid-column: 1 / -1; }
  .metric-value b { font-size: 24px; }
  .habit-item { column-gap: 12px; }
  .habit-item .hi-title { flex-basis: calc(100% - 72px); }
  .habit-item .dots { margin-left: 20px; }
  .toolbar select { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .search { flex-basis: 100%; }
  .habit-row { padding: 14px; gap: 14px; }
  .strip { overflow-x: auto; padding: 3px 3px 4px; margin: -3px; }
  .cell { flex: none; width: 32px; }
  .board { grid-template-columns: repeat(3, 86%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; margin: 0 -16px; padding-inline: 16px; }
  .col { scroll-snap-align: center; min-height: 300px; }
  .tc-actions { opacity: 1; }
  .settings { grid-template-columns: 1fr; }
  .toasts { left: 12px; right: 12px; bottom: 80px; justify-items: stretch; }
  .toast { max-width: none; }
  .rank-row { grid-template-columns: minmax(0, 1fr) 80px 44px; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut { align-self: center; }
}

@media (max-width: 420px) {
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .page-head .btn { flex: 1; }
  .dot { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   Thème clair
   ============================================================ */

:root { --donut-1: #4b515b; --donut-2: #c3c8d0; --hover: rgba(255, 255, 255, 0.04); --hover-2: rgba(255, 255, 255, 0.03); --border-hover: #3a4048; --press: #1c1f25; --bar: #3a3f47; --hm-none: #14171b; --hm-0: #22262c; --miss: #4a4f57; --shadow: rgba(0, 0, 0, 0.75); --backdrop: rgba(5, 6, 8, 0.72); --sidebar: rgba(11, 12, 15, 0.94); }

:root[data-theme="light"] {
  --bg: #f4f5f7;
  --rail: #ffffff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-2: #ffffff;
  --raised: #eceef2;
  --field: #ffffff;
  --line: #e3e6eb;
  --line-2: #d0d5dc;
  --text: #16181d;
  --text-2: #4d5460;
  --text-3: #5f6672;
  --signal: #c9381a;
  --signal-ink: #ffffff;
  --signal-soft: rgba(232, 73, 42, 0.14);
  --warn: #8f5a0c;
  --danger: #c23a30;
  --donut-1: #c8cdd5; --donut-2: #5b6270; --hover: rgba(0, 0, 0, 0.04); --hover-2: rgba(0, 0, 0, 0.025); --border-hover: #aab1bb; --press: #e4e7ec; --bar: #b9bfc8; --hm-none: #eef0f3; --hm-0: #e1e4e9; --miss: #b4bac3; --shadow: rgba(20, 24, 32, 0.22); --backdrop: rgba(30, 34, 40, 0.45); --sidebar: rgba(255, 255, 255, 0.94);
  color-scheme: light;
}
:root[data-theme="light"] .bg-veil {
  background:
    linear-gradient(180deg, rgba(244, 245, 247, 0.2) 0%, rgba(244, 245, 247, 0.55) 55%, rgba(244, 245, 247, 0.9) 100%),
    linear-gradient(90deg, rgba(244, 245, 247, 0.6) 0%, rgba(244, 245, 247, 0) 60%);
}
:root[data-theme="light"] ::selection { background: rgba(232, 73, 42, 0.25); color: inherit; }
:root[data-theme="light"] .field input[type=time], :root[data-theme="light"] .field input[type=date], :root[data-theme="light"] .field input[type=number] { color-scheme: light; }
:root[data-theme="light"] .btn.primary:hover { background: #b2301a; border-color: #b2301a; }
:root[data-theme="light"] .btn.primary:active { background: #9a2915; }
:root[data-theme="light"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6672' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }

/* Variables de thème appliquées aux couleurs qui étaient codées en dur */
.sidebar { background: var(--sidebar); }
.nav a:hover { background: var(--hover-2); }
.btn:hover { border-color: var(--border-hover); }
.btn:active { background: var(--press); }
.btn.ghost:hover { background: var(--hover); }
.icon-btn:hover { background: var(--hover); }
.task-row:hover { background: var(--hover-2); }
.chip:hover, .chip-btn:hover, select:hover { border-color: var(--border-hover); }
.dot.miss, .cell.miss { border-color: var(--miss); }
.chart .bar { fill: var(--bar); }
.hm.none { background: var(--hm-none); }
.hm.l0 { background: var(--hm-0); }
.hm.l1 { background: color-mix(in srgb, var(--signal) 25%, transparent); }
.hm.l2 { background: color-mix(in srgb, var(--signal) 48%, transparent); }
.hm.l3 { background: color-mix(in srgb, var(--signal) 72%, transparent); }
.donut-bg { stroke: var(--line); }
.modal::backdrop, .palette::backdrop { background: var(--backdrop); }
.modal-card, .palette-card { box-shadow: 0 24px 64px -16px var(--shadow); }
.toast { box-shadow: 0 12px 32px -10px var(--shadow); }
.dot.part, .cell.part { border-color: color-mix(in srgb, var(--signal) 45%, transparent); }
.search:focus-within, .field input:focus, .field textarea:focus, .sub-input:focus { box-shadow: 0 0 0 3px var(--signal-soft); }

/* ============================================================
   Nouveaux composants : bannières, groupes, outils, minuteur, journal…
   ============================================================ */

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
  color: var(--text-2); font-size: 13px;
}
.banner > .ic { color: var(--signal); }
.banner > span:first-of-type { flex: 1; min-width: 200px; }
.banner.install { border-style: dashed; }
.banner.timer-banner { cursor: pointer; }
.banner.timer-banner span { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.banner .small { font-size: 12px; flex-basis: 100%; }

.group + .group { margin-top: 14px; }
.group-title { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 8px; font-size: 12.5px; font-weight: 500; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.group-title small { font: 500 11.5px var(--mono); color: var(--text-3); }

.hi-tools { display: flex; gap: 2px; opacity: 0.55; transition: opacity 0.15s; }
.habit-item:hover .hi-tools, .habit-item:focus-within .hi-tools { opacity: 1; }
.icon-btn.has-note { color: var(--signal); }
.habit-item.is-quit .check.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.habit-item.is-quit .check.on > .ic { color: var(--bg); }

.dot.skip, .cell.skip { border-style: dotted; border-color: var(--text-3); background: var(--hover); }
.dot.skip span, .cell.skip::before { color: var(--text-2); }
.dot.off { border-color: var(--line); color: var(--text-3); }
.habit-row.is-paused .hr-main, .habit-row.is-paused .strip, .habit-row.is-paused .hr-stats { opacity: 0.55; }
.hr-notes .ic { width: 11px; height: 11px; margin-right: 4px; vertical-align: -1px; }
.hr-title h3 .tag { margin-left: 8px; font-weight: 400; vertical-align: middle; }

.warn-text { color: var(--warn); }
.self-end { align-self: end; }
.btn-row.center { justify-content: center; }
.insights { margin-top: 16px; }
.insight-list { margin: 0; padding: 0 0 0 18px; display: grid; gap: 8px; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.insight-list li::marker { color: var(--signal); }
.mood-line { margin-top: 16px !important; display: flex; align-items: center; gap: 6px; font-size: 13px; }
.mood-line b { color: var(--text); font-family: var(--mono); }

.hm-body { display: grid; gap: 4px; }
.hm-months { display: grid; gap: 3px; height: 14px; }
.hm-months span { font: 500 10px/14px var(--mono); color: var(--text-3); white-space: nowrap; }
.hm-days span:first-child { height: 14px; }
.heatmap.year .hm-grid { gap: 3px; }

.templates .label { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; }
.templates .label .ic { color: var(--signal); width: 14px; height: 14px; }
.tpl-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.tpl-row .chip { flex: none; }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap label { flex: 1 1 30%; }
.rem-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.rem-row input { height: 34px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--field); font-family: var(--mono); }
.reminders { margin-top: 6px; }
.field .label .ic { width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px; }
.modal-card.wide { width: 100%; }
.modal.wide, .modal:has(.wide) { width: min(640px, calc(100vw - 24px)); }
.modal:has(.narrow) { width: min(400px, calc(100vw - 24px)); }
.modal-head h2 .ic { width: 18px; height: 18px; margin-right: 8px; vertical-align: -3px; color: var(--signal); }

.moods { display: flex; gap: 6px; }
.mood { flex: 1; position: relative; cursor: pointer; }
.mood input { position: absolute; opacity: 0; }
.mood span { display: grid; place-items: center; height: 44px; font-size: 22px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--field); transition: border-color 0.15s, background 0.15s; }
.mood small { display: block; margin-top: 4px; text-align: center; font-size: 10.5px; color: var(--text-3); }
.mood input:checked + span { border-color: var(--signal); background: var(--signal-soft); }
.mood input:focus-visible + span { outline: 2px solid var(--signal); }

.timer-body { align-items: center; justify-items: center; text-align: center; }
.timer-ring { position: relative; width: 180px; height: 180px; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke-width: 6; }
.timer-ring .track { stroke: var(--line); }
.timer-ring .prog { stroke: var(--signal); stroke-linecap: round; stroke-dasharray: 0 400; transition: stroke-dasharray 0.25s linear; }
.timer-clock { position: absolute; inset: 0; display: grid; place-items: center; font: 500 36px var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.timer-dur { width: 160px; }
.timer-body .field input { text-align: center; }

.code { width: 100%; min-height: 70px; padding: 9px 11px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--field); font: 500 11.5px/1.5 var(--mono); color: var(--text-2); resize: vertical; word-break: break-all; }
.code:focus { outline: none; border-color: var(--signal); }
.snaps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.snaps li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.settings .field select { width: 100%; }
.panel-head .link { background: none; border: 0; padding: 0; cursor: pointer; }
.settings .panel .panel-head + .panel-head { margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.field > span .ic { width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px; }

@media (max-width: 860px) {
  .hi-tools { opacity: 1; order: 5; }
  .habit-item .hi-tools { margin-left: auto; }
  .habit-item .counter { margin-left: 0; }
  .seg.wrap label { flex-basis: 45%; }
  .moods { flex-wrap: wrap; }
  .mood { flex: 1 1 30%; }
}

/* Les enfants d'une grille ne doivent pas forcer sa largeur (rangée de modèles défilante, segments). */
.modal-body > *, .modal-body .field, .templates { min-width: 0; }
.tpl-row { height: 40px; } /* conteneur défilant : hauteur fixe, sinon il s'écrase dans une grille contrainte */

.grid-2 > .panel { min-width: 0; }
.grid-2 > .panel.wide { grid-column: 1 / -1; }
.heatmap { max-width: 100%; }

/* ---------- Mon année (3D) ---------- */

.year-wrap { position: relative; margin-bottom: 16px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: #07080c; }
.year-canvas { display: block; width: 100%; height: min(62vh, 560px); }
.year-controls { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; }
.year-controls .chip-btn { background: rgba(14, 15, 22, 0.8); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #cfd0da; border-color: rgba(255, 255, 255, 0.14); }
.year-controls .chip-btn.on { color: #fff; border-color: #ff7a59; background: rgba(255, 122, 89, 0.18); }
.nav a:nth-child(5) .ic { stroke-width: 1.6; }

/* ---------- Jamais deux fois ---------- */

.habit-item.is-recovery { background: linear-gradient(90deg, color-mix(in srgb, var(--warn) 9%, transparent), transparent 40%); }
.habit-item.is-recovery .check { border-color: var(--warn); }
.recover-line, .vote-line { margin: 4px 0 0 !important; color: var(--text-2) !important; font-size: 12px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.recover-line .ic { color: var(--warn); width: 12px; height: 12px; }
.vote-line .ic { color: var(--signal); width: 12px; height: 12px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--warn); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.recover-banner > .ic { color: var(--warn); }
.dot.done.mini, .cell.done.mini { background: color-mix(in srgb, var(--signal) 55%, transparent); border-style: dashed; }
.hr-notes.identity .ic { color: var(--signal); }

/* ---------- Identités ---------- */

.identities { margin-top: 12px; }
.id-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.id-card { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); }
.id-card b { font-weight: 600; font-size: 13.5px; }
.id-card .id-votes { grid-row: span 2; align-self: center; font: 500 26px var(--mono); color: var(--signal); letter-spacing: -0.03em; }
.id-card small { color: var(--text-3); font-size: 12px; }

/* ---------- Bilan de la semaine ---------- */

.review-grid { margin-top: 16px; }
.coach-text p { margin: 0 0 10px; color: var(--text); font-size: 14px; line-height: 1.6; }
.coach-text p:last-child { margin-bottom: 0; }
.coach-cta { margin-top: 14px !important; }
.sugs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sugs li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.sugs li > .ic { color: var(--signal); }
.sugs li > span { flex: 1; }
.review-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.review-table th { text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px; padding: 0 8px 10px 0; border-bottom: 1px solid var(--line); }
.review-table td { padding: 9px 8px 9px 0; border-bottom: 1px solid var(--line); }
.review-table td:first-child { display: flex; align-items: center; gap: 9px; }
.review-table tr:last-child td { border-bottom: 0; }
.review-table .num { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--text-2); }
.review-table .num.up { color: #8fbf8a; }
.review-table .num.down { color: var(--warn); }
.review-table th:not(:first-child), .review-table td.num { text-align: right; }
.panel + .panel { margin-top: 12px; }
.panel-head .link:disabled { opacity: 0.5; }

@media (max-width: 860px) {
  .year-canvas { height: 56vh; }
  .nav a { font-size: 10px; padding: 7px 0; }
  .review-table th:nth-child(4), .review-table td:nth-child(4) { display: none; }
}

/* ---------- Bienvenue (premier lancement) ---------- */

body.onboarding .sidebar { display: none; }
body.onboarding .view { margin-left: 0; max-width: none; padding: 32px 16px 60px; min-height: 100vh; display: grid; place-items: center; }
.welcome { width: 100%; max-width: 720px; }
.welcome-card { padding: 32px 32px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; display: grid; gap: 20px; box-shadow: 0 30px 80px -30px var(--shadow); }
.welcome-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.welcome-brand img { border-radius: 9px; }
.welcome h1 { font-size: 30px; }
.welcome .lead { margin-top: -10px; }
.ob-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.ob-chip { display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--field); color: var(--text-2); transition: border-color 0.15s, background 0.15s, color 0.15s; }
.ob-chip .ob-ic { grid-row: span 2; font-size: 20px; line-height: 1; }
.ob-chip b { font-weight: 500; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-chip small { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-chip:hover { border-color: var(--border-hover); }
.ob-chip.on { border-color: var(--signal); background: var(--signal-soft); }
.ob-chip.on b { color: var(--text); }
.welcome-actions { display: grid; gap: 10px; justify-items: start; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14px; }
.welcome-actions .muted { font-size: 12.5px; }
.ob-demo { margin: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.ob-demo .link { background: none; border: 0; padding: 0; cursor: pointer; font-size: 12.5px; color: var(--text-3); }
@media (max-width: 860px) {
  .welcome-card { padding: 22px 18px 18px; }
  .ob-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .welcome h1 { font-size: 24px; }
  .welcome-actions .btn { width: 100%; }
}
@media (max-width: 420px) { .ob-grid { grid-template-columns: 1fr; } }

/* ---------- Compte Momentum Cloud ---------- */
.cloud-form { display: grid; gap: 12px; }
details.more summary { cursor: pointer; color: var(--text-3); font-size: 12.5px; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: '▸ '; }
details.more[open] summary::before { content: '▾ '; }
details.more > :not(summary) { margin-top: 10px; }

/* ---------- Défi à deux ---------- */
.buddies { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.buddies li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line); font-size: 13px; }
.buddies li b { flex: 1; font-weight: 500; }
.buddies li small { color: var(--text-3); font-size: 12px; }
.buddy-today { font: 500 12.5px var(--mono); color: var(--text-2); }
.buddy-today.perfect { color: var(--signal); }
.invite-code { font: 600 16px var(--mono); letter-spacing: .18em; padding: 6px 12px; border-radius: var(--r-sm); background: var(--signal-soft); color: var(--text); }
.buddy-join { display: flex; gap: 8px; align-items: end; }
.buddy-join .btn { height: 36px; }
.buddy-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.buddy-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.buddy-card > div { flex: 1; min-width: 0; }
.buddy-card b { display: block; font-weight: 500; font-size: 13.5px; }
.buddy-card small { color: var(--text-3); font-size: 12px; }
.buddy-card.perfect { border-color: color-mix(in srgb, var(--signal) 45%, transparent); }
.buddy-streak { display: inline-flex; align-items: center; gap: 4px; font: 500 12px var(--mono); color: var(--text-2); }
.buddy-streak .ic { width: 13px; height: 13px; color: var(--signal); }

.ob-cat + .ob-cat { margin-top: 14px; }
.ob-cat .group-title { margin: 0 2px 6px; }
.welcome .field > .ob-cat:first-of-type { margin-top: 6px; }

/* ---------- Introduction animée à chaque ouverture ---------- */
.splash { position: fixed; inset: 0; z-index: 200; display: grid; grid-template-rows: 1fr auto; background: transparent; transition: opacity .5s var(--ease); }
body.introducing #bg3d { z-index: 150; }
body.introducing .bg-veil, body.introducing .sidebar, body.introducing .view { visibility: hidden; }
.splash.out { opacity: 0; pointer-events: none; }
.splash-stage { display: grid; place-items: center; padding: 24px; cursor: pointer; position: relative; }
.splash-stage::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 70% 55% at 50% 50%, var(--bg) 35%, transparent 100%); pointer-events: none; }
.splash-stage > * { position: relative; }
.splash-foot { display: flex; align-items: center; justify-content: space-between; padding: 0 20px max(20px, env(safe-area-inset-bottom)); }
.splash-dots { display: flex; gap: 6px; }
.splash-dots i { width: 18px; height: 3px; border-radius: 2px; background: var(--line-2); overflow: hidden; position: relative; }
.splash-dots i.done { background: var(--signal); }
.splash-dots i.on::after { content: ''; position: absolute; inset: 0; background: var(--signal); transform-origin: left; animation: dot-fill var(--step, 2s) linear forwards; }
@keyframes dot-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.step { display: grid; justify-items: center; gap: 10px; text-align: center; max-width: 520px; animation: step-in .6s var(--ease) both; }
.step.leave { animation: step-out .35s var(--ease) forwards; }
@keyframes step-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes step-out { to { opacity: 0; transform: translateY(-10px); } }
.step h2 { font-size: clamp(24px, 5vw, 34px); letter-spacing: -0.03em; line-height: 1.1; }
.step h2 em { font-style: normal; color: var(--signal); }
.step p { margin: 0; color: var(--text-2); font-size: 15px; max-width: 38ch; }
.step .mono-line { color: var(--text-3); font: 500 12.5px var(--mono); }
.step-ring { width: 84px; height: 84px; transform: rotate(-90deg); margin-bottom: 6px; }
.step-ring circle { fill: none; stroke-width: 5; }
.step-ring .track { stroke: var(--line-2); }
.step-ring .arc { stroke: var(--signal); stroke-linecap: round; stroke-dasharray: 138.2; stroke-dashoffset: 138.2; animation: splash-arc 1.3s var(--ease) .15s forwards; }
@keyframes splash-arc { to { stroke-dashoffset: 34.5; } }
.blocks { display: grid; grid-template-columns: repeat(14, 14px); gap: 4px; align-items: end; height: 70px; margin-bottom: 8px; }
.blocks i { display: block; width: 14px; border-radius: 3px; background: var(--signal); height: var(--h); transform-origin: bottom; animation: block-up .7s var(--ease) both; animation-delay: calc(var(--i) * 45ms); opacity: var(--o); }
@keyframes block-up { from { transform: scaleY(0); } }
.feat { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.feat span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; animation: step-in .5s var(--ease) both; animation-delay: calc(var(--i) * 140ms); }
.feat .ic { color: var(--signal); width: 14px; height: 14px; }
.signature { display: grid; gap: 4px; margin-top: 6px; }
.signature b { font-size: 17px; }
.signature small { color: var(--text-3); font-size: 12.5px; }
.step .avatar.big { width: 44px; height: 44px; font-size: 16px; border-color: var(--signal); color: var(--signal); margin-bottom: 4px; }
@media (prefers-reduced-motion: reduce) { .step, .feat span, .blocks i, .step-ring .arc, .splash-dots i.on::after { animation: none; } .step-ring .arc { stroke-dashoffset: 34.5; } }

/* ---------- Intro : une journée qui se valide ---------- */
.demo { display: grid; justify-items: center; gap: 18px; width: min(420px, 100%); text-align: center; }
.demo-title { position: relative; height: 2.4em; width: 100%; font-size: clamp(20px, 4.6vw, 26px); letter-spacing: -0.02em; line-height: 1.2; }
.demo-title span { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity .4s var(--ease), transform .4s var(--ease); }
.demo-t2 { opacity: 0; transform: translateY(8px); }
.demo-title.swap .demo-t1 { opacity: 0; transform: translateY(-8px); }
.demo-title.swap .demo-t2 { opacity: 1; transform: none; }
.demo-card { width: 100%; padding: 14px 14px 12px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 14px; display: grid; gap: 8px; text-align: left; animation: step-in .6s var(--ease) both; transition: border-color .3s; }
.demo-card.complete { border-color: var(--signal); animation: card-pop .5s var(--ease); }
@keyframes card-pop { 50% { transform: scale(1.02); } }
.demo-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.demo-streak { display: inline-flex; align-items: center; gap: 5px; font: 500 13px var(--mono); color: var(--text-2); }
.demo-streak .ic { width: 14px; height: 14px; color: var(--signal); }
.demo-streak em { font-style: normal; color: var(--text); display: inline-block; }
.demo-streak em.bump { animation: bump .5s var(--ease); color: var(--signal); }
@keyframes bump { 40% { transform: translateY(-6px) scale(1.25); } }
.demo-seg { margin: 2px 0 4px; }
.demo-seg i.on { background: var(--signal); }
.demo-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; background: var(--field); border: 1px solid var(--line); font-size: 14px; opacity: 0; transform: translateX(-8px); animation: row-in .45s var(--ease) forwards; animation-delay: calc(var(--d) - .6s); }
@keyframes row-in { to { opacity: 1; transform: none; } }
.demo-row span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .3s; }
.demo-row .check { width: 30px; height: 30px; pointer-events: none; }
.demo-row.on .check { background: var(--signal); border-color: var(--signal); animation: stamp .35s var(--ease); }
.demo-row.on .check > .ic { opacity: 1; color: var(--signal-ink); }
.demo-row.on .check .seal { animation: seal .6s var(--ease) forwards; }
.demo-row.on span { color: var(--text-2); }
.demo-done { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 2px; padding: 9px; border-radius: 9px; background: var(--signal); color: var(--signal-ink); font-weight: 600; font-size: 13.5px; opacity: 0; transform: scale(.9); transition: opacity .35s var(--ease), transform .35s var(--ease); position: relative; }
.demo-done .ic { width: 15px; height: 15px; }
.demo-card.complete .demo-done { opacity: 1; transform: none; }
.demo-card.complete .demo-done::after { content: ''; position: absolute; inset: -6px; border-radius: 12px; border: 2px solid var(--signal); animation: burst .9s var(--ease) forwards; }
@keyframes burst { to { transform: scale(1.25); opacity: 0; } }
.demo-by { margin: 0; display: grid; gap: 2px; opacity: 0; transform: translateY(8px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.demo-by small { color: var(--text-3); font-size: 12.5px; }
.demo-by b { font-size: 17px; }
.demo.signed .demo-by { opacity: 1; transform: none; }
.splash.fast .demo-row { opacity: 1; transform: none; animation: none; }
.splash.fast .demo-by { opacity: 1; transform: none; }

/* ---------- Intro : apparition du logo (battement) ---------- */
.demo-logo { display: flex; align-items: center; gap: 16px; font-weight: 700; font-size: clamp(30px, 8vw, 40px); letter-spacing: -0.03em; color: var(--text); transition: opacity .35s var(--ease), transform .35s var(--ease); }
.demo-logo.leave { opacity: 0; transform: scale(.92) translateY(-10px); }
.demo-logo svg { width: clamp(64px, 16vw, 84px); height: auto; overflow: visible; will-change: transform; animation: logo-beat .5s ease 1.25s; }
.demo-logo .ring { stroke: var(--line-2); opacity: 0; animation: logo-fade .6s ease forwards; }
.demo-logo .arc { stroke: var(--signal); stroke-dasharray: 81; stroke-dashoffset: 81; animation: logo-draw .9s var(--ease) .2s forwards; }
.demo-logo .glow { fill: var(--signal); opacity: 0; animation: logo-glow .6s ease 1.25s; }
.demo-logo .w span { display: inline-block; opacity: 0; transform: translateY(10px); animation: logo-letter .4s var(--ease) forwards; animation-delay: calc(1.3s + var(--i) * .05s); }
@keyframes logo-draw { to { stroke-dashoffset: 0; } }
@keyframes logo-fade { to { opacity: 1; } }
@keyframes logo-beat { 30% { transform: scale(1.12); } }
@keyframes logo-glow { 40% { opacity: .35; } }
@keyframes logo-letter { to { opacity: 1; transform: none; } }

/* ---------- Routines ---------- */
.routine-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.routine-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.routine-card .rc-main { flex: 1; min-width: 0; }
.routine-card b { display: block; font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.routine-card small { color: var(--text-3); font-size: 12px; }
.routine-card .segbar { margin-top: 8px; }
.routine-card.is-done { border-color: color-mix(in srgb, var(--signal) 45%, transparent); }
.rc-done { display: inline-flex; align-items: center; gap: 5px; color: var(--signal); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.rc-done .ic { width: 14px; height: 14px; }
.routine-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; flex-wrap: wrap; }
.routine-row .rr-title { flex: 1; min-width: 160px; }
.routine-row h3 { font-weight: 500; }
.routine-row p { margin: 2px 0 0; color: var(--text-3); font-size: 12.5px; }
.rr-habits { display: flex; flex-wrap: wrap; gap: 4px; max-width: 520px; }
.rr-habits span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); padding: 2px 9px; border: 1px solid var(--line); border-radius: 999px; }
.pick-list { display: grid; gap: 4px; max-height: 280px; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.pick.on { border-color: var(--text-3); background: var(--raised); }
.pick input { accent-color: var(--signal); margin: 0; }
.pick span { flex: 1; font-size: 13.5px; }
.pick small { color: var(--text-3); font-size: 12px; }
.pick .pick-n { font: 500 11px var(--mono); color: var(--signal); min-width: 12px; text-align: right; }
.rp-body { text-align: center; justify-items: center; }
.rp-body .segbar { width: 100%; margin: 0; }
.segbar i.cur { outline: 1px solid var(--text-3); outline-offset: 2px; }
.rp-step { display: grid; justify-items: center; gap: 6px; padding: 16px 0 4px; }
.rp-step h3 { font-size: 21px; letter-spacing: -0.01em; }
.rp-step .tick { width: 12px; height: 12px; }
.rp-step .muted .ic { width: 12px; height: 12px; vertical-align: -2px; }
.timer-ring.sm { width: 140px; height: 140px; }
.rp-actions { margin-top: 6px; }
.rp-end { display: grid; justify-items: center; gap: 10px; padding: 12px 0; width: 100%; }
.rp-end > .ic { width: 36px; height: 36px; color: var(--signal); }
.rp-end .segbar { width: 100%; }

/* ---------- Détail d'une habitude ---------- */
.back { margin-bottom: 10px; }
.page-head h1 .tick { width: 12px; height: 12px; margin-right: 10px; vertical-align: 3px; }
.hr-link { color: inherit; text-decoration: none; }
.hr-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.detail-grid { align-items: start; }
.cal-nav { display: flex; gap: 2px; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px; }
.cal-head span { text-align: center; font: 500 10px var(--mono); color: var(--text-3); text-transform: uppercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; border-radius: 7px; border: 1px solid var(--line-2); background: transparent; transition: background 0.2s, border-color 0.2s; }
.cal-day em { font: 500 12.5px var(--mono); font-style: normal; color: var(--text-2); }
.cal-day small { font: 500 9.5px var(--mono); color: var(--text-3); }
.cal-day:hover { border-color: var(--text-3); }
.cal-day.done { background: var(--signal); border-color: var(--signal); }
.cal-day.done em, .cal-day.done small { color: var(--signal-ink); }
.cal-day.mini { background: var(--signal-soft); border-color: var(--signal); }
.cal-day.mini em { color: var(--text); }
.cal-day.part { background: var(--signal-soft); border-color: rgba(255, 91, 58, 0.45); }
.cal-day.miss { border-style: dashed; border-color: #4a4f57; }
.cal-day.off, .cal-day.before { border-color: var(--line); color: var(--text-3); }
.cal-day.future { opacity: 0.18; pointer-events: none; }
.cal-day.skip em { color: var(--text-3); text-decoration: line-through; }
.cal-day.is-today { outline: 1px solid var(--text-3); outline-offset: 2px; }
.trend { width: 100%; height: auto; display: block; }
.trend rect { fill: var(--line-2); }
.trend rect.hi { fill: var(--signal); }
.trend rect.mid { fill: color-mix(in srgb, var(--signal) 55%, var(--line-2)); }
.trend rect.lo { fill: color-mix(in srgb, var(--signal) 25%, var(--line-2)); }
.trend text { fill: var(--text-3); font: 500 9px var(--mono); }
.detail-notes { margin-top: 12px; }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.note-list li { display: flex; align-items: flex-start; gap: 10px; }
.note-list .mood { font-size: 18px; width: 24px; text-align: center; line-height: 1.2; }
.note-list li > div { flex: 1; min-width: 0; }
.note-list b { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.note-list p { margin: 2px 0 0; font-size: 13.5px; }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; } .routine-row .hr-actions { width: 100%; justify-content: flex-end; } }

/* ---------- Code de secours ---------- */
.recovery-code { font: 500 20px var(--mono); letter-spacing: 0.08em; text-align: center; padding: 16px 12px; border: 1px dashed var(--signal); border-radius: var(--r); background: var(--signal-soft); color: var(--text); user-select: all; word-break: break-all; }
.check-line { display: flex; align-items: center; gap: 10px; font-size: 13.5px; cursor: pointer; }
.check-line input { accent-color: var(--signal); margin: 0; }
.link-btn.quiet { color: var(--text-2); font-weight: 500; }
.link-btn.quiet:hover { color: var(--text); }
input.mono { font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- Droite à gauche (arabe) ---------- */
[dir="rtl"] body, [dir="rtl"] .btn, [dir="rtl"] input, [dir="rtl"] select, [dir="rtl"] textarea, [dir="rtl"] button { font-family: system-ui, -apple-system, 'Segoe UI', 'Noto Sans Arabic', 'Noto Naskh Arabic', Tahoma, sans-serif; }
[dir="rtl"] .sidebar { left: auto; right: 0; border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .view { margin-left: 0; margin-right: 224px; }
[dir="rtl"] .metric + .metric { border-left: 0; border-right: 1px solid var(--line); }
[dir="rtl"] .btn kbd { margin-left: 0; margin-right: 2px; }
[dir="rtl"] .hi-title p .ic, [dir="rtl"] .hr-title p .ic, [dir="rtl"] .hr-notes .ic, [dir="rtl"] .field .label .ic, [dir="rtl"] .field > span .ic, [dir="rtl"] .modal-head h2 .ic, [dir="rtl"] .avg-key, [dir="rtl"] .page-head h1 .tick { margin-right: 0; margin-left: 4px; }
[dir="rtl"] .modal-head h2 .ic { margin-left: 8px; }
[dir="rtl"] .page-head h1 .tick { margin-left: 10px; }
[dir="rtl"] .counter small { margin-left: 0; margin-right: 4px; }
[dir="rtl"] .later > span { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .legend b { margin-left: 0; margin-right: auto; }
[dir="rtl"] .rank-row b, [dir="rtl"] .prio-bar b, [dir="rtl"] .pick .pick-n, [dir="rtl"] .pagenum { text-align: left; }
[dir="rtl"] .shortcuts li span { margin-left: 0; margin-right: 8px; }
[dir="rtl"] .hr-title h3 .tag { margin-left: 0; margin-right: 8px; }
[dir="rtl"] .track::after { left: auto; right: 3px; }
[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-14px); }
[dir="rtl"] .pal-foot kbd { margin-right: 0; margin-left: 3px; }
[dir="rtl"] .toasts { right: auto; left: 20px; justify-items: start; }
[dir="rtl"] .year-controls { left: auto; right: 12px; }
[dir="rtl"] .review-table th { text-align: right; padding: 0 0 10px 8px; }
[dir="rtl"] .review-table th:not(:first-child), [dir="rtl"] .review-table td.num { text-align: left; }
[dir="rtl"] .ob-chip { text-align: right; }
[dir="rtl"] .link .ic, [dir="rtl"] .back .ic, [dir="rtl"] .cal-nav .ic, [dir="rtl"] .chain x-shape { transform: scaleX(-1); }
[dir="rtl"] .lead time, [dir="rtl"] .metric-value, [dir="rtl"] .recovery-code, [dir="rtl"] input.mono, [dir="rtl"] .timer-clock { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .cal-day em, [dir="rtl"] .cell em, [dir="rtl"] .hr-stats b { direction: ltr; }
@media (max-width: 860px) {
  [dir="rtl"] .view { margin-right: 0; }
  [dir="rtl"] .sidebar { left: 0; right: 0; border-left: 0; }
  [dir="rtl"] .metric + .metric { border-right: 0; }
  [dir="rtl"] .band .metric:nth-child(3) { border-left: 0; border-right: 1px solid var(--line); }
  [dir="rtl"] .habit-item .dots, [dir="rtl"] .habit-item .hi-tools, [dir="rtl"] .habit-item .counter { margin-left: 0; }
  [dir="rtl"] .habit-item .hi-tools { margin-right: auto; }
  [dir="rtl"] .toasts { left: 12px; right: 12px; }
}

/* ---------- Appareils connectés ---------- */
.devices { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.devices li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.devices li.current { border-color: var(--text-3); }
.devices .dev-ic .ic { width: 16px; height: 16px; color: var(--text-3); }
.devices li > div { flex: 1; min-width: 0; }
.devices b { display: block; font-weight: 500; font-size: 13px; }
.devices small { color: var(--text-3); font-size: 12px; }

/* ---------- Chiffrement de bout en bout ---------- */
.e2e-line { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; color: var(--text-2); }
.e2e-line .ic { width: 15px; height: 15px; color: var(--warn); }
.e2e-line.on .ic { color: var(--signal); }

/* ---------- Double authentification ---------- */
.twofa-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--r); }
.twofa-row > div { flex: 1; min-width: 0; }
.twofa-row b { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13.5px; }
.twofa-row b .ic { width: 14px; height: 14px; color: var(--text-3); }
.twofa-row small { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; }
.qr { display: grid; place-items: center; padding: 10px; background: #fff; border-radius: 10px; }
.qr svg { width: 180px; height: 180px; display: block; }

/* ---------- Programmes ---------- */
.program-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.program { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.program.locked { border-style: dashed; }
.pg-head { display: flex; align-items: center; justify-content: space-between; }
.pg-icon { font-size: 26px; line-height: 1; }
.pg-price { font: 500 12.5px var(--mono); padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2); }
.pg-price.free { color: var(--signal); border-color: color-mix(in srgb, var(--signal) 45%, transparent); }
.program h3 { font-size: 15.5px; }
.program p { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.45; }
.program .pg-meta { color: var(--text-3); font-size: 12px; }
.pg-foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pg-since { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); font-size: 12px; }
.pg-since .ic { width: 13px; height: 13px; color: var(--signal); }
.chips a.chip { text-decoration: none; }
.chips a.chip .ic { width: 12px; height: 12px; }

/* ---------- Momentum Pro ---------- */
.tag.pro { color: var(--signal); border-color: rgba(255, 91, 58, 0.4); background: var(--signal-soft); }
.tag.ok { color: #7ed49a; border-color: rgba(126, 212, 154, 0.35); }
.pro-feature { display: flex; align-items: center; gap: 8px; background: var(--signal-soft); border-radius: var(--r-sm); padding: 10px 12px; color: var(--text); }
.pro-list { list-style: none; padding: 0; margin: 10px 0 14px; display: grid; gap: 6px; color: var(--text-2); }
.pro-list li { display: flex; align-items: center; gap: 8px; } .pro-list .ic { color: var(--signal); }
.btn.wide { width: 100%; justify-content: center; }
.center { text-align: center; } .small { font-size: 12.5px; }
.pro-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 6px; }
.pro-plan { display: grid; gap: 2px; text-align: center; padding: 12px 8px; border: 1px solid var(--line-2); border-radius: var(--r); text-decoration: none; color: var(--text-2); }
.pro-plan b { font-size: 20px; color: var(--text); } .pro-plan small { color: var(--signal); font-size: 11px; }
.pro-plan.best { border-color: var(--signal); background: var(--signal-soft); }
.pro-plan:hover { border-color: var(--text-3); }
.ref-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.ref-code { font-family: var(--mono, ui-monospace, monospace); font-size: 18px; letter-spacing: 0.08em; background: var(--field); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 6px 12px; }
.ref-progress { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12.5px; }
.ref-progress .bar { flex: 1; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--signal); border-radius: 3px; transition: width 0.4s var(--ease); }
.btn .ic.lock { width: 12px; height: 12px; margin-left: 4px; opacity: 0.7; }

/* ---------- Défis avec mise ---------- */
.stake-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.stake-card { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--c, var(--signal)); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 8px; }
.stake-card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stake-card.won { border-left-color: #7ed49a; } .stake-card.lost { border-left-color: var(--danger); }
.stake-card .muted { margin: 0; }
.radios { display: flex; flex-wrap: wrap; gap: 8px; }
.radios label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; font-size: 13.5px; }
.radios label:has(input:checked) { border-color: var(--signal); background: var(--signal-soft); }
.radios input { position: absolute; opacity: 0; width: 0; height: 0; }

/* ---------- Surcharge, dictée, mode une main ---------- */
.banner.overload { align-items: flex-start; } .banner.overload div { display: grid; gap: 2px; flex: 1; } .banner.overload span { color: var(--text-2); font-size: 13px; }
.btn.mic.on { border-color: var(--signal); color: var(--signal); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--signal-soft); } }
.one-hand .habit-item { transition: transform 0.18s var(--ease), background 0.18s; touch-action: pan-y; }
.one-hand .habit-item.swipe-right { background: rgba(126, 212, 154, 0.12); }
.one-hand .habit-item.swipe-left { background: rgba(255, 123, 110, 0.1); }
@media (max-width: 860px) {
  .one-hand .page-head { flex-direction: column-reverse; align-items: stretch; }
  .one-hand .page-head .head-actions { position: fixed; left: 12px; right: 12px; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 5; display: flex; gap: 8px; }
  .one-hand .page-head .head-actions .btn { flex: 1; justify-content: center; min-height: 46px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }
  .one-hand .view { padding-bottom: 160px; }
  .one-hand .habit-item .check { width: 48px; height: 48px; }
}

/* ---------- Carte à gratter ---------- */
.banner.scratch-banner { width: 100%; text-align: left; cursor: pointer; border-color: rgba(138, 92, 246, 0.5); background: linear-gradient(135deg, rgba(123, 108, 255, 0.16), rgba(255, 91, 58, 0.12)); align-items: center; font: inherit; color: inherit; }
.banner.scratch-banner .ticket { font-size: 26px; } .banner.scratch-banner > span:nth-child(2) { flex: 1; display: grid; gap: 2px; } .banner.scratch-banner small { color: var(--text-2); }
.scratch-card { position: relative; aspect-ratio: 5 / 3; border-radius: 16px; overflow: hidden; background: linear-gradient(135deg, #7b6cff, #ff7a59); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45); touch-action: none; user-select: none; }
.scratch-prize { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: #fff; gap: 4px; }
.scratch-prize b { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; } .scratch-prize span { opacity: 0.9; font-size: 14px; }
.scratch-card { transition: transform 0.15s ease-out; will-change: transform; }
.scratch-foil { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 0.6s; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34' viewBox='0 0 34 34'%3E%3Ccircle cx='17' cy='17' r='14' fill='%23f0c75e' stroke='%23b8860b' stroke-width='3'/%3E%3Ctext x='17' y='22' font-size='14' font-weight='700' text-anchor='middle' fill='%23b8860b' font-family='Arial'%3E€%3C/text%3E%3C/svg%3E") 17 17, grab; }
.scratch-foil.gone { opacity: 0; pointer-events: none; }
.scratch-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scratch-prize.pop b { animation: prizePop 0.7s cubic-bezier(0.22, 1.4, 0.36, 1); }
@keyframes prizePop { 0% { transform: scale(0.4); opacity: 0; } 100% { transform: none; opacity: 1; } }
.scratch-progress { height: 4px; border-radius: 2px; background: var(--line); margin-top: 12px; overflow: hidden; }
.scratch-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7b6cff, #ff7a59); transition: width 0.25s; }
.scratch-result { text-align: center; color: var(--text); margin: 14px 0 0; font-weight: 500; }

/* ---------- Réglages : Avancé et À propos ---------- */
.panel.advanced { padding: 0; align-self: start; }
.panel.advanced > details > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 10px; row-gap: 4px; padding: 18px; }
.panel.advanced > details > summary::-webkit-details-marker { display: none; }
.panel.advanced > details > summary .ic { color: var(--text-3); } .panel.advanced > details > summary span { font-weight: 600; } .panel.advanced > details > summary small { color: var(--text-3); grid-column: 2 / -1; }
.panel.advanced > details > summary::after { content: '▾'; grid-column: 3; grid-row: 1; color: var(--text-3); transition: transform 0.2s; } .panel.advanced > details[open] > summary::after { transform: rotate(180deg); }
.adv-section { padding: 0 18px 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.panel.about { grid-column: 1 / -1; display: grid; gap: 14px; }
.about-brand { display: flex; align-items: center; gap: 12px; } .about-brand b { font-size: 18px; display: block; } .about-brand small { color: var(--text-3); }
.about-logo { width: 40px; height: 40px; color: var(--signal); } .about-logo svg { width: 40px; height: 40px; }
.about-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.about-facts li { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; } .about-facts .ic { color: var(--signal); flex: none; }
.about-maker { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); flex-wrap: wrap; }
.about-maker .avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); background: #111; padding: 0; }
.about-maker > div { flex: 1; min-width: 140px; } .about-maker b { display: block; text-transform: uppercase; letter-spacing: .09em; font-size: 14px; } .about-maker small { color: var(--text-3); }
.about-actions { display: flex; flex-wrap: wrap; gap: 6px; } .about-actions .btn.ghost { background: transparent; }
.about-links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; } .about-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; } .about-links a:hover { color: var(--text); } .about-links .ic { width: 14px; height: 14px; }

/* ---------- Vague 2 : coach proactif, règles, groupes, sons ---------- */
.coach-card { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.coach-card .section-head { margin-bottom: 8px; } .coach-card .section-head h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; } .coach-card .section-head .ic { color: var(--signal); }
.coach-card.locked { border-style: dashed; }
.nudges { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.nudges li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); } .nudges li > .ic { color: var(--signal); flex: none; } .nudges li span { flex: 1; min-width: 0; } .nudges li .btn { flex: none; }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rules li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-2); padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.rules li > span { flex: 1; min-width: 0; } .rules li.off > span { color: var(--text-3); text-decoration: line-through; }
.rule-body .field[hidden] { display: none; } .rule-preview { font-size: 13px; }
.grp { margin-top: 12px; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); display: grid; gap: 10px; }
.grp .row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lb li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); font-size: 13.5px; }
.lb li.me { background: var(--surface); border: 1px solid var(--line-2); }
.lb .b-rank { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 600 11px var(--mono); background: var(--surface); border: 1px solid var(--line-2); color: var(--text-2); flex: none; }
.lb li:first-child .b-rank { background: var(--signal); color: #1a0803; border-color: transparent; }
.lb .b-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .lb .b-who small { color: var(--text-3); }
.lb .b-score { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; } .lb .b-score b { font-variant-numeric: tabular-nums; } .lb .b-score small { color: var(--text-3); font-size: 11.5px; }
.code-input { text-transform: uppercase; letter-spacing: .2em; font-family: var(--mono); }
.timer-sound select { width: 100%; }

button.pro-plan { font: inherit; color: var(--text-2); cursor: pointer; text-align: center; background: transparent; }
