/* =========================================================
   Cadeaux Famille Marsan — thème clair « confettis »
   Crème pêche + corail, touches pastel ; statuts : vert (libre), ambre (réservé), indigo (commandé)
   Toujours clair. Animations désactivées si l'OS le demande.
   ========================================================= */

:root {
  --bg: #fff8f2;
  --bg-2: #ffefe4;
  --surface: #ffffff;
  --surface-2: #fff5ee;
  --text: #2d2433;
  --text-2: #5b5065;
  --muted: #908699;
  --border: #f3e5da;
  --border-strong: #e8d3c3;

  --primary: #ff6b6b;
  --primary-600: #ee4f5d;
  --primary-soft: #ffe7e5;
  --on-primary: #ffffff;
  --grad: linear-gradient(120deg, #ff6b6b 0%, #ff9a6b 45%, #ffcf5c 100%);
  --grad-cool: linear-gradient(120deg, #6c7bff 0%, #a78bfa 100%);

  --libre: #17a383;
  --libre-soft: #dcf6ee;
  --reserve: #e08a00;
  --reserve-soft: #fff0d3;
  --commande: #5a67f2;
  --commande-soft: #e9ebff;
  --danger: #e03e52;

  --av-s: 85%;
  --av-l: 88%;
  --av-fg-l: 32%;

  --radius: 20px;
  --radius-sm: 13px;
  --shadow-sm: 0 1px 2px rgba(120, 60, 40, .06), 0 3px 10px rgba(120, 60, 40, .05);
  --shadow: 0 2px 4px rgba(120, 60, 40, .05), 0 12px 30px -10px rgba(120, 60, 40, .18);
  --shadow-lg: 0 6px 14px rgba(120, 60, 40, .07), 0 26px 50px -18px rgba(150, 70, 50, .32);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.55 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  /* confettis discrets */
  background-image:
    radial-gradient(circle at 12px 14px, rgba(255, 107, 107, .18) 2.5px, transparent 3px),
    radial-gradient(circle at 58px 46px, rgba(90, 103, 242, .14) 2.5px, transparent 3px),
    radial-gradient(circle at 92px 18px, rgba(255, 207, 92, .30) 3px, transparent 3.5px),
    radial-gradient(circle at 34px 84px, rgba(23, 163, 131, .14) 2px, transparent 2.5px);
  background-size: 120px 110px;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: .1em 0 .2em; font-weight: 800; }
h2 { font-size: 1.3rem; margin: 0 0 .3em; font-weight: 700; }
h3 { font-size: 1.02rem; margin: 0; font-weight: 650; }
a { color: var(--primary-600); text-underline-offset: 3px; }
img { max-width: 100%; }
p { margin: .4em 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.big { font-size: 3.2rem; margin: 0; line-height: 1.2; }
.inline { display: inline; margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--primary-soft); }

/* ---------- Décor animé en fond ---------- */
.bg-deco { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-deco span {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(80px); opacity: .4; animation: float 26s ease-in-out infinite alternate;
}
.bg-deco span:nth-child(1) { background: #ffb4bd; top: -18vmax; left: -12vmax; opacity: .55; }
.bg-deco span:nth-child(2) { background: #ffe08a; bottom: -22vmax; right: -14vmax; animation-delay: -9s; opacity: .55; }
.bg-deco span:nth-child(3) { background: #b5d8ff; top: 30%; left: 55%; width: 30vmax; height: 30vmax; animation-delay: -16s; opacity: .45; }
@keyframes float {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(6vmax, 4vmax) scale(1.08); }
  100% { transform: translate(-4vmax, 7vmax) scale(.95); }
}

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, #ffffff 72%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; letter-spacing: -.02em; }
.brand-logo {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: var(--grad); background-size: 200% 200%; box-shadow: var(--shadow-sm); font-size: 1.2rem;
  animation: grad-shift 8s ease infinite;
}
.brand:hover .brand-logo { animation: wiggle .6s var(--spring), grad-shift 8s ease infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg) scale(1.08); } 60% { transform: rotate(10deg); } }
@keyframes grad-shift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a, .nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2); text-decoration: none; padding: 8px 12px; border-radius: 999px;
  font: inherit; font-size: .93rem; font-weight: 550; background: none; border: 0; cursor: pointer;
  transition: background .2s, color .2s;
}
.nav a:hover, .nav-btn:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary-600); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 30%, transparent); }
@media (max-width: 720px) {
  .brand-name, .nav-label { display: none; }
  .nav a, .nav-btn { padding: 8px 11px; font-size: 1.1rem; }
}

.container { max-width: 1180px; margin: 0 auto; padding: 22px 16px 80px; }
body.bare .container { padding-top: 24px; }

/* ---------- Fil d'Ariane ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .88rem; margin-bottom: 14px; animation: fade .4s var(--ease) both; }
.crumbs a { color: var(--muted); text-decoration: none; padding: 2px 8px; border-radius: 8px; transition: background .2s, color .2s; }
.crumbs a:hover { background: var(--surface-2); color: var(--text); }
.crumbs .sep { color: var(--border-strong); }
.crumbs [aria-current] { color: var(--text); font-weight: 600; padding: 2px 8px; }

/* ---------- En-têtes de page ---------- */
.hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  margin: 6px 0 22px; animation: rise .6s var(--ease) both;
}
.hero-public { justify-content: center; text-align: center; }
.eyebrow { margin: 0; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--primary-600); }
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; animation: rise .5s var(--ease) both; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 30px 0 14px; }
.section-head h2 { margin: 0; }
.section-title { margin: 32px 0 14px; }
.list-desc { color: var(--text-2); margin: -8px 0 20px; max-width: 70ch; }

