/* ==========================================================================
   Auphine — styles (mobile d'abord)
   ========================================================================== */

:root {
  --bg: #f6f5fb;
  --surface: #ffffff;
  --surface-2: #f1eff9;
  --text: #1d1b2c;
  --muted: #6e6a85;
  --border: #e6e3f1;

  --primary: #5b4bdb;       /* moi */
  --primary-soft: #ebe8fd;
  --accent: #f0643f;        /* mon binôme */
  --accent-soft: #ffece6;
  --success: #17a067;
  --success-soft: #dcf5ea;
  --warning: #d48a1c;
  --warning-soft: #fdf1dc;
  --danger: #dc3d43;
  --danger-soft: #fde7e8;
  --upcoming: #d9d6e6;

  --radius: 20px;
  --shadow-sm: 0 1px 2px rgba(25, 20, 70, .05), 0 4px 14px rgba(25, 20, 70, .05);
  --shadow: 0 2px 6px rgba(25, 20, 70, .06), 0 12px 32px rgba(25, 20, 70, .10);
  --nav-h: 66px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #100f18;
    --surface: #1a1926;
    --surface-2: #252336;
    --text: #edecf6;
    --muted: #9c98b6;
    --border: #2f2c43;
    --primary: #8b7dff;
    --primary-soft: #2b2652;
    --accent: #ff8a6b;
    --accent-soft: #3d2620;
    --success: #3fcf92;
    --success-soft: #173b2c;
    --warning: #f0b450;
    --warning-soft: #3b2f17;
    --danger: #ff6b70;
    --danger-soft: #3f1d20;
    --upcoming: #3a3750;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #100f18;
  --surface: #1a1926;
  --surface-2: #252336;
  --text: #edecf6;
  --muted: #9c98b6;
  --border: #2f2c43;
  --primary: #8b7dff;
  --primary-soft: #2b2652;
  --accent: #ff8a6b;
  --accent-soft: #3d2620;
  --success: #3fcf92;
  --success-soft: #173b2c;
  --warning: #f0b450;
  --warning-soft: #3b2f17;
  --danger: #ff6b70;
  --danger-soft: #3f1d20;
  --upcoming: #3a3750;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* --- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
h3 { font-size: 16px; font-weight: 700; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; }
ul, ol { margin: 0; padding: 0; }
em { font-style: normal; font-weight: 400; color: var(--muted); }

.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.sm { width: 16px; height: 16px; }
.i.xs { width: 13px; height: 13px; stroke-width: 2.4; }

.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap, .gap { gap: 12px; }
.self-end { align-self: flex-end; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.mt { margin-top: 16px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.boot { min-height: 50vh; display: grid; place-items: center; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--primary-soft); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Structure ------------------------------------------------------------ */
.main {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 18px) 16px calc(var(--nav-h) + var(--safe-bottom) + 28px);
  outline: none;
}

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding: 0 4px var(--safe-bottom);
  display: flex;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--border);
}
.nav .brand { display: none; }
.nav a {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  transition: color .15s;
}
.nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a .i { width: 24px; height: 24px; transition: transform .15s; }
.nav a.active { color: var(--primary); }
.nav a.active .i { transform: translateY(-1px) scale(1.08); }

.desktop-only { display: none !important; }

@media (min-width: 900px) {
  .shell { padding-left: 248px; }
  .main { max-width: 780px; padding: 40px 40px 64px; }
  .nav {
    top: 0; right: auto; width: 248px; height: auto;
    flex-direction: column; gap: 4px; padding: 24px 14px;
    border-top: 0; border-right: 1px solid var(--border);
    background: var(--surface);
  }
  .nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; padding: 0 10px 22px; }
  .nav a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; font-size: 15px; }
  .nav a:hover { background: var(--surface-2); color: var(--text); }
  .nav a.active { background: var(--primary-soft); color: var(--primary); }
  .nav a.active .i { transform: none; }
  .mobile-only { display: none !important; }
  .desktop-only { display: inline-flex !important; }
  h1 { font-size: 30px; }
}

