:root {
  --bg: #f4f8f5;
  --surface: #ffffff;
  --surface-soft: #edf7f1;
  --text: #14251d;
  --muted: #6f7e76;
  --line: #dfe9e2;
  --primary: #1fbd72;
  --primary-strong: #11955a;
  --secondary: #8057d8;
  --danger: #dc4c64;
  --warning: #d78d1f;
  --shadow: 0 18px 55px rgba(23, 68, 45, .10);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0d1511;
  --surface: #15211b;
  --surface-soft: #1a2b22;
  --text: #f0f8f3;
  --muted: #9bb0a4;
  --line: #293a31;
  --primary: #35d98a;
  --primary-strong: #1fbd72;
  --secondary: #9c77ef;
  --shadow: 0 18px 55px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg: #0d1511;
    --surface: #15211b;
    --surface-soft: #1a2b22;
    --text: #f0f8f3;
    --muted: #9bb0a4;
    --line: #293a31;
    --primary: #35d98a;
    --primary-strong: #1fbd72;
    --secondary: #9c77ef;
    --shadow: 0 18px 55px rgba(0, 0, 0, .28);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 8%, rgba(31, 189, 114, .13), transparent 30%),
    radial-gradient(circle at 92% 2%, rgba(128, 87, 216, .13), transparent 27%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.topbar { display:flex; align-items:center; justify-content:space-between; padding:24px 0; }
.brand { display:flex; align-items:center; gap:12px; color:var(--text); font-weight:900; font-size:1.25rem; }
.brand:hover { text-decoration:none; }
.brand-mark { width:42px; height:42px; border-radius:15px; display:grid; place-items:center; background:linear-gradient(145deg, var(--primary), var(--secondary)); color:white; box-shadow:0 10px 26px rgba(31,189,114,.25); }
.brand-mark::after { content:"M"; font-weight:900; }
.icon-button { border:1px solid var(--line); background:var(--surface); color:var(--text); border-radius:14px; min-width:44px; height:44px; padding:0 12px; box-shadow:var(--shadow); }

.auth-layout { min-height:100vh; display:grid; grid-template-columns:1.05fr .95fr; }
.auth-visual { padding:48px clamp(32px,7vw,100px); display:flex; flex-direction:column; justify-content:space-between; }
.auth-card-wrap { padding:24px; display:grid; place-items:center; }
.auth-card { width:min(100%, 500px); padding:34px; border:1px solid var(--line); border-radius:30px; background:color-mix(in srgb, var(--surface) 94%, transparent); box-shadow:var(--shadow); backdrop-filter:blur(18px); }
.eyebrow { display:inline-flex; align-items:center; gap:8px; color:var(--primary-strong); font-weight:800; font-size:.86rem; text-transform:uppercase; letter-spacing:.08em; }
h1 { margin:.45rem 0 1rem; font-size:clamp(2.1rem,5vw,4.8rem); line-height:.96; letter-spacing:-.055em; }
.auth-card h1 { font-size:clamp(2rem,4vw,3rem); }
.lead { max-width:680px; color:var(--muted); font-size:1.08rem; line-height:1.65; }
.love-chip { display:inline-flex; margin-top:20px; padding:10px 14px; border-radius:999px; background:var(--surface-soft); border:1px solid var(--line); font-weight:750; color:var(--muted); }
.love-chip span { color:var(--secondary); margin-left:6px; }

.form-grid { display:grid; gap:16px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
label { display:grid; gap:8px; font-weight:750; font-size:.94rem; }
.input-wrap { position:relative; }
input { width:100%; border:1px solid var(--line); background:var(--bg); color:var(--text); border-radius:16px; padding:15px 16px; outline:none; transition:.2s ease; }
input:focus { border-color:var(--primary); box-shadow:0 0 0 4px rgba(31,189,114,.14); }
.password-toggle { position:absolute; right:9px; top:50%; transform:translateY(-50%); border:0; background:transparent; color:var(--muted); font-weight:750; font-size:.82rem; }
.checkbox { display:flex; align-items:flex-start; gap:10px; font-weight:500; color:var(--muted); line-height:1.45; }
.checkbox input { width:18px; height:18px; margin-top:2px; accent-color:var(--primary); }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:10px; min-height:52px; border-radius:16px; border:1px solid transparent; padding:0 20px; font-weight:850; transition:.2s ease; }
.btn:hover { transform:translateY(-1px); text-decoration:none; }
.btn-primary { background:linear-gradient(135deg, var(--primary), var(--primary-strong)); color:#fff; box-shadow:0 12px 24px rgba(31,189,114,.22); }
.btn-secondary { background:var(--surface); color:var(--text); border-color:var(--line); }
.full { width:100%; }
.form-meta { display:flex; justify-content:space-between; align-items:center; gap:12px; color:var(--muted); font-size:.92rem; }
.auth-footer { margin-top:22px; text-align:center; color:var(--muted); }
.alert { padding:13px 15px; border-radius:14px; margin-bottom:16px; border:1px solid var(--line); line-height:1.45; }
.alert-success { background:rgba(31,189,114,.11); color:var(--primary-strong); border-color:rgba(31,189,114,.26); }
.alert-danger { background:rgba(220,76,100,.10); color:var(--danger); border-color:rgba(220,76,100,.24); }
.alert-warning { background:rgba(215,141,31,.10); color:var(--warning); border-color:rgba(215,141,31,.24); }
.alert-info { background:var(--surface-soft); color:var(--muted); }

.dashboard { padding-bottom:110px; }
.dashboard-header { position:sticky; top:0; z-index:10; backdrop-filter:blur(18px); background:color-mix(in srgb, var(--bg) 78%, transparent); border-bottom:1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.user-pill { display:flex; align-items:center; gap:10px; }
.avatar { width:44px; height:44px; border-radius:15px; display:grid; place-items:center; background:linear-gradient(145deg, var(--primary), var(--secondary)); color:#fff; font-weight:900; }
.dashboard-grid { display:grid; grid-template-columns:1.2fr .8fr; gap:20px; margin-top:22px; }
.card { background:var(--surface); border:1px solid var(--line); border-radius:26px; padding:24px; box-shadow:var(--shadow); }
.card-title { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:18px; }
.card-title h2 { margin:0; font-size:1.05rem; }
.muted { color:var(--muted); }
.steps-card { min-height:340px; display:grid; grid-template-columns:1fr 1fr; align-items:center; gap:20px; background:linear-gradient(145deg, color-mix(in srgb, var(--surface) 88%, var(--primary) 12%), var(--surface)); }
.progress-ring { --progress:0deg; width:min(260px, 72vw); aspect-ratio:1; margin:auto; border-radius:50%; display:grid; place-items:center; background:conic-gradient(var(--primary) var(--progress), var(--line) 0); position:relative; }
.progress-ring::before { content:""; position:absolute; inset:18px; border-radius:50%; background:var(--surface); }
.progress-content { position:relative; text-align:center; }
.steps-value { font-size:clamp(2.2rem,6vw,4.2rem); font-weight:950; letter-spacing:-.06em; }
.stats { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; margin-top:22px; }
.stat { padding:16px; border-radius:18px; background:var(--surface-soft); border:1px solid var(--line); }
.stat strong { display:block; font-size:1.25rem; }
.ranking-list { display:grid; gap:10px; }
.ranking-row { display:grid; grid-template-columns:36px 1fr auto; gap:10px; align-items:center; padding:13px; border-radius:17px; background:var(--surface-soft); border:1px solid var(--line); }
.rank { width:32px; height:32px; border-radius:11px; display:grid; place-items:center; background:var(--surface); font-weight:900; }
.empty { padding:28px; text-align:center; color:var(--muted); border:1px dashed var(--line); border-radius:20px; }
.bottom-nav { position:fixed; bottom:16px; left:50%; transform:translateX(-50%); width:min(620px, calc(100% - 28px)); display:grid; grid-template-columns:repeat(4,1fr); gap:6px; padding:8px; border:1px solid var(--line); border-radius:24px; background:color-mix(in srgb, var(--surface) 92%, transparent); box-shadow:var(--shadow); backdrop-filter:blur(18px); }
.bottom-nav a { display:grid; place-items:center; min-height:52px; border-radius:17px; color:var(--muted); font-weight:800; font-size:.8rem; }
.bottom-nav a.active { color:var(--primary-strong); background:var(--surface-soft); }
.bottom-nav a:hover { text-decoration:none; }

.install-page { padding:42px 0 70px; }
.install-card { width:min(760px, calc(100% - 32px)); margin:0 auto; }
.code { font-family:ui-monospace, SFMono-Regular, Menlo, monospace; font-size:.84rem; }

@media (max-width: 860px) {
  .auth-layout { grid-template-columns:1fr; }
  .auth-visual { min-height:auto; padding:28px 24px 10px; }
  .auth-visual .lead, .auth-visual .love-chip { display:none; }
  .auth-card-wrap { padding:16px; align-items:start; }
  .auth-card { padding:26px 22px; border-radius:24px; }
  .dashboard-grid { grid-template-columns:1fr; }
  .steps-card { grid-template-columns:1fr; }
}

@media (max-width: 560px) {
  .shell { width:min(100% - 22px, 1120px); }
  .topbar { padding:16px 0; }
  .form-row { grid-template-columns:1fr; }
  .form-meta { align-items:flex-start; flex-direction:column; }
  .card { border-radius:22px; padding:18px; }
  .steps-card { min-height:unset; }
}

/* Moti 1.1 — Cercles privés */
select { font: inherit; }
.header-actions { display:flex; gap:10px; align-items:center; }
.user-context { font-size:.8rem; max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.page-main { padding-bottom:120px; }
.page-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin:30px 0 24px; }
.page-heading h1 { margin:.35rem 0 .5rem; font-size:clamp(2.5rem,7vw,4.8rem); }
.home-heading { align-items:center; }
.circle-count { min-width:112px; aspect-ratio:1; border-radius:30px; display:grid; place-items:center; align-content:center; background:linear-gradient(145deg, var(--surface-soft), var(--surface)); border:1px solid var(--line); box-shadow:var(--shadow); }
.circle-count strong { font-size:2.1rem; line-height:1; }
.circle-count span { color:var(--muted); font-weight:750; margin-top:6px; }
.two-column-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
.compact-row { grid-template-columns:110px 1fr; }
.section-block { margin-top:34px; }
.section-heading { display:flex; align-items:end; justify-content:space-between; margin-bottom:16px; }
.section-heading h2 { margin:.35rem 0 0; font-size:1.55rem; }
.soft-icon { color:var(--secondary); font-size:1.2rem; font-weight:900; }
.circle-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; }
.circle-card { position:relative; overflow:hidden; transition:.2s ease; }
.circle-card::before { content:""; position:absolute; inset:0 auto 0 0; width:4px; background:transparent; }
.circle-card.is-active::before { background:linear-gradient(var(--primary), var(--secondary)); }
.circle-card:hover { transform:translateY(-2px); }
.circle-card-top { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.circle-card h3 { margin:18px 0 4px; font-size:1.35rem; }
.circle-card p { margin:0 0 18px; }
.circle-emoji { width:58px; height:58px; border-radius:20px; display:grid; place-items:center; font-size:1.65rem; background:linear-gradient(145deg, color-mix(in srgb,var(--primary) 20%,var(--surface-soft)), color-mix(in srgb,var(--secondary) 17%,var(--surface))); border:1px solid var(--line); }
.circle-badges { display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; }
.badge { display:inline-flex; align-items:center; justify-content:center; min-height:27px; padding:0 10px; border-radius:999px; background:var(--surface-soft); border:1px solid var(--line); color:var(--muted); font-size:.76rem; font-weight:850; }
.badge-green { background:rgba(31,189,114,.11); border-color:rgba(31,189,114,.24); color:var(--primary-strong); }
.badge-purple { background:rgba(128,87,216,.11); border-color:rgba(128,87,216,.24); color:var(--secondary); }
.circle-actions { display:flex; align-items:center; gap:8px; }
.circle-actions > * { flex:1; }
.circle-actions .btn { width:100%; min-height:46px; }
.btn-ghost { background:transparent; color:var(--muted); border-color:var(--line); }
.btn-danger { background:rgba(220,76,100,.10); color:var(--danger); border-color:rgba(220,76,100,.30); }
.empty-state-large { min-height:310px; display:grid; place-items:center; align-content:center; text-align:center; padding:40px; }
.empty-state-large h2 { margin:12px 0 6px; }
.empty-state-large p { max-width:510px; }
.empty-illustration { width:84px; height:84px; border-radius:28px; display:grid; place-items:center; font-size:2rem; color:var(--secondary); background:linear-gradient(145deg,var(--surface-soft),var(--surface)); border:1px solid var(--line); }
.invite-input { text-transform:uppercase; letter-spacing:.18em; font-weight:900; }
.circle-hero { display:grid; grid-template-columns:auto 1fr auto; gap:22px; align-items:center; margin:30px 0 22px; background:linear-gradient(135deg,color-mix(in srgb,var(--surface) 84%,var(--primary) 16%),color-mix(in srgb,var(--surface) 91%,var(--secondary) 9%)); }
.circle-hero-emoji { width:104px; height:104px; border-radius:32px; display:grid; place-items:center; font-size:3rem; background:color-mix(in srgb,var(--surface) 75%,transparent); border:1px solid var(--line); }
.circle-hero h1 { margin:.25rem 0 .45rem; font-size:clamp(2.4rem,6vw,4rem); }
.circle-hero .lead { margin:0; }
.circle-detail-grid { align-items:start; }
.invite-card { min-height:100%; }
.invite-code-box { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:18px; border-radius:20px; background:var(--surface-soft); border:1px dashed color-mix(in srgb,var(--secondary) 60%,var(--line)); margin:18px 0 12px; }
.invite-code-box span { display:block; color:var(--muted); font-size:.78rem; font-weight:750; margin-bottom:4px; }
.invite-code-box strong { display:block; font-size:clamp(1.5rem,5vw,2.2rem); letter-spacing:.16em; }
.invite-link-row { display:grid; grid-template-columns:1fr auto; gap:10px; }
.inline-form { display:inline-flex; }
.top-gap { margin-top:16px; }
.member-list { display:grid; gap:10px; }
.member-row { display:grid; grid-template-columns:auto 1fr auto; gap:12px; align-items:center; padding:12px; border-radius:17px; background:var(--surface-soft); border:1px solid var(--line); }
.small-avatar { width:42px; height:42px; border-radius:14px; }
.member-copy { min-width:0; }
.member-copy strong, .member-copy span { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.member-copy span { color:var(--muted); font-size:.8rem; margin-top:3px; }
.danger-card { border-color:color-mix(in srgb,var(--danger) 24%,var(--line)); }
.ranking-row.is-me, .full-ranking-row.is-me { border-color:rgba(31,189,114,.35); background:color-mix(in srgb,var(--surface-soft) 83%,var(--primary) 17%); }
.mini-label { font-size:.78rem; }
.ranking-heading { align-items:center; }
.circle-switcher { min-width:230px; }
.circle-switcher select { width:100%; margin-top:8px; border:1px solid var(--line); background:var(--surface); color:var(--text); border-radius:16px; padding:14px 42px 14px 14px; }
.ranking-summary-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; margin-bottom:20px; }
.ranking-summary-grid .card { min-height:170px; display:flex; flex-direction:column; justify-content:center; }
.highlight-card { background:linear-gradient(145deg,color-mix(in srgb,var(--surface) 80%,var(--primary) 20%),var(--surface)); }
.big-summary { display:block; margin:10px 0 2px; font-size:clamp(2rem,5vw,3.4rem); letter-spacing:-.055em; }
.full-ranking-list { display:grid; gap:10px; }
.full-ranking-row { display:grid; grid-template-columns:auto auto 1fr auto; gap:13px; align-items:center; padding:15px; border-radius:20px; background:var(--surface-soft); border:1px solid var(--line); }
.rank-large { width:42px; height:42px; border-radius:14px; }
.ranking-person { min-width:0; }
.ranking-person strong, .ranking-person span { display:block; }
.ranking-person span { color:var(--muted); font-size:.82rem; margin-top:3px; }
.ranking-steps { text-align:right; }
.ranking-steps strong, .ranking-steps span { display:block; }
.ranking-steps strong { font-size:1.1rem; }
.ranking-steps span { color:var(--muted); font-size:.75rem; }
.active-circle-chip { display:flex; align-items:center; gap:11px; padding:11px 15px; border-radius:18px; background:var(--surface); border:1px solid var(--line); color:var(--text); box-shadow:var(--shadow); }
.active-circle-chip:hover { text-decoration:none; transform:translateY(-1px); }
.active-circle-chip > span { width:40px; height:40px; border-radius:14px; display:grid; place-items:center; background:var(--surface-soft); }
.active-circle-chip small, .active-circle-chip strong { display:block; }
.active-circle-chip small { color:var(--muted); font-size:.7rem; }
.circle-mini-card { display:flex; align-items:center; gap:14px; }
.circle-mini-card h3 { margin:2px 0; font-size:1.4rem; }
.circle-mini-card p { margin:0; color:var(--muted); }
.code-small { font-size:1rem !important; letter-spacing:.08em; }
.progress-title { font-size:2rem; margin:.5rem 0; }
.nav-icon { font-size:1rem; line-height:1; }
.bottom-nav a { gap:3px; }
.standalone-auth { min-height:100vh; padding:22px; }
.invitation-landing { text-align:center; }
.invitation-landing .brand { justify-content:center; }
.invite-landing-emoji { width:105px; height:105px; border-radius:34px; margin:28px auto 18px; display:grid; place-items:center; font-size:3rem; background:linear-gradient(145deg,color-mix(in srgb,var(--primary) 18%,var(--surface-soft)),color-mix(in srgb,var(--secondary) 16%,var(--surface))); border:1px solid var(--line); }
.invitation-landing h1 { margin:.45rem 0 .8rem; }
.centered-code { justify-content:center; text-align:center; }
.profile-card { display:grid; justify-items:center; text-align:center; align-content:center; }
.profile-avatar-large { width:112px; height:112px; border-radius:36px; display:grid; place-items:center; font-size:3rem; font-weight:950; color:#fff; background:linear-gradient(145deg,var(--primary),var(--secondary)); box-shadow:0 18px 36px rgba(31,189,114,.20); }
.profile-card h2 { margin:18px 0 2px; }
.profile-meta { width:100%; display:flex; justify-content:space-between; gap:16px; padding-top:18px; margin-top:18px; border-top:1px solid var(--line); color:var(--muted); }

@media (max-width: 980px) {
  .circle-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .circle-hero { grid-template-columns:auto 1fr; }
  .circle-hero > .btn { grid-column:1/-1; }
}

@media (max-width: 760px) {
  .two-column-grid, .ranking-summary-grid { grid-template-columns:1fr; }
  .page-heading { align-items:flex-start; flex-direction:column; }
  .home-heading { align-items:flex-start; }
  .circle-count { min-width:94px; width:94px; }
  .circle-grid { grid-template-columns:1fr; }
  .circle-hero { grid-template-columns:1fr; text-align:center; }
  .circle-hero-emoji { margin:auto; }
  .circle-switcher { width:100%; }
  .active-circle-chip { width:100%; }
  .ranking-summary-grid .card { min-height:135px; }
}

@media (max-width: 560px) {
  .user-pill > div:last-child { display:none; }
  .header-actions { gap:7px; }
  .circle-hero { padding:22px; }
  .circle-hero-emoji { width:86px; height:86px; border-radius:27px; font-size:2.5rem; }
  .compact-row { grid-template-columns:88px 1fr; }
  .invite-link-row { grid-template-columns:1fr; }
  .invite-code-box { align-items:flex-start; flex-direction:column; }
  .invite-code-box .icon-button { width:100%; }
  .full-ranking-row { grid-template-columns:auto auto 1fr; }
  .ranking-steps { grid-column:2/-1; text-align:left; display:flex; align-items:baseline; gap:5px; }
  .bottom-nav { bottom:10px; }
}

/* Moti 1.2 — Pas, historique et transparence */
.narrow-page { width:min(720px, calc(100% - 32px)); }
.upgrade-card { text-align:center; display:grid; justify-items:center; gap:12px; padding:clamp(26px,6vw,54px); }
.upgrade-card h2 { margin:4px 0 0; font-size:clamp(1.6rem,4vw,2.3rem); }
.upgrade-card form { width:min(100%,440px); }
.upgrade-icon { width:86px; height:86px; border-radius:28px; display:grid; place-items:center; font-size:2.25rem; font-weight:950; color:#fff; background:linear-gradient(145deg,var(--primary),var(--secondary)); box-shadow:0 18px 36px rgba(31,189,114,.18); }
.security-note { color:var(--muted); font-size:.82rem; line-height:1.55; margin:16px 0 0; }
.step-actions { display:flex; align-items:center; flex-wrap:wrap; gap:10px; margin:18px 0 2px; }
.split-actions { display:grid; grid-template-columns:1fr auto; gap:10px; }
.steps-editor-grid { display:grid; grid-template-columns:1.08fr .92fr; gap:20px; align-items:stretch; }
.step-entry-card, .selected-day-card { min-height:100%; }
.step-input-wrap { position:relative; }
.step-input-wrap > span { position:absolute; right:18px; top:50%; transform:translateY(-50%); color:var(--muted); font-weight:850; pointer-events:none; }
.step-number-input { padding-right:68px; font-size:clamp(1.6rem,5vw,2.5rem); font-weight:950; letter-spacing:-.04em; }
.step-estimate { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.step-estimate > div { padding:14px; border:1px solid var(--line); border-radius:16px; background:var(--surface-soft); }
.step-estimate span, .step-estimate strong { display:block; }
.step-estimate span { color:var(--muted); font-size:.75rem; margin-bottom:4px; }
.manual-rules { display:grid; gap:8px; margin-top:18px; padding:16px; border-radius:18px; background:color-mix(in srgb,var(--surface-soft) 88%,var(--secondary) 12%); border:1px solid var(--line); }
.manual-rules strong { margin-bottom:2px; }
.manual-rules span { color:var(--muted); font-size:.82rem; }
.manual-rules span::before { content:"✓"; color:var(--primary-strong); font-weight:950; margin-right:8px; }
.selected-day-card { display:flex; flex-direction:column; }
.compact-progress-ring { --progress:0deg; width:min(250px,70vw); aspect-ratio:1; margin:8px auto 0; border-radius:50%; display:grid; place-items:center; background:conic-gradient(var(--primary) var(--progress),var(--line) 0); position:relative; }
.compact-progress-ring::before { content:""; position:absolute; inset:17px; border-radius:50%; background:var(--surface); }
.compact-progress-ring > div { position:relative; text-align:center; }
.compact-progress-ring strong, .compact-progress-ring span { display:block; }
.compact-progress-ring strong { font-size:clamp(2rem,6vw,3.2rem); letter-spacing:-.055em; }
.compact-progress-ring span { color:var(--muted); font-size:.8rem; }
.selected-day-stats { margin-top:auto; }
.source-line { display:flex; align-items:center; justify-content:center; gap:7px; color:var(--muted); font-size:.78rem; margin:16px 0 0; text-align:center; }
.source-dot { display:inline-block; width:8px; height:8px; border-radius:999px; background:var(--secondary); box-shadow:0 0 0 4px color-mix(in srgb,var(--secondary) 14%,transparent); flex:0 0 auto; }
.week-step-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:10px; }
.week-step-day { min-height:132px; position:relative; display:grid; place-items:center; align-content:center; gap:4px; padding:12px 8px; border-radius:20px; background:var(--surface); border:1px solid var(--line); box-shadow:var(--shadow); color:var(--text); }
.week-step-day:hover { text-decoration:none; transform:translateY(-2px); }
.week-step-day span { color:var(--muted); font-size:.74rem; font-weight:850; text-transform:uppercase; }
.week-step-day strong { font-size:1.35rem; }
.week-step-day small { color:var(--muted); font-size:.72rem; }
.week-step-day i { position:absolute; top:8px; right:8px; width:22px; height:22px; display:grid; place-items:center; border-radius:999px; color:#fff; background:var(--primary); font-style:normal; font-size:.7rem; }
.week-step-day.is-today { border-color:color-mix(in srgb,var(--primary) 55%,var(--line)); background:color-mix(in srgb,var(--surface) 88%,var(--primary) 12%); }
.week-step-day.is-future { opacity:.48; box-shadow:none; pointer-events:none; }
.step-summary-grid { margin-bottom:0; }
.steps-history-grid { align-items:start; }
.step-history-list, .edit-log-list { display:grid; gap:9px; }
.step-history-row { display:grid; grid-template-columns:100px 1fr auto; align-items:center; gap:12px; padding:11px 0; color:var(--text); border-bottom:1px solid var(--line); }
.step-history-row:last-child { border-bottom:0; }
.step-history-row:hover { text-decoration:none; }
.history-date strong, .history-date span { display:block; }
.history-date span { color:var(--muted); font-size:.72rem; margin-top:2px; }
.history-bar { height:9px; border-radius:999px; background:var(--surface-soft); overflow:hidden; }
.history-bar i { display:block; height:100%; min-width:3px; border-radius:inherit; background:linear-gradient(90deg,var(--primary),var(--secondary)); }
.step-history-row > strong { text-align:right; font-size:.88rem; }
.edit-log-row { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:13px; border-radius:17px; background:var(--surface-soft); border:1px solid var(--line); }
.edit-log-row > div:first-child strong, .edit-log-row > div:first-child span { display:block; }
.edit-log-row > div:first-child span { color:var(--muted); font-size:.72rem; margin-top:3px; }
.edit-change { display:flex; align-items:center; gap:7px; white-space:nowrap; font-size:.83rem; }
.edit-change span { color:var(--muted); }
.edit-change b { color:var(--secondary); }
.ranking-transparency { display:flex; align-items:center; justify-content:center; gap:9px; color:var(--muted); font-size:.82rem; text-align:center; margin:18px 0 0; }

@media (max-width: 860px) {
  .steps-editor-grid { grid-template-columns:1fr; }
  .week-step-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
}

@media (max-width: 560px) {
  .step-estimate { grid-template-columns:1fr; }
  .week-step-grid { grid-template-columns:repeat(7,minmax(66px,1fr)); overflow-x:auto; padding:2px 1px 12px; scroll-snap-type:x proximity; }
  .week-step-day { min-height:112px; scroll-snap-align:start; }
  .step-history-row { grid-template-columns:85px 1fr; }
  .step-history-row > strong { grid-column:2; text-align:left; margin-top:-7px; }
  .edit-log-row { align-items:flex-start; flex-direction:column; }
  .split-actions { grid-template-columns:1fr; }
}

/* Moti 1.3 — Statistiques, badges et défis */
select, textarea {
  width:100%;
  border:1px solid var(--line);
  background:var(--bg);
  color:var(--text);
  border-radius:16px;
  padding:15px 16px;
  outline:none;
  transition:.2s ease;
}
select:focus, textarea:focus { border-color:var(--primary); box-shadow:0 0 0 4px rgba(31,189,114,.14); }
textarea { resize:vertical; min-height:100px; }
.bottom-nav { grid-template-columns:repeat(5,1fr); width:min(720px, calc(100% - 28px)); }
.bottom-nav a { min-width:0; }

.period-tabs { display:inline-flex; gap:5px; padding:5px; border:1px solid var(--line); border-radius:18px; background:var(--surface); box-shadow:var(--shadow); }
.period-tabs a { padding:11px 16px; border-radius:13px; color:var(--muted); font-weight:850; }
.period-tabs a:hover { text-decoration:none; }
.period-tabs a.active { color:#fff; background:linear-gradient(135deg,var(--primary),var(--primary-strong)); }
.stats-overview-grid, .challenge-summary-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; }
.metric-card { display:flex; min-height:155px; flex-direction:column; justify-content:center; }
.metric-card > span { color:var(--muted); font-size:.82rem; font-weight:800; }
.metric-card > strong { margin:7px 0 3px; font-size:clamp(1.8rem,4vw,2.9rem); line-height:1; letter-spacing:-.055em; }
.metric-card > small { color:var(--muted); }
.metric-primary { background:linear-gradient(145deg,color-mix(in srgb,var(--surface) 84%,var(--primary) 16%),color-mix(in srgb,var(--surface) 92%,var(--secondary) 8%)); }
.stats-layout { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(300px,.6fr); gap:20px; margin-top:20px; align-items:stretch; }
.stats-side-stack { display:grid; gap:20px; }
.chart-card { min-width:0; overflow:hidden; }
.step-chart { position:relative; display:grid; grid-template-columns:repeat(7,minmax(34px,1fr)); gap:10px; height:330px; padding:28px 2px 0; }
.step-chart.is-month { grid-template-columns:repeat(30,minmax(14px,1fr)); gap:5px; overflow-x:auto; padding-bottom:10px; }
.goal-line { position:absolute; left:0; right:0; bottom:calc(var(--goal-position) + 24px); height:1px; border-top:1px dashed color-mix(in srgb,var(--secondary) 65%,var(--line)); pointer-events:none; z-index:2; }
.goal-line span { position:absolute; right:0; top:-22px; color:var(--secondary); font-size:.7rem; font-weight:850; background:var(--surface); padding-left:7px; }
.chart-column { display:grid; grid-template-rows:24px 1fr 24px; gap:6px; min-width:0; text-align:center; align-items:end; }
.chart-value { color:var(--muted); font-size:.66rem; overflow:hidden; text-overflow:ellipsis; }
.chart-track { width:100%; height:250px; display:flex; align-items:flex-end; justify-content:center; border-radius:10px; background:linear-gradient(to top,var(--surface-soft),transparent); overflow:hidden; }
.chart-track i { display:block; width:min(72%,34px); border-radius:9px 9px 4px 4px; background:linear-gradient(180deg,var(--secondary),var(--primary)); min-height:0; transition:.25s ease; }
.chart-track i.goal-hit { box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 12%,transparent); }
.chart-column > span { color:var(--muted); font-size:.72rem; font-weight:800; }
.step-chart.is-month .chart-track { height:250px; min-width:13px; }
.step-chart.is-month .chart-track i { width:100%; border-radius:5px 5px 2px 2px; }
.weekly-insight-card { background:linear-gradient(145deg,color-mix(in srgb,var(--surface) 90%,var(--secondary) 10%),var(--surface)); }
.insight-number { display:block; font-size:clamp(2rem,5vw,3.2rem); letter-spacing:-.06em; }
.insight-comparison { display:grid; grid-template-columns:auto auto 1fr; gap:7px; align-items:center; margin:18px 0; padding:13px; border-radius:16px; background:var(--surface-soft); border:1px solid var(--line); }
.insight-comparison.positive > span, .insight-comparison.positive > strong { color:var(--primary-strong); }
.insight-comparison.negative > span, .insight-comparison.negative > strong { color:var(--danger); }
.insight-comparison small { color:var(--muted); line-height:1.35; }
.mini-progress, .large-progress { height:11px; border-radius:999px; overflow:hidden; background:var(--surface-soft); border:1px solid var(--line); }
.mini-progress i, .large-progress i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--primary),var(--secondary)); }
.streak-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.streak-grid > div { padding:18px; border-radius:20px; background:var(--surface-soft); border:1px solid var(--line); text-align:center; }
.streak-grid span, .streak-grid small { display:block; color:var(--muted); }
.streak-grid strong { display:block; font-size:2.5rem; letter-spacing:-.06em; }
.comparison-list { display:grid; gap:9px; }
.comparison-row { display:grid; grid-template-columns:38px minmax(130px,.55fr) minmax(120px,1fr) auto; gap:13px; align-items:center; padding:13px; border-radius:18px; border:1px solid var(--line); background:var(--surface-soft); }
.comparison-row.is-me { border-color:color-mix(in srgb,var(--primary) 55%,var(--line)); background:color-mix(in srgb,var(--surface-soft) 84%,var(--primary) 16%); }
.comparison-person strong, .comparison-person span { display:block; }
.comparison-person span { margin-top:3px; color:var(--muted); font-size:.75rem; }
.comparison-progress { height:10px; overflow:hidden; border-radius:999px; background:var(--surface); border:1px solid var(--line); }
.comparison-progress i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--primary),var(--secondary)); }
.badge-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.achievement-card { display:grid; grid-template-columns:58px 1fr auto; gap:15px; align-items:center; min-height:145px; }
.achievement-card.locked { opacity:.58; box-shadow:none; }
.achievement-icon { width:58px; height:58px; border-radius:20px; display:grid; place-items:center; font-size:1.7rem; background:linear-gradient(145deg,color-mix(in srgb,var(--primary) 20%,var(--surface)),color-mix(in srgb,var(--secondary) 18%,var(--surface))); border:1px solid var(--line); }
.achievement-card h3 { margin:0 0 5px; }
.achievement-card p { margin:0; color:var(--muted); font-size:.82rem; line-height:1.45; }