/* ---------- Cartes / grilles ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px;
}
.narrow { max-width: 680px; margin-left: auto; margin-right: auto; }
.empty { text-align: center; padding: 48px 20px; }
.empty h2 { margin-top: 8px; }
.pop { animation: pop .5s var(--ease) both; }
.grid { display: grid; gap: 18px; }
.events-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.kids-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.gifts-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.givers-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (max-width: 400px) { .givers-grid { grid-template-columns: 1fr; } }

.grid > .card, .kpi { animation: rise .55s var(--ease) both; animation-delay: calc(min(var(--i, 0), 12) * 55ms); }
.reveal { animation: rise .4s var(--ease) both !important; animation-delay: calc(min(var(--i, 0), 12) * 40ms) !important; }

a.card { text-decoration: none; color: inherit; transition: transform .35s var(--spring), box-shadow .35s var(--ease), border-color .3s; }
a.card:hover, .gift-card:hover, .giver-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
a.card:active { transform: translateY(-1px) scale(.99); }

.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; padding: 3px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-600); font-weight: 650;
}

/* Événements */
.event-card { display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.event-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--grad); background-size: 200% 100%;
  transform: scaleX(.25); transform-origin: left; transition: transform .6s var(--ease);
}
.event-card:hover::before { transform: scaleX(1); animation: grad-shift 3s ease infinite; }
.event-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.event-card h2 { margin: 2px 0 0; }
.event-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .9rem; color: var(--muted); }
.event-stats strong { color: var(--text); }
.avatars { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.avatars .avatar + .avatar { margin-left: -12px; }
.avatars .muted { margin-left: 6px; }

/* Enfants */
.kid-card { display: flex; flex-direction: column; gap: 14px; }
.kid-head { display: flex; align-items: center; gap: 14px; }
.kid-head h1, .kid-head h2, .kid-head h3 { margin: 0; }
.kid-stats { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; color: var(--muted); }
.kid-stats .dot:not(:first-child) { margin-left: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-libre { background: var(--libre); }
.dot-reserve { background: var(--reserve); }
.dot-commande { background: var(--commande); }
.kid-section { margin-top: 34px; scroll-margin-top: 140px; }
.kid-progress { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.kid-progress .progress { flex: 1; }
.kid-chip {
  display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; white-space: nowrap;
  background: hsl(var(--h) var(--av-s) var(--av-l)); color: hsl(var(--h) 45% var(--av-fg-l));
}

/* Avatars (couleur stable par prénom) */
.avatar {
  --size: 36px;
  display: inline-grid; place-items: center; flex: none;
  width: var(--size); height: var(--size); border-radius: 50%;
  font-size: calc(var(--size) * .38); font-weight: 800; letter-spacing: -.02em;
  background: hsl(var(--h) var(--av-s) var(--av-l)); color: hsl(var(--h) 45% var(--av-fg-l));
  box-shadow: 0 0 0 3px var(--surface);
  transition: transform .3s var(--spring);
}
.avatar-xs { --size: 22px; box-shadow: none; vertical-align: middle; }
.avatar-sm { --size: 26px; box-shadow: none; vertical-align: middle; }
.avatar-lg { --size: 50px; }
.avatar-xl { --size: 72px; }
a.card:hover .avatar { transform: scale(1.08) rotate(-4deg); }

/* Progression */
.progress { position: relative; height: 8px; border-radius: 999px; background: var(--libre-soft); overflow: hidden; }
.progress span { position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 999px; animation: grow 1.1s var(--ease) both .2s; }
.progress-reserve { background: var(--reserve); }
.progress-commande { background: var(--commande); }
@keyframes grow { from { width: 0; } }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--border-strong); }
.kpi-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: .82rem; color: var(--muted); }
.kpi-libre::after { background: var(--libre); }
.kpi-reserve::after { background: var(--reserve); }
.kpi-commande::after { background: var(--commande); }
.kpi-libre .kpi-value { color: var(--libre); }
.kpi-reserve .kpi-value { color: var(--reserve); }
.kpi-commande .kpi-value { color: var(--commande); }

/* ---------- Cadeaux ---------- */
.gift-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; transition: transform .35s var(--spring), box-shadow .35s var(--ease), border-color .3s; }
.gift-media {
  position: relative; aspect-ratio: 4 / 3; background: #fff;
  display: grid; place-items: center; border-bottom: 1px solid var(--border); overflow: hidden;
}
.gift-media img { width: 100%; height: 100%; object-fit: contain; padding: 14px; transition: transform .6s var(--ease); }
.gift-card:hover .gift-media img { transform: scale(1.06); }
.gift-media .placeholder, .gift-media.noimg::after { font-size: 3rem; opacity: .45; }
.gift-media.noimg::after { content: "🎁"; }
.prio {
  position: absolute; top: 10px; right: 10px; font-size: .78rem; letter-spacing: 1px; color: var(--primary);
  background: color-mix(in srgb, var(--surface) 88%, transparent); padding: 1px 8px; border-radius: 999px;
  backdrop-filter: blur(4px);
}
.gift-ribbon { position: absolute; left: 10px; bottom: 10px; right: 10px; display: flex; }
.gift-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.gift-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.price { font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; white-space: nowrap; }
.store { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); }
.store img { border-radius: 4px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: .88rem; margin: 0; }
.gift-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 10px; }
.gift-actions form { margin: 0; }