/* --- En-têtes ------------------------------------------------------------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 4px 0 18px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-head h2 { display: flex; align-items: center; gap: 7px; }
.section-head h2 .i { color: var(--muted); }
.link { color: var(--primary); font-weight: 650; font-size: 14px; margin-top: 8px; }

/* --- Cartes & boutons ------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: 14px;
  font-weight: 650;
  white-space: nowrap;
  transition: transform .1s, filter .15s, opacity .15s;
  user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn-sm .i { width: 18px; height: 18px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-ghost { background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn:disabled { opacity: .55; }
.btn.loading { opacity: .65; cursor: progress; }

.icon-btn {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px; color: var(--muted);
  transition: background .15s, color .15s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .3; }

.fab {
  position: fixed; z-index: 15;
  right: 16px; bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  display: flex; align-items: center; gap: 6px;
  height: 54px; padding: 0 20px 0 16px;
  border-radius: 18px;
  background: var(--accent); color: #fff; font-weight: 700;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 45%, transparent);
}
.fab:active { transform: scale(.97); }

/* --- Formulaires ------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > span, .field > legend, .field .label { font-size: 13.5px; font-weight: 650; color: var(--muted); padding: 0; }
.field > legend { margin-bottom: 6px; }
input:not([type=radio]):not([type=checkbox]), select, textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px; /* évite le zoom automatique sur iPhone */
  border-radius: 13px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.4; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}
input[type="date"] { min-height: 48px; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }

/* Contrôle segmenté (boutons ou radios) */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); margin-bottom: 4px; }
.seg > button { flex-direction: row !important; gap: 6px; }
.seg > button, .seg label span {
  flex: 1; min-height: 40px; padding: 4px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 10px;
  font-size: 14px; font-weight: 650; color: var(--muted); text-align: center;
  transition: background .15s, color .15s;
}
.seg label { flex: 1; display: flex; position: relative; cursor: pointer; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label span small { font-size: 11.5px; font-weight: 600; opacity: .8; }
.seg > button.on, .seg label input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg label input:focus-visible + span { outline: 2.5px solid var(--primary); }
.page-head + .seg, .seg + .weeknav { margin-top: 0; }

/* Jours de répétition */
.weekdays { display: flex; gap: 6px; margin-bottom: 10px; }
.wd { flex: 1; position: relative; cursor: pointer; }
.wd input { position: absolute; opacity: 0; }
.wd span {
  display: grid; place-items: center; height: 42px; border-radius: 12px;
  background: var(--surface-2); font-weight: 700; color: var(--muted);
  border: 1.5px solid transparent; transition: all .15s;
}
.wd input:checked + span { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.wd input:focus-visible + span { outline: 2.5px solid var(--primary); }

/* Sélecteurs d'icône / couleur */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.picker label { position: relative; cursor: pointer; }
.picker input { position: absolute; opacity: 0; }
.picker span {
  display: grid; place-items: center; height: 44px; border-radius: 12px;
  background: var(--surface-2); color: var(--muted); border: 2px solid transparent;
}
.picker input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.picker input:focus-visible + span { outline: 2.5px solid var(--primary); }
.picker.colors span { height: 36px; border-radius: 50%; }
.picker.colors input:checked + span { border-color: var(--surface); box-shadow: 0 0 0 3px var(--text); }

.chip .i { color: var(--accent); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
  background: var(--surface-2); font-size: 13.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--border);
}
.chip:hover { border-color: var(--accent); }
.suggest { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 6px; scrollbar-width: none; }
.suggest::-webkit-scrollbar { display: none; }

/* --- Anneau de progression -------------------------------------------------- */
.ring { position: relative; flex: none; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--surface-2); }
.ring-fill { fill: none; stroke-linecap: round; transition: stroke-dashoffset .6s cubic-bezier(.2, .8, .2, 1); }
.ring-label { position: relative; font-weight: 800; font-size: 17px; letter-spacing: -.02em; }