.challenge-layout { display:grid; grid-template-columns:minmax(310px,.72fr) minmax(0,1.28fr); gap:22px; align-items:start; }
.create-challenge-card { position:sticky; top:118px; }
.field-help { color:var(--muted); font-weight:500; line-height:1.4; }
.optional-label { color:var(--muted); font-size:.72rem; font-weight:600; }
.compact-section-heading { margin-top:0; }
.challenge-card-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.challenge-card { display:flex; flex-direction:column; min-height:335px; }
.challenge-card.state-completed { opacity:.76; }
.challenge-card-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.challenge-type-icon { width:48px; height:48px; border-radius:17px; display:grid; place-items:center; font-weight:950; color:#fff; background:linear-gradient(145deg,var(--primary),var(--secondary)); box-shadow:0 12px 24px rgba(31,189,114,.17); }
.challenge-card h3 { margin:8px 0; font-size:1.35rem; }
.challenge-card > p { color:var(--muted); line-height:1.5; }
.challenge-meta { display:flex; flex-wrap:wrap; gap:7px 14px; color:var(--muted); font-size:.76rem; margin:8px 0 17px; }
.challenge-leader { display:grid; grid-template-columns:1fr auto; gap:5px 10px; margin:auto 0 17px; padding:15px; border-radius:18px; background:var(--surface-soft); border:1px solid var(--line); }
.challenge-leader span { color:var(--muted); font-size:.75rem; }
.challenge-leader strong { grid-column:1; font-size:1.3rem; }
.challenge-leader b { grid-column:2; grid-row:1 / span 2; align-self:center; }
.challenge-progress-copy { display:flex; justify-content:space-between; gap:10px; align-items:center; margin:auto 0 8px; }
.challenge-progress-copy span { color:var(--muted); }
.challenge-progress-copy strong { font-size:1.35rem; }
.challenge-progress { margin-bottom:7px; }
.challenge-card .btn { margin-top:18px; }
.challenge-detail-hero { display:grid; grid-template-columns:auto 1fr auto; gap:22px; align-items:center; margin-top:28px; background:linear-gradient(145deg,color-mix(in srgb,var(--surface) 85%,var(--primary) 15%),color-mix(in srgb,var(--surface) 91%,var(--secondary) 9%)); }
.challenge-detail-icon { width:90px; height:90px; border-radius:29px; display:grid; place-items:center; color:#fff; font-size:2.1rem; background:linear-gradient(145deg,var(--primary),var(--secondary)); }
.challenge-detail-copy h1 { margin:.35rem 0 .6rem; font-size:clamp(2.1rem,6vw,4rem); }
.challenge-badge-line { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.challenge-summary-grid { margin-top:20px; }
.collective-progress-card { margin-top:20px; }
.collective-progress-card .card-title strong { font-size:1.65rem; }
.large-progress { height:18px; }
.progress-numbers { display:flex; justify-content:space-between; gap:15px; margin-top:10px; color:var(--muted); font-size:.82rem; }
.challenge-ranking-row { grid-template-columns:48px 44px 1fr auto; }
.member-challenge-progress { margin-top:9px; max-width:420px; }
.challenge-danger { display:flex; justify-content:space-between; align-items:center; gap:20px; }
.featured-challenge-title { font-size:1.4rem; margin:.55rem 0 .2rem; }

.more-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
.more-card { display:grid; grid-template-columns:64px 1fr auto; gap:16px; align-items:center; color:var(--text); transition:.2s ease; }
.more-card:hover { text-decoration:none; transform:translateY(-2px); }
.more-card h2 { margin:0 0 4px; font-size:1.15rem; }
.more-card p { margin:0; color:var(--muted); font-size:.84rem; }
.more-card > b { font-size:1.8rem; color:var(--muted); }
.more-icon { width:64px; height:64px; display:grid; place-items:center; border-radius:21px; background:linear-gradient(145deg,color-mix(in srgb,var(--primary) 18%,var(--surface)),color-mix(in srgb,var(--secondary) 16%,var(--surface))); border:1px solid var(--line); font-size:1.4rem; }

@media (max-width: 980px) {
  .stats-overview-grid, .challenge-summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .stats-layout, .challenge-layout { grid-template-columns:1fr; }
  .create-challenge-card { position:static; }
  .badge-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width: 700px) {
  .challenge-card-list, .more-grid { grid-template-columns:1fr; }
  .challenge-detail-hero { grid-template-columns:70px 1fr; }
  .challenge-detail-icon { width:70px; height:70px; border-radius:23px; }
  .challenge-detail-hero > .btn { grid-column:1 / -1; }
  .comparison-row { grid-template-columns:34px 1fr auto; }
  .comparison-progress { grid-column:2 / -1; }
  .achievement-card { grid-template-columns:52px 1fr; }
  .achievement-card > .badge { grid-column:2; justify-self:start; }
}

@media (max-width: 560px) {
  .bottom-nav { bottom:9px; width:calc(100% - 14px); padding:6px; gap:3px; border-radius:20px; }
  .bottom-nav a { min-height:49px; padding:3px; font-size:.67rem; }
  .nav-icon { font-size:.94rem; }
  .stats-heading, .challenge-heading { align-items:flex-start; }
  .period-tabs { width:100%; }
  .period-tabs a { flex:1; text-align:center; }
  .stats-overview-grid, .challenge-summary-grid { grid-template-columns:1fr 1fr; gap:10px; }
  .metric-card { min-height:130px; padding:16px; }
  .metric-card > strong { font-size:1.75rem; }
  .step-chart { gap:5px; height:285px; }
  .chart-track { height:210px; }
  .step-chart.is-month .chart-track { height:210px; }
  .goal-line { bottom:calc(var(--goal-position) + 24px); }
  .badge-grid { grid-template-columns:1fr; }
  .comparison-row > strong { font-size:.8rem; }
  .challenge-danger { align-items:stretch; flex-direction:column; }
  .challenge-danger form, .challenge-danger .btn { width:100%; }
  .challenge-ranking-row { grid-template-columns:38px 38px 1fr; }
  .challenge-ranking-row .ranking-steps { grid-column:3; text-align:left; }
  .progress-numbers { flex-direction:column; gap:4px; }
}
.circle-hero-actions { display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
@media (max-width:700px) { .circle-hero-actions { grid-column:1 / -1; justify-content:stretch; } .circle-hero-actions .btn { flex:1; } }

/* Moti V1.4 · Synchronisation iPhone */
.sync-heading { align-items:flex-end; }
.sync-layout { display:grid; grid-template-columns:minmax(0,1.08fr) minmax(300px,.92fr); gap:20px; align-items:start; }
.sync-status-card, .endpoint-card { min-height:100%; }
.sync-empty { padding:18px 0 8px; }
.sync-device-form { margin-top:20px; padding-top:20px; border-top:1px solid var(--line); }
.device-list { display:grid; gap:10px; }
.device-row { display:grid; grid-template-columns:52px minmax(0,1fr) auto; gap:13px; align-items:center; padding:14px; border:1px solid var(--line); border-radius:18px; background:var(--surface-soft); }
.device-icon { width:52px; height:52px; display:grid; place-items:center; border-radius:18px; font-size:1.45rem; font-weight:900; background:linear-gradient(145deg,color-mix(in srgb,var(--primary) 18%,var(--surface)),color-mix(in srgb,var(--secondary) 18%,var(--surface))); border:1px solid var(--line); }
.device-row strong, .device-row span, .device-row small { display:block; }
.device-row span { margin-top:3px; color:var(--muted); font-size:.82rem; }
.device-row small { margin-top:4px; color:var(--muted); font-size:.7rem; }
.btn-small { min-height:38px; padding:8px 12px; font-size:.75rem; }
.token-reveal-card { display:grid; grid-template-columns:68px 1fr; gap:16px 20px; align-items:center; margin-bottom:20px; border-color:color-mix(in srgb,var(--primary) 55%,var(--line)); background:linear-gradient(145deg,color-mix(in srgb,var(--surface) 86%,var(--primary) 14%),color-mix(in srgb,var(--surface) 94%,var(--secondary) 6%)); }
.token-reveal-icon { width:68px; height:68px; display:grid; place-items:center; border-radius:23px; font-size:1.7rem; background:var(--surface); border:1px solid var(--line); }
.token-reveal-card h2 { margin:.25rem 0 .3rem; }
.secret-copy-box { grid-column:1 / -1; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:center; padding:12px; border-radius:18px; border:1px solid var(--line); background:var(--surface); }
.secret-copy-box code, .copy-field code { display:block; min-width:0; overflow:auto; white-space:nowrap; padding:10px 12px; border-radius:12px; background:var(--surface-soft); color:var(--text); font-size:.78rem; }
.copy-field { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:center; margin:16px 0; }
.sync-security-list { display:grid; gap:9px; padding:16px; border-radius:18px; background:var(--surface-soft); border:1px solid var(--line); color:var(--muted); font-size:.82rem; }
.sync-security-list span::first-letter { color:var(--primary); }
.setup-steps { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:15px; }
.setup-step { display:grid; grid-template-columns:48px minmax(0,1fr); gap:14px; align-items:start; min-height:180px; }
.setup-number { width:48px; height:48px; display:grid; place-items:center; border-radius:17px; color:#fff; font-size:1.1rem; font-weight:950; background:linear-gradient(145deg,var(--primary),var(--secondary)); box-shadow:0 10px 24px rgba(31,189,114,.16); }
.setup-step h3 { margin:5px 0 8px; font-size:1.15rem; }
.setup-step p { margin:0 0 10px; color:var(--muted); line-height:1.55; }
.setup-note { padding:10px 12px; border-radius:13px; background:color-mix(in srgb,var(--surface-soft) 82%,var(--secondary) 18%); border:1px solid var(--line); font-size:.78rem; }
.dictionary-example, .shortcut-settings { display:grid; gap:8px; margin-top:10px; }
.dictionary-example span, .shortcut-settings span { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); gap:8px; align-items:center; padding:10px 12px; border-radius:13px; background:var(--surface-soft); border:1px solid var(--line); font-size:.78rem; }
.dictionary-example b { color:var(--muted); }
.shortcut-settings span { grid-template-columns:1fr 1fr; }
.shortcut-settings b { text-align:right; overflow-wrap:anywhere; }
.automation-card { display:grid; grid-template-columns:76px 1fr; gap:18px; align-items:center; background:linear-gradient(145deg,color-mix(in srgb,var(--surface) 90%,var(--secondary) 10%),var(--surface)); }
.automation-icon { width:76px; height:76px; display:grid; place-items:center; border-radius:25px; font-size:2rem; background:var(--surface-soft); border:1px solid var(--line); }
.automation-card h2 { margin:.3rem 0 .4rem; }
.feature-check-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.feature-check-grid span { position:relative; padding:13px 13px 13px 38px; border:1px solid var(--line); border-radius:15px; background:var(--surface-soft); font-size:.82rem; font-weight:750; }
.feature-check-grid span::before { content:'✓'; position:absolute; left:13px; top:50%; transform:translateY(-50%); color:var(--primary-strong); font-weight:950; }
input:disabled { opacity:.72; cursor:not-allowed; background:color-mix(in srgb,var(--surface-soft) 90%,var(--line) 10%); }

@media (max-width: 900px) {
  .sync-layout { grid-template-columns:1fr; }
  .feature-check-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width: 700px) {
  .setup-steps { grid-template-columns:1fr; }
  .setup-step { min-height:0; }
  .device-row { grid-template-columns:46px 1fr; }
  .device-icon { width:46px; height:46px; border-radius:16px; }
  .device-row form { grid-column:2; }
  .device-row form .btn { width:100%; }
  .token-reveal-card { grid-template-columns:56px 1fr; }
  .token-reveal-icon { width:56px; height:56px; border-radius:19px; }
  .secret-copy-box, .copy-field { grid-template-columns:1fr; }
  .secret-copy-box .btn, .copy-field .btn { width:100%; }
  .automation-card { grid-template-columns:58px 1fr; align-items:start; }
  .automation-icon { width:58px; height:58px; border-radius:19px; font-size:1.5rem; }
}

@media (max-width: 520px) {
  .feature-check-grid { grid-template-columns:1fr; }
  .dictionary-example span { grid-template-columns:1fr auto 1fr; }
  .shortcut-settings span { grid-template-columns:1fr; }
  .shortcut-settings b { text-align:left; }
}