.gift-card.is-libre { border-top: 3px solid var(--libre); }
.gift-card.is-reserve { border-top: 3px solid var(--reserve); }
.gift-card.is-commande { border-top: 3px solid var(--commande); }
.gift-card.is-reserve .gift-media img, .gift-card.is-commande .gift-media img { filter: saturate(.75); }
.gift-card.flash { animation: rise .5s var(--ease) both, flash 1.6s ease .3s 2; }
@keyframes flash { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 45%, transparent), var(--shadow-lg); } }

/* Badges de statut */
.status {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1px solid transparent;
}
.gift-ribbon .status { box-shadow: var(--shadow-sm); animation: pop .4s var(--spring) both .25s; }
.status-libre { background: var(--libre-soft); color: var(--libre); border-color: color-mix(in srgb, var(--libre) 25%, transparent); }
.status-reserve { background: var(--reserve-soft); color: var(--reserve); border-color: color-mix(in srgb, var(--reserve) 30%, transparent); }
.status-commande { background: var(--commande-soft); color: var(--commande); border-color: color-mix(in srgb, var(--commande) 30%, transparent); }

/* Filtres / onglets */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 18px; }
.sticky-tabs {
  position: sticky; top: 64px; z-index: 20; padding: 8px 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: inherit; font-size: .88rem; font-weight: 600; text-decoration: none; color: var(--text-2);
  padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  transition: all .25s var(--ease);
}
.chip b { font-weight: 700; font-size: .78rem; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 6px 16px -8px var(--primary); }
.chip.active b { background: color-mix(in srgb, var(--bg) 20%, transparent); color: inherit; }
.chip-libre.active { background: var(--libre); border-color: var(--libre); color: #fff; }
.chip-reserve.active { background: var(--reserve); border-color: var(--reserve); color: #fff; }
.chip-commande.active { background: var(--commande); border-color: var(--commande); color: #fff; }

/* Panneau « Qui offre ? » et « Je l'offre » */
.assign, .reserve { width: 100%; }
.assign summary, .reserve summary { list-style: none; }
.assign summary::-webkit-details-marker, .reserve summary::-webkit-details-marker { display: none; }
.reserve[open] summary { display: none; }
.assign-form, .reserve-form {
  display: flex; flex-direction: column; gap: 10px; margin-top: 10px; padding: 12px;
  background: var(--surface-2); border-radius: var(--radius-sm); animation: drop .3s var(--ease) both;
}
.assign-form label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 650; }
.reserve-form { flex-direction: row; flex-wrap: wrap; align-items: center; }
.reserve-form input[type=text] { flex: 1 1 140px; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* Contrôle segmenté (statut) */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; text-align: center; padding: 6px 4px; border-radius: 9px; font-size: .78rem; font-weight: 650; color: var(--muted); transition: all .25s var(--ease); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); }
.seg-libre input:checked + span { background: var(--libre-soft); color: var(--libre); }
.seg-reserve input:checked + span { background: var(--reserve-soft); color: var(--reserve); }
.seg-commande input:checked + span { background: var(--commande-soft); color: var(--commande); }

/* ---------- Récap ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.matrix { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .92rem; }
.matrix th, .matrix td { padding: 12px 16px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.matrix th:first-child { text-align: left; }
.matrix thead th { background: var(--surface-2); font-size: .82rem; color: var(--text-2); font-weight: 700; }
.matrix tbody tr { transition: background .2s; }
.matrix tbody tr:hover { background: var(--surface-2); }
.matrix td.zero { color: var(--border-strong); }
.matrix .total { font-weight: 800; background: color-mix(in srgb, var(--primary-soft) 60%, transparent); }
.matrix tfoot th, .matrix tfoot td { font-weight: 800; border-bottom: 0; background: var(--surface-2); }

.giver-card { display: flex; flex-direction: column; gap: 12px; transition: transform .35s var(--spring), box-shadow .35s var(--ease); }
.giver-head { display: flex; align-items: center; gap: 12px; }
.giver-head > div { flex: 1; min-width: 0; }
.giver-total { font-size: 1.35rem; font-weight: 800; letter-spacing: -.03em; color: hsl(var(--h) 55% 45%); }
.bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; width: var(--w); border-radius: inherit; background: hsl(var(--h) 65% 60%); animation: grow 1.2s var(--ease) both .3s; }
.giver-gifts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.giver-gifts li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--border); font-size: .9rem; }
.giver-gifts li:first-child { border-top: 0; }
.giver-gift-title { min-width: 0; display: flex; align-items: center; gap: 6px; }
.giver-gift-title a { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.giver-gift-title a:hover { color: var(--primary-600); text-decoration: underline; }
.giver-gift-meta { display: flex; align-items: center; gap: 8px; flex: none; }

/* Page publique */
.howto { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; margin: -6px 0 22px; font-size: .9rem; color: var(--text-2); }
.howto b { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 4px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: .75rem; }
.mine { margin-bottom: 20px; border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.mine summary { cursor: pointer; list-style: none; }
.mine summary::-webkit-details-marker { display: none; }
.mine .giver-gifts { margin-top: 10px; }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 650; font-size: .92rem; }
.form label small { font-weight: 400; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], select, textarea {
  width: 100%; font: inherit; font-weight: 400; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 13px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}
textarea { resize: vertical; }
textarea.code { font: .8rem/1.4 ui-monospace, Consolas, monospace; }
select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
label.check { flex-direction: row !important; align-items: center; gap: 8px; font-weight: 500 !important; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); }