/* --- Bandeau des jours ------------------------------------------------------ */
.daystrip { display: flex; align-items: center; gap: 2px; margin: 0 -8px; }
.days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 7px; border-radius: 14px;
  transition: background .15s, color .15s;
}
.day:hover { background: var(--surface-2); }
.dname { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: capitalize; }
.dnum { font-size: 17px; font-weight: 750; }
.day.is-today .dnum { color: var(--primary); }
.day.sel { background: var(--primary); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent); }
.day.sel .dname, .day.sel .dnum { color: #fff; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.dot.some { background: var(--primary); }
.dot.full { background: var(--success); }
.dot.low { background: var(--danger); }
.day.sel .dot.some, .day.sel .dot.low { background: #fff; }
.daystrip.accent .day.is-today .dnum { color: var(--accent); }
.daystrip.accent .day.sel { background: var(--accent); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.daystrip.accent .day.sel .dnum { color: #fff; }
.daystrip.accent .day:not(.sel) .dot.some { background: var(--accent); }

/* --- Objectifs --------------------------------------------------------------- */
.goals { display: flex; flex-direction: column; gap: 10px; }
.goal {
  display: flex; align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, background .2s;
}
.goal-check { flex: none; width: 58px; display: grid; place-items: center; }
.goal-check .i {
  width: 32px; height: 32px; padding: 6px; border-radius: 50%;
  border: 2px solid var(--border); color: transparent; stroke-width: 3;
  transition: background .2s, border-color .2s, color .2s;
}
@media (hover: hover) {
  .st-todo button.goal-check:hover .i, .st-missed button.goal-check:hover .i {
    border-color: var(--success); color: color-mix(in srgb, var(--success) 45%, transparent);
  }
}
.st-done { background: color-mix(in srgb, var(--success-soft) 45%, var(--surface)); }
.st-done .goal-check .i { background: var(--success); border-color: var(--success); color: #fff; }
.st-partial .goal-check .i { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.st-missed .goal-check .i { border-color: color-mix(in srgb, var(--danger) 60%, transparent); border-style: dashed; }
.goal.flash .goal-check .i { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(.5); } 100% { transform: scale(1); } }

.goal-main { flex: 1; min-width: 0; text-align: left; padding: 14px 14px 14px 0; display: flex; flex-direction: column; gap: 7px; }
.goal-title { font-weight: 650; overflow-wrap: anywhere; }
.st-done .goal-title { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.goal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 12.5px; color: var(--muted); }
.diff { display: inline-flex; gap: 3px; }
.diff i { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.diff i.on { background: var(--muted); }
.meta-ico { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-weight: 650; }
.meta-ico.reacted { color: var(--accent); }
.goal-progress { display: flex; align-items: center; gap: 10px; }
.goal-progress .xpbar { flex: 1; margin: 0; height: 6px; }
.amount { font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.goal-check.is-ring { display: grid; place-items: center; }
.goal-check.is-ring .ring-track { stroke: var(--border); }
.t-self { --c: var(--primary); }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 650;
  background: color-mix(in srgb, var(--c, var(--muted)) 14%, transparent);
  color: color-mix(in srgb, var(--c, var(--muted)) 75%, var(--text));
}
.badge { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.b-done { background: var(--success-soft); color: var(--success); }
.b-partial { background: var(--warning-soft); color: var(--warning); }
.b-missed { background: var(--danger-soft); color: var(--danger); }
.b-todo { background: var(--surface-2); color: var(--muted); }
.pill { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700; vertical-align: 1px; }

/* Détail d'un objectif */
.detail { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.details { white-space: pre-line; }
.bubble {
  background: var(--accent-soft); border-radius: 16px 16px 16px 4px; padding: 12px 14px;
  font-size: 14.5px;
}
.bubble p { margin-top: 4px; white-space: pre-line; }
.reactions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 480px) { .reactions { grid-template-columns: repeat(6, 1fr); } }
.react {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 62px; border-radius: 14px; color: var(--muted);
  background: var(--surface-2); border: 2px solid transparent; transition: transform .12s, border-color .15s, color .15s;
  font-size: 11.5px; font-weight: 700;
}
.react .i { width: 24px; height: 24px; }
.react:active { transform: scale(.94); }
.react.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.react.on .i { fill: color-mix(in srgb, var(--accent) 25%, transparent); }
.received {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 18px;
  border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-size: 14.5px;
}
.received span { color: var(--text); }

/* Blocs de la fiche objectif */
.block { margin-bottom: 20px; }
.block .label, .field .label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 650; color: var(--muted); margin-bottom: 8px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper input { text-align: center; font-size: 20px !important; font-weight: 800; max-width: 110px; }
.step-btn {
  width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text);
}
.step-btn:active { transform: scale(.95); }
.step-unit { flex: 1; font-weight: 700; color: var(--muted); }
.proof {
  position: relative; min-height: 140px; margin-bottom: 10px; border-radius: 16px; overflow: hidden;
  background: var(--surface-2); display: grid; place-items: center;
}
.proof img { display: block; width: 100%; max-height: 420px; object-fit: contain; opacity: 0; transition: opacity .2s; }
.proof.ready img { opacity: 1; }
.proof.ready .spinner { display: none; }
.proof .spinner { position: absolute; }
.file-btn { cursor: pointer; }
.file-btn.loading { opacity: .6; pointer-events: none; }

/* Discussion */
.msgs { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; margin-bottom: 10px; padding: 2px; }
.msg { max-width: 82%; align-self: flex-start; }
.msg p {
  margin: 0; padding: 9px 13px; border-radius: 16px 16px 16px 4px;
  background: var(--surface-2); white-space: pre-line; overflow-wrap: anywhere; font-size: 14.5px;
}
.msg.mine { align-self: flex-end; text-align: right; }
.msg.mine p { background: var(--primary); color: #fff; border-radius: 16px 16px 4px 16px; text-align: left; }
.msg-meta { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; padding: 0 4px; }
.composer { display: flex; gap: 8px; align-items: center; }
.composer input { border-radius: 999px !important; }
.send {
  width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: #fff;
}
.send.loading { opacity: .6; }

/* --- Bandeaux, états vides --------------------------------------------------- */
.banner { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-size: 14.5px; }
.banner > .i { margin-left: auto; color: var(--muted); }
.banner-icon, .celebrate-icon {
  width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.celebrate-icon { background: var(--success); color: #fff; }
.empty { text-align: center; padding: 34px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-icon {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin-bottom: 8px;
  background: var(--primary-soft); color: var(--primary);
}
.empty-icon .i { width: 30px; height: 30px; }
.empty-title { font-weight: 750; font-size: 17px; }
.empty .btn { margin-top: 12px; }
.celebrate { display: flex; align-items: center; gap: 12px; margin-top: 18px; background: var(--success-soft); border-color: transparent; }

/* --- Liaison binôme ---------------------------------------------------------- */
.pair { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 22px 18px; }
.pair-icon {
  width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.pair-icon .i { width: 30px; height: 30px; }
.code-box {
  display: flex; align-items: center; gap: 4px; margin: 8px 0 4px;
  padding: 6px 6px 6px 18px; border-radius: 16px; background: var(--primary-soft);
}
.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 26px; font-weight: 800; letter-spacing: .18em; color: var(--primary); margin-right: 6px; }
.code-box .icon-btn { color: var(--primary); }
.pair-form { display: flex; gap: 8px; width: 100%; max-width: 360px; margin-top: 6px; }
.pair-form input { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; text-align: center; }
.pair-form .btn { flex: none; }
.howto { list-style: none; counter-reset: s; margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.howto li { counter-increment: s; display: flex; gap: 12px; align-items: baseline; color: var(--muted); }
.howto li::before {
  content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: var(--accent-soft); color: var(--accent);
}
.howto strong { color: var(--text); }

/* --- Bilan hebdomadaire ------------------------------------------------------ */
.weeknav { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 16px; }
.hero { display: flex; align-items: center; gap: 18px; padding: 20px; }
.hero-title { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.hero .ring-label { font-size: 24px; }
.delta { font-size: 13.5px; font-weight: 700; margin-top: 6px; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.stat-val { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.stat-val small { font-size: 15px; color: var(--muted); font-weight: 700; }
.stat-lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
@media (min-width: 640px) { .main .stats { grid-template-columns: repeat(4, 1fr); } .sheet .stats { grid-template-columns: repeat(2, 1fr); } }

.daychart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 170px; }
.dc { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.dc-val { font-size: 11.5px; font-weight: 700; color: var(--muted); height: 16px; }
.dc-track { flex: 1; width: 100%; max-width: 34px; display: flex; align-items: flex-end; }
.dc-bar { width: 100%; display: flex; flex-direction: column-reverse; gap: 2px; border-radius: 9px; overflow: hidden; }
.dc-bar i { display: block; min-height: 4px; }
.dc-label { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: capitalize; }
.dc.is-today .dc-label { color: var(--primary); font-weight: 800; }
.s-done { background: var(--success); }
.s-partial { background: var(--warning); }
.s-missed { background: var(--danger); }
.s-upcoming { background: var(--upcoming); }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }

.wk-skill { display: flex; align-items: center; gap: 12px; }
.wk-icon {
  width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c);
}
.wk-icon .i { width: 20px; height: 20px; }
.wk-goal { display: flex; flex-direction: column; gap: 4px; }
.wk-goal .xpbar { margin: 4px 0 0; }
.stat-ico { color: var(--muted); margin-bottom: 4px; }
.stat-ico .i { width: 18px; height: 18px; }
.delta { display: flex; align-items: center; gap: 5px; }
.fold-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; }
.fold-ico.ok { background: var(--success-soft); color: var(--success); }
.fold-ico.ko { background: var(--danger-soft); color: var(--danger); }

.xpbar { display: block; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 6px 0 4px; }
.xpbar > span { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--primary)); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.xpbar.big { height: 12px; }

.evo { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; height: 160px; margin-bottom: 10px; }
.ev { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.ev-val { font-size: 11px; font-weight: 700; color: var(--muted); }
.ev-track { flex: 1; width: 100%; max-width: 30px; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.ev-bar { width: 100%; background: color-mix(in srgb, var(--primary) 45%, transparent); border-radius: 8px; }
.ev.is-cur .ev-bar { background: var(--primary); }
.ev.is-cur .ev-val, .ev.is-cur .ev-label { color: var(--primary); }
.ev-label { font-size: 11px; color: var(--muted); font-weight: 600; }

.fold { padding: 0; margin-bottom: 10px; }
.fold summary { padding: 15px 16px; font-weight: 700; cursor: pointer; list-style: none; display: flex; gap: 6px; align-items: center; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: '›'; margin-left: auto; color: var(--muted); font-size: 20px; transition: transform .2s; }
.fold[open] summary::after { transform: rotate(90deg); }
.fold > :not(summary) { padding: 0 16px 15px; }
.glist { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.glist li { display: flex; gap: 10px; align-items: baseline; }
.glist .muted { width: 30px; flex: none; text-transform: capitalize; }

.stars { display: inline-flex; flex-direction: row-reverse; }
.stars input { position: absolute; opacity: 0; pointer-events: none; }
.stars label { display: grid; padding: 0 1px; color: var(--border); cursor: pointer; transition: color .1s, transform .1s; }
.stars label .i { width: 26px; height: 26px; fill: currentColor; stroke-width: 1.5; }
.stars label:hover { transform: scale(1.12); }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: #f5b301; }
.stars input:focus-visible + label { outline: 2px solid var(--primary); border-radius: 4px; }
.stars-read { display: inline-flex; gap: 1px; color: var(--border); }
.stars-read .i { width: 16px; height: 16px; fill: currentColor; stroke-width: 1.5; }
.stars-read .i.on { color: #f5b301; }
.review-read p { margin-top: 8px; white-space: pre-line; }

/* --- Compétences -------------------------------------------------------------- */
.level-card { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
.level-badge {
  width: 72px; height: 72px; flex: none; border-radius: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 850; line-height: 1; color: #fff;
  background: linear-gradient(135deg, var(--c, var(--primary)), color-mix(in srgb, var(--c, var(--primary)) 55%, var(--accent)));
}
.level-badge small { font-size: 11px; font-weight: 700; opacity: .85; margin-bottom: 2px; }
.level-card.is-partner { --c: var(--accent); }
.skills { display: grid; gap: 10px; }
@media (min-width: 640px) { .skills { grid-template-columns: 1fr 1fr; } }
.skill {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 14px;
  box-shadow: var(--shadow-sm); transition: border-color .15s, transform .1s;
}
.skill:hover { border-color: var(--c); }
.skill:active { transform: scale(.99); }
.skill-icon {
  width: 48px; height: 48px; flex: none; border-radius: 15px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c);
}
.skill-icon .i { width: 24px; height: 24px; }
.tabs { margin-top: 16px; }

/* Badges */
.badges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .badges { grid-template-columns: repeat(3, 1fr); } }
.badge-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 16px 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border);
}
.badge-card .xpbar { width: 100%; height: 6px; margin: 6px 0 0; }
.badge-ico {
  position: relative; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px;
  background: var(--surface-2); color: var(--muted);
}
.badge-ico > .i { width: 28px; height: 28px; }
.badge-card.on .badge-ico, .badge-won .badge-ico {
  background: linear-gradient(135deg, #f5b301, var(--accent)); color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}
.badge-card:not(.on) { opacity: .85; }
.badge-card:not(.on) strong { color: var(--muted); }
.badge-lock {
  position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}
.ok { color: var(--success); font-weight: 650; }
.ok-line { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-weight: 650; }
.badge-won { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 10px; }
.badge-ico.big { width: 88px; height: 88px; animation: pop .6s cubic-bezier(.3, 1.6, .5, 1); }
.badge-ico.big > .i { width: 44px; height: 44px; }
.celebration .sheet-body { padding-bottom: 28px; }

/* Calendrier */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { text-transform: capitalize; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-dow { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); padding-bottom: 4px; }
.cal-day {
  aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--muted);
  transition: transform .1s;
}
.cal-day:active { transform: scale(.94); }
.cal-day.is-today { outline: 2px solid var(--primary); outline-offset: 1px; }
.cal-day.fut, .cal-key.fut { background: transparent; border: 1.5px dashed var(--border); }
.cal-day.l0, .cal-key.l0 { background: var(--danger-soft); color: var(--danger); }
.cal-day.l1 { background: color-mix(in srgb, var(--success) 18%, var(--surface-2)); color: var(--text); }
.cal-day.l2, .cal-key.l2 { background: color-mix(in srgb, var(--success) 40%, var(--surface-2)); color: var(--text); }
.cal-day.l3 { background: color-mix(in srgb, var(--success) 70%, var(--surface-2)); color: #fff; }
.cal-day.l4, .cal-key.l4 { background: var(--success); color: #fff; }
.cal-key { display: inline-block; }

/* Interrupteurs (préférences de notification) */
.switches { display: flex; flex-direction: column; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); cursor: pointer; }
.switch-row > span:first-child { display: flex; flex-direction: column; }
.switch { position: relative; flex: none; width: 46px; height: 28px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background .2s; pointer-events: none; }
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--primary); outline-offset: 2px; }

/* Formulaire d'objectif : champs propres au « jour » ou à la « semaine » */
form[data-period="day"] [data-only="week"], form[data-period="week"] [data-only="day"] { display: none !important; }
.w-qty { max-width: 110px; }
.skill-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lvl { font-size: 12px; font-weight: 800; color: var(--c); }
.skill-detail { display: flex; align-items: center; gap: 16px; margin-bottom: 4px; }
.tip { margin-top: 22px; background: var(--surface-2); border-color: transparent; box-shadow: none; }
.tip p { margin-top: 4px; }

/* --- Profil ------------------------------------------------------------------- */
.profile-head { display: flex; align-items: center; gap: 16px; margin: 4px 0 8px; }
.avatar {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  background: var(--primary-soft); color: var(--primary);
}
.avatar.big { width: 68px; height: 68px; font-size: 28px; }
.avatar.accent { background: var(--accent-soft); color: var(--accent); }
.footer-note { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 20px; }

/* --- Authentification ------------------------------------------------------- */
.auth {
  min-height: 100dvh; max-width: 440px; margin: 0 auto;
  padding: calc(var(--safe-top) + 40px) 16px calc(var(--safe-bottom) + 32px);
  display: flex; flex-direction: column; justify-content: center; gap: 22px;
}
.auth-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.auth-hero h1 { font-size: 34px; }
.auth-hero p { color: var(--muted); }
.auth-card { padding: 18px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow); }
.auth-points { list-style: none; display: flex; flex-direction: column; gap: 10px; color: var(--muted); font-size: 14.5px; padding: 0 6px; }
.auth-points li { display: flex; align-items: center; gap: 10px; }
.auth-points .i { color: var(--primary); width: 20px; height: 20px; }

/* --- Feuilles modales ---------------------------------------------------------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(16, 12, 40, .45);
  opacity: 0; transition: opacity .2s;
}
.sheet-backdrop.open { opacity: 1; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  box-shadow: var(--shadow);
  padding-bottom: var(--safe-bottom);
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .2s;
}
.sheet-backdrop.open .sheet { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 99px; background: var(--border); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 8px 20px; }
.sheet-head h2 { font-size: 18px; overflow-wrap: anywhere; }
.sheet-body { overflow-y: auto; padding: 6px 20px 24px; overscroll-behavior: contain; }
.confirm-text { margin-bottom: 16px; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; padding: 24px; }
  .sheet { border-radius: 24px; transform: translateY(16px) scale(.98); opacity: 0; }
  .sheet-backdrop.open .sheet { opacity: 1; }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 16px; }
}

/* --- Toast ------------------------------------------------------------------- */
.toast {
  position: fixed; z-index: 100; left: 50%; top: calc(var(--safe-top) + 14px);
  max-width: min(92vw, 420px);
  transform: translate(-50%, -140%);
  padding: 12px 18px; border-radius: 14px;
  background: var(--text); color: var(--bg);
  font-weight: 650; font-size: 14.5px; text-align: left;
  display: flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .3s, visibility .3s;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }

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