/* ═══════════ Nexus — design ═══════════ */
:root {
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --ink: #1B1A17;
  --muted: #77736A;
  --line: #ECE8DF;
  --line-strong: #CFCAC0;
  --hover: #EFECE5;
  --accent: #1F7A55;
  --accent-strong: #17613F;
  --accent-soft: #E2F1E9;
  --accent-bright: #7EE2B0;
  --warn: #D2852F;
  --danger: #C2412D;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(27, 26, 23, .05), 0 6px 20px rgba(27, 26, 23, .05);
  --shadow-lg: 0 2px 6px rgba(27, 26, 23, .06), 0 14px 40px rgba(27, 26, 23, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --surface: #1F1E1B;
    --ink: #F2EFE8;
    --muted: #9B968C;
    --line: #2C2B27;
    --line-strong: #4A4842;
    --hover: #2A2925;
    --accent: #2E9C6E;
    --accent-strong: #7AD7A8;
    --accent-soft: #1C3328;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 17px/1.4 var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; border-radius: 10px; }
code { font: 600 .9em ui-monospace, Consolas, monospace; background: color-mix(in srgb, var(--warn) 14%, transparent); padding: 1px 5px; border-radius: 5px; }

.app { max-width: 620px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.ico { width: 22px; height: 22px; flex: none; }
.muted { color: var(--muted); }

/* ───────── Boutons ───────── */
.icon-btn {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  display: grid; place-items: center; color: var(--ink); text-decoration: none;
  transition: background .15s;
}
.icon-btn:hover, .icon-btn:active { background: var(--hover); }
.icon-btn.sm { width: 38px; height: 38px; color: var(--muted); }
.pill-btn {
  height: 38px; padding: 0 14px 0 11px; border-radius: 999px; flex: none;
  background: var(--ink); color: var(--bg);
  font-weight: 650; font-size: 15px; display: inline-flex; align-items: center; gap: 6px;
  transition: transform .15s;
}
.pill-btn .ico { width: 18px; height: 18px; }
.pill-btn:active { transform: scale(.96); }
.btn {
  height: 52px; padding: 0 20px; border-radius: 15px;
  background: var(--hover); color: var(--ink); text-decoration: none;
  font-weight: 650; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .15s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn .ico { width: 20px; height: 20px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.lg { height: 58px; font-size: 18px; border-radius: 17px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--danger); padding: 0 8px; }
.btn.wa .ico { color: #25D366; }
.link-btn { margin-left: 10px; color: var(--accent-strong); font-weight: 700; font-size: 13px; text-transform: none; letter-spacing: 0; padding: 4px 8px; border-radius: 8px; }
.link-btn:hover { background: var(--accent-soft); }

/* ───────── Avatars & statut ───────── */
.av {
  --h: 150;
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  background: hsl(var(--h) 45% 46%); color: #fff;
  font: 700 13px var(--font-display);
  box-shadow: 0 0 0 2px var(--bg);
}
.avatars { display: inline-flex; }
.avatars .av + .av { margin-left: -7px; }
.avatars.sm .av { width: 20px; height: 20px; font-size: 10px; }
.avatars.sm .av + .av { margin-left: -5px; }
.status { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.dot.live { background: #2BB673; animation: pulse 2.4s infinite; }
.dot.offline { background: var(--warn); }
.dot.demo { background: var(--warn); }
.dot.wait { background: var(--line-strong); animation: blink 1s infinite alternate; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(43, 182, 115, .55); } 70% { box-shadow: 0 0 0 7px rgba(43, 182, 115, 0); } 100% { box-shadow: 0 0 0 0 rgba(43, 182, 115, 0); } }
@keyframes blink { to { opacity: .35; } }

/* ───────── Accueil ───────── */
.home-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 18px) 20px 6px;
}
.brand { display: flex; align-items: center; gap: 10px; font: 800 23px var(--font-display); letter-spacing: -.02em; }
.logo { width: 34px; height: 34px; }
.home { flex: 1; padding: 10px 20px 48px; }
.section-title { font: 700 14px var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 18px 4px 10px; }
.cards { list-style: none; display: grid; gap: 10px; }
.card {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; transition: transform .15s;
}
.card:active { transform: scale(.985); }
.card-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; flex: none; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.card-title { font: 700 18px var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-sub { font-size: 14px; color: var(--muted); }

.hero { padding-top: 6px; }
.hero h1 { font: 800 clamp(30px, 8.5vw, 42px)/1.08 var(--font-display); letter-spacing: -.03em; margin: 26px 0 14px; }
.hero .accent { color: var(--accent); }
.lead { font-size: 18px; color: var(--muted); margin-bottom: 26px; max-width: 30em; }
.hero-art { position: relative; height: 210px; margin: 8px 0 0; }
.bubble {
  position: absolute; display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 12px 16px 12px 12px; min-width: 230px;
}
.bubble small { display: block; font-size: 12px; color: var(--muted); }
.bubble b { font-size: 16px; font-weight: 650; }
.bubble .strike { text-decoration: line-through; color: var(--muted); }
.bubble .av { width: 34px; height: 34px; font-size: 15px; }
.b1 { top: 0; left: 0; transform: rotate(-2deg); animation: float 6s ease-in-out infinite; z-index: 2; }
.b2 { top: 74px; right: 0; transform: rotate(2deg); animation: float 6s ease-in-out -2s infinite; }
.b3 { top: 146px; left: 8%; transform: rotate(-1deg); animation: float 6s ease-in-out -4s infinite; }
.mini-check { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.mini-check .ico { width: 18px; height: 18px; stroke-width: 3; }
.live-tag { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--accent-strong); background: var(--accent-soft); padding: 3px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .04em; }
@keyframes float { 50% { translate: 0 -5px; } }
.perks { list-style: none; display: grid; gap: 16px; margin-top: 30px; }
.perks li { display: flex; gap: 14px; align-items: flex-start; font-size: 15px; color: var(--muted); }
.perks li > span { width: 42px; height: 42px; border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; font-size: 20px; flex: none; }
.perks b { display: block; color: var(--ink); font-size: 16px; }

.demo-banner {
  font-size: 14px; line-height: 1.45; color: var(--ink);
  background: color-mix(in srgb, var(--warn) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  padding: 12px 14px; border-radius: 14px; margin: 6px 0 4px;
}

/* ───────── Barre du haut (liste) ───────── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 6px;
  padding: calc(env(safe-area-inset-top) + 10px) 10px 10px 6px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-color: var(--line); }
.title-wrap { flex: 1; min-width: 0; padding-left: 2px; }
.list-title { font: 750 21px/1.15 var(--font-display); letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ───────── Liste ───────── */
.list-main { flex: 1; padding: 6px 14px 20px; }
.progress { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-top: 4px; }
.progress-text { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; margin-bottom: 9px; }
.progress-text span { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.bar { height: 7px; border-radius: 9px; background: var(--hover); overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #3DBB82); border-radius: 9px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }

.invite-card {
  width: 100%; margin-top: 10px; display: flex; gap: 14px; align-items: center; text-align: left;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent-strong);
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent);
}
.invite-card span { font-size: 14px; color: var(--ink); opacity: .8; }
.invite-card b { display: block; color: var(--accent-strong); font-size: 16px; opacity: 1; }

.group { margin-top: 20px; }
.group-head {
  display: flex; align-items: center; gap: 8px;
  font: 700 13px var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .07em;
  padding: 0 6px 8px;
}
.group-head .emoji { font-size: 16px; letter-spacing: 0; }
.group-head .count { margin-left: auto; font-variant-numeric: tabular-nums; }
.items { list-style: none; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 4px 9px 14px; min-height: 62px; transition: background .2s; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 54px; right: 0; height: 1px; background: var(--line); }
.check {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  border: 2px solid var(--line-strong); color: #fff;
  display: grid; place-items: center;
  transition: background .2s, border-color .2s, transform .15s;
}
.check:active { transform: scale(.85); }
.check .ico { width: 17px; height: 17px; stroke-width: 3; opacity: 0; transform: scale(.4); transition: opacity .2s, transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.item:hover .check { border-color: var(--accent); }
.is-done .check { background: var(--accent); border-color: var(--accent); }
.is-done .check .ico { opacity: 1; transform: none; }
.item-main { flex: 1; min-width: 0; cursor: pointer; padding: 2px 0; user-select: none; }
.item-text { font-size: 17px; font-weight: 550; overflow-wrap: anywhere; transition: color .2s; }
.item-meta { font-size: 13px; color: var(--muted); margin-top: 1px; }
.qty {
  display: inline-block; font-size: 13px; font-weight: 750; line-height: 1.5;
  background: var(--accent-soft); color: var(--accent-strong);
  padding: 0 7px; border-radius: 7px; margin-right: 7px; vertical-align: 1px;
}
.is-done .item-text { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.is-done .qty { background: var(--hover); color: var(--muted); }
.done-group .items { box-shadow: none; background: color-mix(in srgb, var(--surface) 55%, transparent); }
.is-fresh { animation: fresh 1.6s ease-out; }
@keyframes fresh { 0% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }

.empty { text-align: center; padding: 56px 20px 24px; }
.empty-art { width: 92px; height: 92px; margin: 0 auto 18px; border-radius: 30px; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; font-size: 44px; }
.empty h2 { font: 750 22px var(--font-display); margin-bottom: 8px; }
.empty p { color: var(--muted); margin-bottom: 22px; font-size: 16px; }

.skeleton { display: grid; gap: 10px; padding-top: 10px; }
.skeleton div { height: 62px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 30%, var(--hover) 50%, var(--surface) 70%); background-size: 300% 100%; animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ───────── Zone d'ajout ───────── */
.composer {
  position: sticky; bottom: 0; z-index: 10;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 72%, color-mix(in srgb, var(--bg) 0%, transparent));
}
.composer-row {
  display: flex; gap: 8px; align-items: center;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 6px 6px 6px 18px;
  transition: border-color .2s;
}
.composer-row:focus-within { border-color: var(--accent); }
#entry { flex: 1; min-width: 0; height: 46px; border: 0; outline: 0; background: transparent; font-size: 17px; }
#entry::placeholder { color: var(--muted); }
.add-btn { width: 46px; height: 46px; border-radius: 15px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; transition: transform .15s; }
.add-btn:active { transform: scale(.9); }
.add-btn .ico { width: 24px; height: 24px; stroke-width: 2.5; }
.suggest { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 90%, transparent); }
.suggest::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px 0 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: 15px; font-weight: 550; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
}
.chip .ico { width: 15px; height: 15px; color: var(--accent); stroke-width: 2.6; }
.chip:active { background: var(--accent-soft); }

/* ───────── Fenêtres du bas ───────── */
.sheet {
  width: min(620px, 100%); max-width: 100%; max-height: 92dvh;
  margin: auto auto 0; padding: 0; border: 0;
  border-radius: 26px 26px 0 0;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.sheet[open] { animation: sheetUp .32s cubic-bezier(.2, .9, .25, 1); }
.sheet::backdrop { background: rgba(20, 18, 15, .4); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@keyframes sheetUp { from { transform: translateY(40%); opacity: 0; } }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 26px; } }
.sheet-inner { padding: 10px 22px calc(22px + env(safe-area-inset-bottom)); }
.grabber { width: 42px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 16px; opacity: .6; }
.sheet h2 { font: 750 23px/1.2 var(--font-display); letter-spacing: -.015em; margin-bottom: 6px; }
.sheet p { font-size: 15px; }
.welcome-icon { font-size: 40px; margin-bottom: 6px; }
.field { display: block; margin-top: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 7px; }
.field input {
  width: 100%; height: 52px; padding: 0 15px; font-size: 17px;
  border: 1.5px solid var(--line); border-radius: 15px; background: var(--bg); outline: 0;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.sheet-actions { display: flex; gap: 10px; margin-top: 24px; }
.sheet-actions .btn { flex: 1; }
.sheet-actions .danger-ghost { flex: none; }
.cat-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.cat-chip { padding: 8px 12px; border-radius: 12px; background: var(--bg); border: 1.5px solid var(--line); font-size: 14px; font-weight: 550; }
.cat-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.linkbox {
  display: flex; align-items: center; gap: 10px; margin: 18px 0 14px;
  padding: 14px; border-radius: 14px; background: var(--bg); border: 1.5px dashed var(--line-strong);
  font: 14px ui-monospace, Consolas, monospace; color: var(--muted);
}
.linkbox span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbox .ico { color: var(--accent); width: 18px; height: 18px; }
.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-grid .primary, .share-grid [data-s=copy] { grid-column: 1 / -1; }
.share-grid .btn { white-space: nowrap; }
.note { margin-top: 14px; font-size: 13px !important; color: var(--muted); background: color-mix(in srgb, var(--warn) 10%, transparent); padding: 10px 12px; border-radius: 12px; }
.menu { display: grid; margin: 10px -8px 0; }
.menu button { display: flex; align-items: center; gap: 14px; padding: 15px 12px; border-radius: 14px; font-size: 17px; font-weight: 550; text-align: left; }
.menu button:hover, .menu button:active { background: var(--hover); }
.menu button .ico { color: var(--muted); }
.menu small { margin-left: auto; color: var(--muted); font-size: 14px; font-weight: 500; }
.menu .danger, .menu .danger .ico { color: var(--danger); }

/* ───────── Toasts ───────── */
.toasts {
  position: fixed; left: 0; right: 0; z-index: 50; pointer-events: none;
  top: calc(env(safe-area-inset-top) + 72px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px;
}
.toast {
  pointer-events: auto; max-width: 560px;
  display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--bg);
  padding: 13px 16px; border-radius: 16px; box-shadow: var(--shadow-lg);
  font-size: 15px; font-weight: 550;
  animation: toastIn .3s cubic-bezier(.2, .9, .25, 1.2);
}
.toast.out { opacity: 0; transform: translateY(-8px); transition: .25s; }
.toast button { color: var(--accent-bright); font-weight: 750; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .toast button { color: var(--accent); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.96); } }

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