/* Interrupteur */
.switch { flex-direction: row !important; align-items: center; gap: 12px !important; font-weight: 550 !important; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .3s var(--ease); }
.switch-ui::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .35s var(--spring);
}
.switch input:checked + .switch-ui { background: var(--primary); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: 2px; }

.input-btn { display: flex; gap: 8px; }
.input-btn input { flex: 1; min-width: 0; }

.preview { display: grid; grid-template-columns: 130px 1fr; gap: 16px; align-items: start; }
.preview-img {
  width: 130px; height: 130px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); background: #fff;
  display: grid; place-items: center; overflow: hidden; font-size: 2.6rem;
}
.preview-img img { width: 100%; height: 100%; object-fit: contain; padding: 6px; animation: pop .4s var(--spring) both; }
.preview-fields { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 560px) {
  .preview { grid-template-columns: 1fr; }
  .preview-img { width: 100%; height: 190px; }
}

.analyse-status { font-size: .9rem; padding: 10px 14px; border-radius: var(--radius-sm); animation: drop .3s var(--ease) both; }
.analyse-status:empty { display: none; }
.as-loading {
  color: var(--muted); background: linear-gradient(90deg, var(--surface-2) 25%, var(--bg-2) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}
.as-ok { background: var(--libre-soft); color: var(--libre); }
.as-warn { background: var(--reserve-soft); color: var(--reserve); }
.as-error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.analyse-status a { color: inherit; font-weight: 700; }
@keyframes shimmer { to { background-position: -200% 0; } }

.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Boutons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 650; font-size: .93rem; text-decoration: none; white-space: nowrap; line-height: 1.2;
  padding: 10px 17px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  transition: transform .2s var(--spring), background .2s, border-color .2s, box-shadow .2s, color .2s;
}
.btn:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }
.btn-primary {
  background: var(--grad); background-size: 180% 100%; background-position: 0% 50%;
  border-color: transparent; color: #fff; box-shadow: 0 6px 18px -8px var(--primary);
  transition: transform .2s var(--spring), background-position .5s var(--ease), box-shadow .25s;
}
.btn-primary:hover { background-position: 100% 50%; border-color: transparent; box-shadow: 0 10px 24px -8px var(--primary); }
.btn-accent { background: var(--grad-cool); background-size: 180% 100%; color: #fff; border-color: transparent; box-shadow: 0 6px 18px -8px #6c7bff; }
.btn-accent:hover { border-color: transparent; background-position: 100% 50%; box-shadow: 0 10px 24px -8px #6c7bff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); }
.btn-commande { background: var(--commande-soft); color: var(--commande); border-color: color-mix(in srgb, var(--commande) 30%, transparent); }
.btn-sm { padding: 6px 11px; font-size: .84rem; border-radius: 10px; }
.btn-lg { padding: 13px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-back { width: 44px; height: 44px; padding: 0; font-size: 1.25rem; border-radius: 50%; background: var(--surface); border-color: var(--border); }
.btn.is-done { background: var(--libre); border-color: var(--libre); color: #fff; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; animation: spin .7s linear infinite;
}
.btn-primary.is-loading::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.bookmarklet { font-size: 1.1rem; padding: 14px 26px; cursor: grab; animation: bounce 2.4s var(--ease) infinite; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); } 88% { transform: translateY(-6px); } 94% { transform: translateY(0); } }

kbd { border: 1px solid var(--border-strong); border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; font-size: .85em; background: var(--surface-2); }

/* ---------- Alertes & notifications ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; animation: drop .35s var(--ease) both; }
.alert-success { background: var(--libre-soft); border-color: color-mix(in srgb, var(--libre) 30%, transparent); }
.alert-error { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.alert-info { background: var(--commande-soft); border-color: color-mix(in srgb, var(--commande) 25%, transparent); }

.toasts { position: fixed; top: 76px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  padding: 13px 18px 13px 44px; border-radius: 14px; cursor: pointer; position: relative;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: .93rem; font-weight: 550;
  animation: toast-in .5s var(--spring) both;
}
.toast::before { position: absolute; left: 15px; top: 12px; font-size: 1.05rem; }
.toast-success::before { content: "✅"; }
.toast-error::before { content: "⚠️"; }
.toast-info::before { content: "💡"; }
.toast-success { border-left: 4px solid var(--libre); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--commande); }
.toast.out { animation: toast-out .4s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }

/* ---------- Partage du lien ---------- */
.share { margin-top: 30px; }
.share-row { display: flex; flex-direction: column; gap: 10px; }
.share-row p { margin: 2px 0 0; }
.copy { display: flex; gap: 8px; flex-wrap: wrap; }
.copy input { flex: 1 1 260px; font-size: .88rem; background: var(--surface-2); }

/* Liens par enfant */
.share h2 { margin-bottom: 4px; }
.share-top { margin: -6px 0 22px; padding: 16px 20px; }
.share-top .share-row { gap: 8px; }
.share-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.share-item {
  display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2);
  animation: rise .45s var(--ease) both;
}
.share-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.share-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .share-item { grid-template-columns: 1fr; } }
.share-all { margin-top: 16px; font-size: .9rem; color: var(--text-2); }
.share-all summary { cursor: pointer; width: fit-content; }
.share-all .copy { margin-top: 10px; }
.public-kid { display: flex; justify-content: center; margin: 10px 0 4px; }
.public-kid .avatar { animation: pop .6s var(--spring) both .1s; box-shadow: 0 0 0 5px #fff, var(--shadow); }

/* ---------- Connexion / inscription « wow » ---------- */
body.bare:has(.auth-wow) .container { max-width: none; padding: 0; }
body:has(.auth-wow) .bg-deco { display: none; }
.auth-wow { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); min-height: 100vh; }
.auth-scene, .auth-panel { min-width: 0; }

/* Scène de gauche : dégradé vivant, cadeaux flottants, confettis */
.auth-scene {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; padding: 56px clamp(28px, 6vw, 88px);
  color: #fff;
  background:
    radial-gradient(60% 60% at 15% 20%, #ff9a6b 0%, transparent 60%),
    radial-gradient(55% 55% at 85% 15%, #ffcf5c 0%, transparent 60%),
    radial-gradient(70% 70% at 80% 90%, #a78bfa 0%, transparent 60%),
    radial-gradient(60% 60% at 10% 95%, #6c7bff 0%, transparent 60%),
    #ff6b6b;
  background-size: 160% 160%;
  animation: mesh 18s ease-in-out infinite alternate;
}
@keyframes mesh {
  0%   { background-position: 0% 0%; }
  50%  { background-position: 60% 40%; }
  100% { background-position: 100% 100%; }
}
.auth-scene::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(circle at 50% 120%, rgba(255, 255, 255, .25), transparent 55%);
}

.confetti { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.confetti i {
  position: absolute; top: -20px; left: var(--x); width: var(--w); height: calc(var(--w) * .45);
  background: var(--c); border-radius: 2px; opacity: .9;
  animation: fall var(--d) linear infinite; animation-delay: var(--delay);
}
.confetti i:nth-child(3n) { border-radius: 50%; height: var(--w); }
@keyframes fall {
  0%   { transform: translate3d(0, -5vh, 0) rotate(var(--r)); }
  50%  { transform: translate3d(28px, 50vh, 0) rotate(calc(var(--r) + 360deg)); }
  100% { transform: translate3d(-12px, 108vh, 0) rotate(calc(var(--r) + 720deg)); }
}

.floaters { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.floaters span {
  position: absolute; left: var(--x); top: var(--y); font-size: var(--s);
  filter: drop-shadow(0 10px 18px rgba(80, 20, 40, .25));
  animation: bob var(--t) ease-in-out infinite; animation-delay: var(--delay);
  opacity: .9;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50%      { transform: translateY(-18px) rotate(6deg); }
}

.auth-pitch { position: relative; max-width: 520px; animation: rise .8s var(--ease) both .1s; }
.auth-badge {
  width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; font-size: 2.3rem;
  background: rgba(255, 255, 255, .22); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), 0 12px 30px -10px rgba(80, 20, 40, .4);
  animation: wiggle 2.8s var(--spring) infinite 1s;
}
.auth-pitch h1 {
  font-size: clamp(2.4rem, 5.2vw, 4.2rem); line-height: 1.02; margin: 26px 0 16px; font-weight: 900; letter-spacing: -.04em;
  text-shadow: 0 6px 30px rgba(120, 30, 60, .25);
}
.auth-pitch h1 span {
  background: linear-gradient(90deg, #fff 0%, #fff4c2 40%, #fff 80%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 4s linear infinite;
}
@keyframes sheen { to { background-position: -200% 0; } }
.auth-pitch > p { font-size: 1.1rem; line-height: 1.6; opacity: .95; max-width: 44ch; margin: 0 0 22px; }
.auth-perks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.auth-perks li {
  display: flex; align-items: center; gap: 12px; width: fit-content;
  padding: 9px 16px 9px 9px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  background: rgba(255, 255, 255, .18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
  animation: rise .6s var(--ease) both;
}
.auth-perks li:nth-child(1) { animation-delay: .35s; }
.auth-perks li:nth-child(2) { animation-delay: .5s; }
.auth-perks li:nth-child(3) { animation-delay: .65s; }
.auth-perks b { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; font-size: 1rem; }

/* Panneau de droite : carte formulaire */
.auth-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 40px 24px; position: relative; isolation: isolate;
}
.auth-panel::before {
  content: ""; position: absolute; width: 420px; height: 420px; max-width: 100%; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(255, 107, 107, .22), transparent 65%);
  animation: float 14s ease-in-out infinite alternate;
}
.auth-card {
  width: 100%; max-width: 420px; padding: 38px 34px 30px;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .9); border-radius: 28px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, var(--shadow-lg);
  animation: card-in .8s var(--spring) both .15s;
}
@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(.96); } }
.auth-head h2 { font-size: 1.85rem; margin: 0 0 4px; font-weight: 850; }
.auth-head p { margin: 0 0 22px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }

/* Champs à libellé flottant */
.field { position: relative; }
.field input {
  width: 100%; height: 58px; padding: 22px 46px 6px 46px; font-size: 1rem;
  border: 1.5px solid var(--border); border-radius: 16px; background: var(--surface);
  transition: border-color .25s, box-shadow .25s, transform .25s var(--spring);
}
.field input:focus { transform: translateY(-1px); }
.field label {
  position: absolute; left: 46px; top: 50%; transform: translateY(-50%); transform-origin: left center;
  color: var(--muted); font-size: 1rem; pointer-events: none;
  transition: transform .25s var(--ease), color .25s, top .25s var(--ease);
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label { top: 17px; transform: translateY(-50%) scale(.78); color: var(--primary-600); font-weight: 650; }
.field-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 1.05rem; opacity: .75; transition: transform .3s var(--spring); }
.field input:focus ~ .field-icon { transform: translateY(-50%) scale(1.18) rotate(-8deg); opacity: 1; }
.field-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; font-size: 1.05rem;
  transition: background .2s;
}
.field-eye:hover { background: var(--surface-2); }

/* Bouton avec reflet qui passe */
.btn-shine { overflow: hidden; margin-top: 6px; height: 54px; font-size: 1.05rem; border-radius: 16px; }
.btn-shine span { display: inline-block; transition: transform .3s var(--spring); }
.btn-shine:hover span { transform: translateX(5px); }
.btn-shine::before {
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-20deg); animation: shine 3.2s ease-in-out infinite 1.2s;
}
@keyframes shine { 0% { left: -60%; } 35%, 100% { left: 130%; } }

.auth-switch { text-align: center; margin: 18px 0 0; color: var(--muted); font-size: .93rem; }
.auth-switch a { font-weight: 700; }
.auth-foot { font-size: .85rem; color: var(--muted); margin: 0; }

.shake { animation: shake .5s var(--ease) both; }
@keyframes shake {
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

@media (max-width: 900px) {
  .auth-wow { grid-template-columns: minmax(0, 1fr); }
  .auth-scene { padding: 40px 24px 70px; }
  .auth-pitch h1 { margin: 16px 0 10px; }
  .auth-perks { display: none; }
  .auth-panel { margin-top: -50px; padding-top: 0; }
  .floaters span { opacity: .45; }
  .floaters span:nth-child(n+4) { display: none; }
}
@media (max-width: 480px) {
  .auth-pitch > p { font-size: 1rem; }
  .auth-card { padding: 28px 20px 24px; border-radius: 24px; }
}

/* ---------- Zone avancée ---------- */
.danger-zone { margin-top: 36px; color: var(--muted); }
.danger-zone summary { cursor: pointer; font-size: .9rem; width: fit-content; }
.danger-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.danger-actions form, .danger-zone-inline form { margin: 0; }
.danger-zone-inline { margin-top: 40px; display: flex; justify-content: center; }

/* ---------- Animations génériques ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
@keyframes fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .bg-deco { display: none; }
}

/* ---------- Impression (récap) ---------- */
@media print {
  .topbar, .bg-deco, .toasts, .crumbs, .filters, .btn, .head-actions, .danger-zone { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .kpi { box-shadow: none; break-inside: avoid; animation: none !important; }
  .grid > .card { animation: none !important; }
}

/* ---------- Connexion Google ---------- */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  height: 54px; border-radius: 16px; text-decoration: none;
  background: #fff; color: #1f1f1f; border: 1.5px solid #dadce0;
  font-weight: 650; font-size: 1rem; font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--spring), box-shadow .25s, border-color .2s, background .2s;
}
.btn-google:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c4c7c5; background: #f8faff; }
.btn-google:active { transform: translateY(0) scale(.98); }
.btn-google .g-logo { transition: transform .5s var(--spring); }
.btn-google:hover .g-logo { transform: rotate(360deg); }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: .85rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border-strong); }
.google-card { margin-top: 18px; }
.google-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.google-row > div { flex: 1; min-width: 200px; }
.google-row p { margin: 2px 0 0; }

/* ---------- Pied de page ---------- */
.site-footer {
  max-width: 1180px; margin: 0 auto; padding: 22px 16px 34px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px 18px; flex-wrap: wrap;
  color: var(--muted); font-size: .86rem; border-top: 1px solid var(--border);
}
.site-footer nav, .auth-legal { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.site-footer a, .auth-legal a { color: var(--muted); text-decoration: none; }
.site-footer a:hover, .auth-legal a:hover { color: var(--primary-600); text-decoration: underline; }
.auth-legal { justify-content: center; font-size: .82rem; color: var(--muted); }

/* ---------- Pages légales ---------- */
.legal { max-width: 760px; margin: 0 auto; animation: rise .5s var(--ease) both; }
.legal-head { margin-bottom: 20px; }
.legal-summary { margin-bottom: 26px; background: linear-gradient(135deg, var(--primary-soft), var(--surface) 70%); }
.legal-summary ul { margin: 8px 0 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.legal section { margin-bottom: 26px; }
.legal h2 { font-size: 1.2rem; margin-bottom: 8px; }
.legal h3 { font-size: 1rem; margin: 14px 0 6px; color: var(--text-2); }
.legal p, .legal li { color: var(--text-2); line-height: 1.65; }
.legal ul { padding-left: 1.2em; }
.legal li { margin: 4px 0; }
.legal code { font-size: .85em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: .9rem; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; }
.legal-table th, .legal-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.legal-table th { background: var(--surface-2); font-size: .82rem; }
.legal-links { margin-top: 30px; font-weight: 650; }

/* ---------- Suppression du compte ---------- */
.delete-card { margin-top: 18px; border-color: color-mix(in srgb, var(--danger) 25%, var(--border)); }
.delete-card summary { cursor: pointer; list-style: none; }
.delete-card summary::-webkit-details-marker { display: none; }
.delete-card[open] summary { margin-bottom: 14px; }
.btn.btn-danger:not(.btn-ghost):not(.btn-sm) { background: var(--danger); border-color: var(--danger); color: #fff; }

/* =========================================================
   Responsive : tablette & téléphone
   ========================================================= */
.grid > * { min-width: 0; }                    /* une carte ne peut jamais élargir la grille */

/* Tableau croisé : 1re colonne fixe pendant le défilement horizontal */
.matrix th[scope="row"], .matrix thead th:first-child {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
  box-shadow: 1px 0 0 var(--border);
}
.matrix thead th:first-child, .matrix tfoot th { background: var(--surface-2); }
.table-scroll { -webkit-overflow-scrolling: touch; scrollbar-width: thin; }

@media (max-width: 720px) {
  /* Barre de navigation en bas, façon application */
  body:has(.nav) { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  /* le flou crée un « conteneur » pour position:fixed : on le retire pour que la barre du bas soit bien en bas */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(255, 252, 249, .96); }
  .topbar-inner { padding: 8px 16px; }
  .brand-name { display: inline; font-size: .98rem; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, #ffffff 90%, transparent);
    backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
    border-top: 1px solid var(--border); box-shadow: 0 -6px 24px -12px rgba(120, 60, 40, .25);
  }
  .nav form { display: contents; }
  .nav a, .nav-btn {
    flex-direction: column; justify-content: center; gap: 2px; height: 56px; padding: 4px 2px;
    border-radius: 14px; font-size: 1.25rem; box-shadow: none !important;
  }
  .nav .nav-label { display: block; font-size: .68rem; font-weight: 650; letter-spacing: .01em; }
  .nav a.active { background: var(--primary-soft); }
  .nav a.active .nav-label { color: var(--primary-600); }
  .nav a:active, .nav-btn:active { transform: scale(.94); }
  .toasts { top: 64px; }

  /* Fil d'Ariane sur une ligne, défilable */
  .crumbs { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .crumbs::-webkit-scrollbar { display: none; }

  .container { padding-top: 16px; padding-bottom: 40px; }
  .hero { margin-bottom: 18px; gap: 14px; }
  .hero .head-actions, .section-head .btn { width: 100%; }
  .hero .head-actions .btn { flex: 1; }
  .section-head .btn { justify-content: center; }
  .card { padding: 18px; }
  .site-footer { padding-bottom: 20px; }
}

@media (max-width: 560px) {
  h1 { font-size: 1.65rem; }
  .avatar-xl { --size: 58px; }

  /* Formulaires : boutons empilés, pleine largeur, principal en premier */
  .actions { flex-direction: column-reverse; align-items: stretch; }
  .actions .btn { width: 100%; padding-top: 13px; padding-bottom: 13px; }
  .btn-sm { min-height: 38px; }
  .preview-img { height: 130px; }
  .preview-img:has(img) { height: 200px; }

  /* Cadeaux : image moins haute */
  .gift-media { aspect-ratio: 16 / 10; }
  .gifts-grid, .kids-grid, .events-grid, .givers-grid { gap: 14px; }

  /* Chiffres clés : la case seule prend toute la ligne */
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi-value { font-size: 1.35rem; }

  .matrix th, .matrix td { padding: 10px 12px; font-size: .86rem; }
  .giver-total { font-size: 1.15rem; }
  .giver-gifts li { flex-wrap: wrap; }
  .giver-gift-meta { margin-left: auto; }

  .share-item .copy { flex-wrap: wrap; }
  .copy input { flex-basis: 100%; }
  .filters { gap: 6px; }
  .chip { padding: 6px 12px; }
  .howto { flex-direction: column; align-items: center; gap: 6px; }
}

/* Titres de cadeaux très longs : 3 lignes max */
.gift-body h3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Lien « Mon compte » = avatar + prénom nom */
.nav-user .nav-label { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-avatar { box-shadow: 0 0 0 2px #fff; }
@media (max-width: 720px) {
  .nav-user .nav-label { max-width: 100%; }
  .nav-user .avatar-xs { --size: 24px; font-size: .62rem; }
}

/* =========================================================
   v5 : cadeau commun, co-gestion, rappels, déjà offerts
   ========================================================= */
.gift-ribbon { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; }
.status-commun { background: #f1ecff; color: #7a5af8; border-color: color-mix(in srgb, #7a5af8 30%, transparent); }
.status-offert { background: linear-gradient(120deg, #fff4c2, #ffe0d6); color: #b35400; border-color: #ffd28a; }
.gift-card.is-commun:not(.is-libre) { border-top-color: #7a5af8; }
.gift-card.is-offert { border-top: 3px solid #f2b84b; }

/* Jauge d'un cadeau commun */
.cagnotte { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.cagnotte .bar { flex: 1; height: 8px; background: #f1ecff; }
.cagnotte .bar span { background: linear-gradient(90deg, #a78bfa, #7a5af8); }

/* Participants (carte cadeau) */
.participants { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.participants li { display: flex; align-items: center; gap: 6px; font-size: .86rem; }
.participants .p-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.participants strong { font-variant-numeric: tabular-nums; }

/* Panneau propriétaire : gestion des participants */
.part-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.part-who { flex: 1 1 100%; display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.part-edit { display: flex; gap: 6px; flex: 1; min-width: 0; }
.part-edit input { width: 90px; flex: none; padding: 6px 8px; font-size: .88rem; }
.part-edit select { flex: 1; min-width: 0; padding: 6px 30px 6px 8px; font-size: .85rem; background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%; }
.part-add { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.part-add .row { gap: 8px; }
.part-add input, .part-add select { padding: 8px 10px; font-size: .9rem; }
.assign-form form { margin: 0; }
.mon-montant { display: flex; align-items: flex-end; gap: 6px; width: 100%; }
.mon-montant label { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.mon-montant input { padding: 6px 10px; }
.reserve-form { flex-direction: column; align-items: stretch; }
.reserve-form .check { font-weight: 500; }

/* Outils de l'événement */
.tools-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-top: 22px; }
.tool-card h2 { font-size: 1.1rem; }
.tool-card p { margin: 6px 0 12px; }
.members { list-style: none; margin: 8px 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.members li { display: flex; align-items: center; gap: 10px; }
.members .m-nom { flex: 1; min-width: 0; }
.members form { margin: 0; }
.invite-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius-sm); background: var(--primary-soft); }
.invite-box .copy input { background: #fff; }
.shared-badge { display: inline-flex; width: fit-content; font-size: .78rem; font-weight: 650; padding: 2px 10px; border-radius: 999px; background: #f1ecff; color: #7a5af8; }
.event-card.is-archive { opacity: .8; filter: saturate(.7); }
.event-card.is-archive:hover { opacity: 1; filter: none; }
.cloture-banner a { font-weight: 700; }
.invite-card { padding: 34px 26px; }
.invite-card .actions { flex-direction: row; }

/* Déjà offerts */
.deja { margin: 0 0 20px; }
.deja summary { cursor: pointer; list-style: none; }
.deja summary::-webkit-details-marker { display: none; }
.deja-list { margin: 12px 0; padding-left: 1.1em; columns: 2 260px; }
.deja-list li { margin: 3px 0; break-inside: avoid; }
.commun-tag { font-size: .72rem; font-weight: 700; color: #7a5af8; background: #f1ecff; padding: 1px 6px; border-radius: 999px; flex: none; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px dashed var(--border-strong); display: flex; flex-direction: column; gap: 18px; }
.timeline-item { position: relative; animation: rise .5s var(--ease) both; }
.timeline-item::before { content: ""; position: absolute; left: -26px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.timeline-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.timeline-head a { color: var(--text); text-decoration: none; }
.histo-gifts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.histo-gift { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); min-width: 0; }
.histo-img { flex: none; width: 56px; height: 56px; border-radius: 10px; background: #fff; display: grid; place-items: center; overflow: hidden; font-size: 1.6rem; border: 1px solid var(--border); }
.histo-img img { width: 100%; height: 100%; object-fit: contain; }
.histo-info { display: flex; flex-direction: column; min-width: 0; }
.histo-info > a, .histo-info > span:first-child { font-weight: 650; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) {
  .tools-grid { grid-template-columns: 1fr; }
  .invite-card .actions { flex-direction: column-reverse; }
  .nav .nav-label { font-size: .62rem; }
}

/* ===== Administration ===== */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0 16px; }
.admin-tabs .chip { text-decoration: none; }
.admin-mdp { border: 2px dashed var(--primary); margin-bottom: 16px; }
.admin-mdp h2 { font-size: 1.1rem; margin: 0 0 4px; }
.admin-mdp .copy input { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; letter-spacing: .06em; }
.admin-new { margin-bottom: 16px; }
.admin-new > summary { list-style: none; display: inline-flex; }
.admin-new > summary::-webkit-details-marker, .admin-edit > summary::-webkit-details-marker { display: none; }
.admin-new[open] > summary { margin-bottom: 14px; }
.admin-form { max-width: 520px; }
.admin-users { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.admin-user { animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.admin-user.is-off { opacity: .7; background: var(--surface-2); }
.admin-user-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-user-id { display: flex; flex-direction: column; min-width: 0; flex: 1 1 180px; }
.admin-user-id .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-admin { background: #ece8ff; color: #5b3fd6; }
.tag-off { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.admin-meta { margin: 8px 0 6px; }
.admin-edit > summary { list-style: none; display: inline-flex; }
.admin-edit[open] > summary { margin-bottom: 12px; }
.admin-edit .danger-actions { padding-top: 12px; border-top: 1px dashed var(--border); }
.admin-family { margin-top: 26px; }
.admin-family-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 1.15rem; margin: 0 0 12px; }
.admin-events { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.admin-event header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-event > p { margin: 4px 0 6px; }
.admin-event .avatar-xs { --size: 24px; font-size: .62rem; }
.admin-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.admin-inline select { flex: 1 1 170px; width: auto; padding-top: 8px; padding-bottom: 8px; font-size: .9rem; }
.admin-inline label.check { flex-basis: 100%; }
.admin-link { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); margin-bottom: 16px; transition: transform .2s var(--ease), box-shadow .2s; }
.admin-link:hover { transform: translateY(-2px); }
.admin-link > span:nth-child(2) { flex: 1; }
.admin-link-icon { font-size: 1.6rem; }
@media (max-width: 720px) {
  .nav .nav-admin { display: none; } /* sur mobile : accès via « Mon compte » (la barre du bas reste à 5 entrées) */
  .admin-events { grid-template-columns: 1fr; }
}
