/* Nofa Stars — blanc cassé, vert sauge, touches de terracotta */
:root {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-2: #F3EFE7;
  --ink: #2B2A27;
  --ink-2: #6B675F;
  --line: #E7E1D6;
  --sage: #7E9A82;
  --sage-dark: #4F6B55;
  --sage-soft: #E4ECE3;
  --terra: #C2653F;
  --terra-soft: #F6E3D8;
  --gold: #D9A441;
  --red: #B54A3C;
  --red-soft: #F5DEDA;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(43, 42, 39, .04), 0 6px 20px rgba(43, 42, 39, .05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--sage-dark); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
code { background: var(--surface-2); padding: .1em .4em; border-radius: 6px; font-size: .9em; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.center { text-align: center; }
.spacer { flex: 1; }
.pos { color: var(--sage-dark); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
.accent { color: var(--terra); }

/* ---- Barre du haut ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1.25rem; background: rgba(250, 247, 242, .92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand-star { color: var(--terra); }
.nav { display: flex; gap: .2rem; flex-wrap: wrap; flex: 1; }
.nav a { padding: .4rem .75rem; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-size: .92rem; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--sage-soft); color: var(--sage-dark); font-weight: 600; }
.who { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.who a { color: var(--ink); text-decoration: none; font-weight: 600; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 6rem; }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }

/* ---- Cartes et grilles ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.highlight { border-color: var(--gold); background: #FFFBF1; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + * { margin-top: 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin: 0; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---- KPI ---- */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: .25rem; box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.kpi-link:hover { border-color: var(--sage); }
.kpi-label { font-size: .8rem; color: var(--ink-2); }
.kpi-value { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.kpi-value small { font-size: .55em; color: var(--ink-2); font-weight: 400; }
.bump { animation: bump .7s ease; }
@keyframes bump { 0% { color: var(--terra); transform: scale(1.06); } 100% { color: inherit; transform: none; } }

/* ---- Tableaux ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: .65rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-weight: 600; color: var(--ink-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table a { text-decoration: none; }
.team-table .score-cell { min-width: 150px; }
.team-table .score-cell .bar { margin-top: .3rem; }
.row-flash { animation: rowflash 1.6s ease; }
@keyframes rowflash { 0% { background: var(--terra-soft); } 100% { background: transparent; } }
tr.is-off, .is-off { opacity: .55; }

/* ---- Barres de progression ---- */
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sage), var(--sage-dark)); border-radius: 99px; transition: width .7s cubic-bezier(.2, .8, .2, 1); }
.big-bar { height: 12px; margin: .5rem 0 1rem; }
.bar > span.reached { background: linear-gradient(90deg, var(--gold), var(--terra)); }
.crit-row { margin-bottom: .9rem; }
.crit-head { display: flex; justify-content: space-between; gap: .5rem; font-size: .93rem; margin-bottom: .25rem; }

/* largeurs serveur (pas d'attribut style à cause de la CSP) */
.w-0 { width: 0 !important; } .w-5 { width: 5% !important; } .w-10 { width: 10% !important; } .w-15 { width: 15% !important; }
.w-20 { width: 20% !important; } .w-25 { width: 25% !important; } .w-30 { width: 30% !important; } .w-35 { width: 35% !important; }
.w-40 { width: 40% !important; } .w-45 { width: 45% !important; } .w-50 { width: 50% !important; } .w-55 { width: 55% !important; }
.w-60 { width: 60% !important; } .w-65 { width: 65% !important; } .w-70 { width: 70% !important; } .w-75 { width: 75% !important; }
.w-80 { width: 80% !important; } .w-85 { width: 85% !important; } .w-90 { width: 90% !important; } .w-95 { width: 95% !important; }
.w-100 { width: 100% !important; }

/* ---- Badges et statuts ---- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.st-soumis.badge, .badge.st-soumis { background: var(--terra-soft); color: var(--terra); }
.badge.st-valide { background: var(--sage-soft); color: var(--sage-dark); }
.badge.st-conteste { background: #FBEFD6; color: #9A6B12; }
.badge.st-annule { background: var(--surface-2); color: var(--ink-2); text-decoration: line-through; }
.status { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.status.s-ok { color: var(--sage-dark); }
.status.s-ok::before { content: "★ "; color: var(--gold); }
.status.s-progress { color: var(--ink); }
.status.s-partial { color: var(--terra); }
.status.s-none { color: var(--ink-2); font-weight: 400; }
.note { display: inline-block; padding: .15rem .55rem; border-radius: 8px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.note.n0 { background: var(--red-soft); color: var(--red); }
.note.n1 { background: var(--terra-soft); color: var(--terra); }
.note.n2 { background: var(--surface-2); color: var(--ink); }
.note.n3 { background: var(--sage-soft); color: var(--sage-dark); }
.note.n4 { background: #EAF0D5; color: #55702A; }

.live { color: var(--sage); font-size: .85rem; }
.live.off { color: var(--terra); }

/* ---- Formulaires ---- */
.form label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; font-weight: 600; color: var(--ink-2); margin-bottom: .85rem; }
.form label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; color: var(--ink); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .6rem .75rem; min-height: 44px; width: 100%;
}
.filters select, .filters input { width: auto; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--sage-dark); }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sage); outline-offset: 1px; border-color: var(--sage); }
.row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .75rem; }
.row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; align-items: end; }
.span-2 { grid-column: span 2; }
.form-end { padding-bottom: .85rem; }
.form-row { display: flex; align-items: center; gap: 1rem; }
.form-row label { margin: 0; }
.form.mini { margin-top: .5rem; display: flex; flex-direction: column; gap: .5rem; }
.inline { display: inline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1.1rem; border-radius: 999px; border: 1px solid var(--sage-dark);
  background: var(--sage-dark); color: #fff; font: 600 .95rem var(--sans); text-decoration: none; cursor: pointer;
  transition: transform .1s ease, background .2s ease;
}
.btn:hover { background: #3F5A45; }
.btn:active { transform: scale(.98); }
.btn-ghost { background: transparent; color: var(--sage-dark); }
.btn-ghost:hover { background: var(--sage-soft); }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #973B30; }
.btn-sm { min-height: 36px; padding: .35rem .85rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }
button.link { background: none; border: 0; color: var(--ink-2); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
summary.link { cursor: pointer; color: var(--ink-2); text-decoration: underline; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.inline-details { display: inline-block; }
.inline-details[open] { display: block; width: 100%; }
.inline-details > summary { list-style: none; }

.sticky-actions {
  position: sticky; bottom: 0; display: flex; gap: .75rem; justify-content: flex-end;
  padding: .85rem 0 calc(.85rem + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 35%);
}

/* ---- Observation : choix de note ---- */
.crit-card.is-done { opacity: .6; }
.crit-title { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.notes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: .4rem; align-items: center; margin: .5rem 0 .75rem; max-width: 640px; }
.note-opt { margin: 0 !important; cursor: pointer; }
.note-opt input { position: absolute; opacity: 0; pointer-events: none; }
.note-opt span {
  display: flex; flex-direction: column; align-items: center; padding: .45rem .3rem; text-align: center; line-height: 1.2;
  border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .75rem; font-weight: 500; color: var(--ink-2); background: var(--surface);
}
.note-opt b { font-family: var(--serif); font-size: 1.3rem; color: var(--ink); }
.note-opt input:checked + span { border-color: var(--sage-dark); background: var(--sage-soft); color: var(--sage-dark); box-shadow: 0 0 0 2px var(--sage) inset; }
.note-opt.n0 input:checked + span, .note-opt.n1 input:checked + span { border-color: var(--terra); background: var(--terra-soft); color: var(--terra); box-shadow: 0 0 0 2px var(--terra) inset; }
.note-opt input:focus-visible + span { outline: 2px solid var(--sage); }

/* ---- Liste d'évaluations ---- */
.eval-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.eval-list .card { margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.eval.st-soumis { border-left: 4px solid var(--terra); }
.eval.st-conteste { border-left: 4px solid var(--gold); }
.eval.st-annule { opacity: .65; }
.eval-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.eval-body p { margin: .4rem 0; }
.eval-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: flex-start; margin-top: auto; }
.contest { background: #FBEFD6; color: #7A5410; border-radius: 10px; padding: .45rem .65rem; font-size: .88rem; margin-top: .35rem; }
.eval-mini { border-top: 1px solid var(--line); padding: .8rem 0; display: flex; flex-direction: column; gap: .35rem; }
.eval-mini:first-of-type { border-top: 0; }

/* ---- Espace personnel ---- */
.me-hero { text-align: center; padding: 1.5rem 1rem; background: linear-gradient(180deg, #FFFFFF, var(--sage-soft)); }
.hello { font-family: var(--serif); font-size: 1.3rem; margin: 0 0 .5rem; }
.gauge-wrap { position: relative; width: min(240px, 70vw); margin: 0 auto; aspect-ratio: 1; }
.gauge { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 14; }
.gauge-track { stroke: rgba(79, 107, 85, .12); }
.gauge-fill { stroke: var(--terra); stroke-linecap: round; stroke-dasharray: 540.35; stroke-dashoffset: 540.35; transition: stroke-dashoffset 1s cubic-bezier(.2, .8, .2, 1); }
.gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-value { font-family: var(--serif); font-size: 3.2rem; font-weight: 700; line-height: 1; }
.gauge-unit { font-size: .85rem; color: var(--ink-2); }
.next { margin: .75rem 0 0; }
.score-line { margin: 0; font-size: 1.05rem; }
.score-line .big { font-family: var(--serif); font-size: 2rem; font-weight: 700; }
.tx-list { list-style: none; padding: 0; margin: 0; }
.tx-list li { display: flex; justify-content: space-between; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.tx-list li:last-child { border: 0; }
.tx-amount { font-family: var(--serif); font-size: 1.2rem; white-space: nowrap; }

/* ---- Écran de salle ---- */
body.screen { background: radial-gradient(circle at 50% 0%, #FFFFFF, var(--bg) 60%); min-height: 100vh; }
.screen-box { max-width: 1000px; margin: 4vh auto; }
.screen .auth-brand { font-size: 2.4rem; }
.screen-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin: 2rem 0; }
.kpi.big { align-items: center; text-align: center; padding: 2rem 1rem; }
.kpi.big .kpi-value { font-size: 4rem; color: var(--sage-dark); }
.kpi.big .kpi-label { font-size: 1rem; }

/* ---- Connexion / installation ---- */
body.auth { min-height: 100vh; display: flex; align-items: center; background: radial-gradient(circle at 30% 0%, var(--sage-soft), var(--bg) 55%); }
body.auth .wrap { width: 100%; }
.auth-box { max-width: 400px; margin: 0 auto; }
.auth-brand { font-family: var(--serif); font-size: 2rem; font-weight: 700; text-align: center; margin-bottom: .2rem; }

/* ---- Messages ---- */
.flash { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .93rem; }
.flash-success { background: var(--sage-soft); color: var(--sage-dark); }
.flash-error { background: var(--red-soft); color: var(--red); }
.flash-warn { background: #FBEFD6; color: #7A5410; }
.flash-info { background: var(--surface-2); color: var(--ink); }
.demo-banner { background: var(--ink); color: #fff; padding: .35rem 1rem; font-size: .78rem; text-align: center; }
.big-code { font-size: 1.2rem; }
.pager { display: flex; justify-content: space-between; margin-top: 1rem; }

/* ---- Comptes ---- */
.user-row { display: grid; grid-template-columns: 1.4fr 1fr 1.3fr 1fr 1fr auto auto; gap: .5rem; align-items: center; }
.crit-edit .form-row { margin-top: .25rem; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .user-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .wrap { padding: 1rem .85rem 6rem; }
  .topbar { padding: .6rem .85rem; gap: .5rem; }
  .nav { order: 3; flex: 0 0 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .1rem; }
  .nav a { white-space: nowrap; }
  .who { margin-left: auto; }
  .grid-2, .row-3, .row-4, .screen-kpis { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 1.5rem; }
  .eval-list { grid-template-columns: 1fr; }
  h1 { font-size: 1.45rem; }
  .notes { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .notes .js-clear-note { grid-column: 1 / -1; justify-self: end; }
  .note-opt span { font-size: .66rem; padding: .4rem .15rem; }
  .filters select { flex: 1; }
  .kpi.big .kpi-value { font-size: 3rem; }
}

/* ---- QR avis (plein écran, lisible à bout de bras) ---- */
body.qr { background: #fff; min-height: 100vh; }
body.qr .wrap { padding: 0; max-width: none; }
.qr-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom)); text-align: center; }
.qr-brand { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; margin: 0; }
.qr-box { width: min(82vw, 62vh, 420px); aspect-ratio: 1; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-title { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; margin: .5rem 0 0; }
.qr-sub { color: var(--ink-2); margin: 0; }
.qr-close { margin-top: 1rem; }
.me-qr { display: flex; justify-content: center; margin-top: 1rem; }

/* ---- Actions remarquées ---- */
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.who-btn { display: flex; flex-direction: column; gap: .15rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); background: var(--surface); }
.who-btn.on { border-color: var(--sage-dark); background: var(--sage-soft); box-shadow: 0 0 0 2px var(--sage) inset; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.action-grid form { margin: 0; }
.action-btn { width: 100%; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: .75rem; text-align: left; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: 500 .95rem var(--sans); cursor: pointer; transition: transform .1s ease, border-color .2s; }
.action-btn:hover { border-color: var(--terra); }
.action-btn:active { transform: scale(.97); background: var(--terra-soft); }
.action-btn b { font-family: var(--serif); font-size: 1.3rem; color: var(--terra); white-space: nowrap; }
.tx-side { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; }

/* ---- Classement ---- */
.ranking { list-style: none; padding: 0; margin: .25rem 0 1rem; }
.ranking li { display: flex; align-items: center; gap: .65rem; padding: .55rem .4rem; border-bottom: 1px solid var(--line); }
.ranking li:last-child { border-bottom: 0; }
.ranking li.me { background: var(--sage-soft); border-radius: 10px; }
.ranking .rk { width: 2rem; text-align: center; font-size: 1.15rem; }
.ranking .rk-name { flex: 1; }

/* ---- Badges ---- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .6rem; }
.badge-item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .15rem; padding: .75rem .4rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #FFFCF6; }
.badge-icon { font-size: 2rem; line-height: 1.1; }
.badge-label { font-size: .8rem; font-weight: 600; line-height: 1.25; }
.badge-item.is-new { border-color: var(--gold); animation: badgepop 1.2s ease; }
@keyframes badgepop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: none; } }
.toast { position: fixed; left: 50%; top: 1rem; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: .75rem; background: var(--ink); color: #fff; padding: .8rem 1.1rem; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: toastin .5s cubic-bezier(.2,.8,.2,1); transition: opacity .6s, transform .6s; max-width: 92vw; }
.toast.out { opacity: 0; transform: translate(-50%, -20px); }
.toast-icon { font-size: 2rem; }
@keyframes toastin { from { transform: translate(-50%, -30px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.qa-row { display: grid; grid-template-columns: 1fr 80px 170px 70px 130px auto; gap: .5rem; align-items: center; margin-bottom: .5rem; }
@media (max-width: 760px) { .qa-row { grid-template-columns: 1fr 70px; } }

/* =================== V2 =================== */
.kpis-4 { grid-template-columns: repeat(4, 1fr); }
.section-title { margin: 1.5rem 0 .75rem; }
.clean-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.clean-list li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.clean-list li:last-child { border-bottom: 0; }
.quote { margin: .5rem 0; padding: .75rem 1rem; background: var(--surface-2); border-left: 4px solid var(--sage); border-radius: 10px; }
[hidden] { display: none !important; }

/* Avatars */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; font-size: 1.35rem; font-weight: 700; color: #fff; text-decoration: none; flex-shrink: 0; }
.avatar-lg { width: 64px; height: 64px; font-size: 2rem; box-shadow: 0 0 0 4px #fff, 0 4px 14px rgba(0,0,0,.12); }
.c-sauge { background: linear-gradient(135deg, #9BB59E, #4F6B55); }
.c-terracotta { background: linear-gradient(135deg, #E29572, #B5532F); }
.c-or { background: linear-gradient(135deg, #F0CF7A, #C5922A); }
.c-ocean { background: linear-gradient(135deg, #8EC5D6, #2F6F86); }
.c-rose { background: linear-gradient(135deg, #F3B4C0, #C0607A); }
.c-nuit { background: linear-gradient(135deg, #7C7FA8, #34365C); }
.avatar-pick { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.avatar-opt input, .color-opt input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-opt input:checked + .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ink); }
.avatar-opt { margin: 0 !important; cursor: pointer; }
.color-pick { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.color-opt { flex-direction: row !important; align-items: center; gap: .35rem !important; cursor: pointer; font-weight: 400 !important; margin: 0 !important; }
.swatch { width: 26px; height: 26px; border-radius: 50%; display: inline-block; }
.color-opt input:checked + .swatch { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }

/* Mes Étoiles */
.me-id { display: flex; align-items: center; justify-content: center; gap: .9rem; margin-bottom: .5rem; text-align: left; }
.me-id .hello { margin: 0; }
.level-line { margin: .15rem 0 0; color: var(--ink-2); }
.level-badge { display: inline-block; background: linear-gradient(135deg, var(--gold), var(--terra)); color: #fff; font-weight: 700; font-size: .78rem; padding: .1rem .55rem; border-radius: 999px; }
.xp-bar { max-width: 360px; margin: .4rem auto 1rem; }
.xp-bar .bar > span { background: linear-gradient(90deg, var(--gold), var(--terra)); }
.xp-bar p { margin: .3rem 0 0; }
.btn-qr { display: flex; width: min(100%, 420px); margin: 1rem auto .6rem; min-height: 68px; font-size: 1.2rem; letter-spacing: .04em; background: linear-gradient(135deg, var(--terra), #A9522F); border-color: #A9522F; box-shadow: 0 8px 22px rgba(194, 101, 63, .35); }
.btn-qr:hover { background: #A9522F; }
.skills { display: grid; gap: .65rem; }
.skill { display: flex; gap: .65rem; align-items: center; }
.skill-icon { font-size: 1.5rem; width: 2rem; text-align: center; }
.skill-body { flex: 1; }
.mission-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.mission { display: flex; justify-content: space-between; gap: .75rem; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #FFFCF6; }
.mission.done { background: var(--sage-soft); border-color: var(--sage); }
.mission-reward { font-family: var(--serif); font-weight: 700; color: var(--terra); text-align: right; white-space: nowrap; }
.mission-reward small { color: var(--ink-2); font-family: var(--sans); font-weight: 500; }

/* Boutique */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.reward-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.reward-media { position: relative; aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.reward-media img { width: 100%; height: 100%; object-fit: cover; }
.cat-repas { background: linear-gradient(135deg, #F6E3D8, #E9B79C); }
.cat-activites { background: linear-gradient(135deg, #E4ECE3, #A9C2AC); }
.cat-bien_etre { background: linear-gradient(135deg, #EEF3EC, #C9DCCB); }
.cat-loisirs { background: linear-gradient(135deg, #FBEFD6, #EBCB86); }
.cat-collectif { background: linear-gradient(135deg, #EDE7F3, #C4B5D8); }
.reward-emoji { font-size: 3.4rem; }
.reward-cost { position: absolute; top: .65rem; right: .65rem; background: rgba(43, 42, 39, .85); color: #fff; font-weight: 700; padding: .2rem .65rem; border-radius: 999px; font-size: .9rem; }
.reward-body { padding: 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.reward-body h2 { margin: 0; }
.reward-body p { margin: 0; }
.reward-body form { margin-top: auto; }
.reward-missing { color: var(--terra); font-weight: 600; margin-top: .3rem !important; }

/* Crew */
.crew-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.crew-list .card { margin: 0; }
.crew-card.st-valide { border-color: var(--gold); background: #FFFBF1; }
.crew-card.st-reussi { border-left: 4px solid var(--gold); }
.crew-card.st-echoue, .crew-card.st-annule { opacity: .6; }
.crew-reward { font-weight: 600; margin: .3rem 0; }

/* Piloter */
.pilot-row { display: grid; grid-template-columns: 1fr auto; gap: .2rem .75rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.pilot-row label { margin: 0 !important; }
.pilot-row .muted { grid-column: 1; }
.pilot-row .btn { grid-row: 1 / span 2; grid-column: 2; }
.who-btn.present { border-color: var(--sage); }
.action-opt { margin: 0 !important; display: block !important; cursor: pointer; }
.action-opt input { position: absolute; opacity: 0; pointer-events: none; }
.action-opt input:checked + .action-btn { border-color: var(--terra); background: var(--terra-soft); box-shadow: 0 0 0 2px var(--terra) inset; }
.action-opt .action-btn { font-weight: 500; }

/* Réputation */
.chart { width: 100%; overflow-x: auto; }
.rep-svg { width: 100%; min-width: 480px; height: auto; display: block; }
.rep-svg .rb { fill: var(--sage); }
.rep-svg .rv { font: 600 11px var(--sans); fill: var(--sage-dark); text-anchor: middle; }
.rep-svg .rl { font: 11px var(--sans); fill: var(--ink-2); text-anchor: middle; }
.rep-svg .rline { fill: none; stroke: var(--terra); stroke-width: 2.5; stroke-linejoin: round; }
.rep-svg .rdot { fill: #fff; stroke: var(--terra); stroke-width: 2; }
.rep-source { color: var(--sage-dark); background: var(--sage-soft); display: inline-block; padding: .3rem .75rem; border-radius: 999px; }
.rep-source.stale { color: #7A5410; background: #FBEFD6; }
.kpi-rep .kpi-value { color: var(--sage-dark); }

/* QR plein écran */
.qr-merci { font-family: var(--serif); font-size: clamp(2.8rem, 12vw, 4.5rem); font-weight: 700; color: var(--terra); margin: 0; line-height: 1; }
.qr-hint { color: var(--ink-2); font-size: .85rem; margin: 0; }
.qr-sign { font-family: "Snell Roundhand", "Segoe Script", "Brush Script MT", var(--serif); font-style: italic; font-size: clamp(2rem, 9vw, 3rem); color: var(--sage-dark); margin: .25rem 0 0; }
.qr-sign::before { content: "— "; }

/* Notifications */
.toast-celebration { background: linear-gradient(135deg, var(--terra), #A9522F); }
.toast-stars { background: linear-gradient(135deg, var(--sage-dark), #3F5A45); }
.toast-badge { background: linear-gradient(135deg, #3B352B, #6B5420); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti span { position: absolute; top: -30px; animation: fall 2.6s cubic-bezier(.3,.6,.4,1) forwards; }
.confetti .c0 { color: var(--gold); } .confetti .c1 { color: var(--terra); } .confetti .c2 { color: var(--sage); }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); opacity: .2; } }

/* Impressions */
.sheet-cartes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; }
.sheet-presentoir { display: grid; grid-template-columns: 1fr; gap: 0; }
.print-item { border: 1px dashed #c9c2b6; padding: 14px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; background: #fff; }
.pi-brand { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; margin: 0; color: var(--ink); }
.pi-name { margin: 0; font-size: .85rem; color: var(--sage-dark); }
.pi-qr { width: 120px; }
.sheet-presentoir .pi-qr { width: 220px; }
.sheet-presentoir .pi-brand { font-size: 2rem; }
.sheet-presentoir .print-item { padding: 30px; }
.pi-qr svg { width: 100%; display: block; }
.pi-msg { margin: 0; font-size: .82rem; }
.sheet-presentoir .pi-msg { font-size: 1.1rem; }
.pi-small { margin: 0; font-size: .7rem; color: var(--ink-2); }
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  .topbar, .no-print, .demo-banner, .notif-host, .toast, .flash { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .sheet-cartes .print-item { height: 68mm; break-inside: avoid; }
  .sheet-presentoir .print-item { height: 135mm; break-inside: avoid; }
}

@media (max-width: 760px) {
  .kpis-4 { grid-template-columns: repeat(2, 1fr); }
  .btn-qr { min-height: 62px; }
  .shop-grid, .crew-list { grid-template-columns: 1fr; }
}
.toast { width: min(92vw, 440px); }
.toast strong { display: inline-block; line-height: 1.3; }

/* ---- Connexion par prénom + code PIN ---- */
.team-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .75rem; margin-top: .5rem; }
.team-tile { display: flex; flex-direction: column; align-items: center; gap: .45rem; padding: .9rem .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); background: var(--surface); font-weight: 600; text-align: center; }
.team-tile:active { transform: scale(.97); background: var(--sage-soft); }
.pin-card { text-align: center; }
.pin-who { display: flex; flex-direction: column; align-items: center; gap: .5rem; font-size: 1.2rem; }
.pin-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pin-dots { display: flex; justify-content: center; gap: 1rem; margin: .5rem 0 1.25rem; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--sage-dark); transition: background .15s; }
.pin-dots span.on { background: var(--sage-dark); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; max-width: 300px; margin: 0 auto; }
.key { height: 64px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font: 600 1.6rem var(--sans); color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.key:active { background: var(--sage-soft); transform: scale(.95); }
.key-alt { font-size: .9rem; border: 0; background: transparent; color: var(--ink-2); }
.pin-card.sending { opacity: .6; pointer-events: none; }
.summary-strong { font-weight: 600; cursor: pointer; }
.key { width: 72px; height: 72px; justify-self: center; }

/* ---- Mes cadeaux à gagner (Mes Étoiles) ---- */
.gift-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: .75rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .4rem; -webkit-overflow-scrolling: touch; }
.gift { scroll-snap-align: start; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.gift.ready { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; }
.gift-media { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; overflow: hidden; }
.gift-media img { width: 100%; height: 100%; object-fit: cover; }
.gift-body { padding: .65rem .75rem .75rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.gift-body strong { line-height: 1.25; }
.gift-cost { font-family: var(--serif); font-weight: 700; color: var(--terra); }
.gift-state { margin: 0; color: var(--ink-2); }
.gift-state strong { color: var(--terra); }
.gift form { margin-top: auto; }

/* =================== V3 Réputation =================== */
:root { --gold-soft: #F7EBCB; }
.rep-hero { text-align: center; padding: 1.75rem 1rem 1.25rem; margin-bottom: 1rem; border-radius: var(--radius); background: radial-gradient(circle at 50% 0%, #FFFDF7, var(--sage-soft) 75%); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.rep-hero::before, .rep-hero::after { content: "★"; position: absolute; color: var(--gold); opacity: .18; font-size: 7rem; line-height: 1; }
.rep-hero::before { top: -1.5rem; left: -1rem; transform: rotate(-12deg); }
.rep-hero::after { bottom: -2rem; right: -1rem; transform: rotate(18deg); }
.rep-kicker { letter-spacing: .25em; font-size: .78rem; font-weight: 700; color: var(--sage-dark); margin: 0; }
.rep-title { font-size: clamp(1.6rem, 6.5vw, 2.3rem); margin: .35rem 0 .75rem; }
.rep-total { display: flex; flex-direction: column; align-items: center; }
.rep-number { font-family: var(--serif); font-size: clamp(3.6rem, 18vw, 5.5rem); font-weight: 700; line-height: 1; color: var(--sage-dark); }
.rep-unit { color: var(--ink-2); font-weight: 600; }
.rep-stars { position: relative; display: inline-block; font-size: 1.7rem; letter-spacing: .15em; margin: .6rem 0 .2rem; color: #E3DCCD; }
.rep-stars::before { content: "★★★★★"; }
.rep-stars .stars-fill { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; color: var(--gold); width: 0; transition: width 1s ease; }
.rep-stars .stars-fill::before { content: "★★★★★"; }
.rep-line { margin: .2rem 0 1rem; }
.milestone { max-width: 460px; margin: 0 auto .75rem; text-align: left; }
.milestone-head { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.milestone .bar > span, .milestone-card .bar > span { background: linear-gradient(90deg, var(--gold), var(--terra)); }
.btn-qr-xl { min-height: 84px; font-size: 1.35rem; margin: 0 auto 1.25rem; width: min(100%, 520px); }
.gift-balance { background: var(--gold-soft); color: #7A5410; padding: .25rem .75rem; border-radius: 999px; font-size: .9rem; }
.reviews { display: grid; gap: .75rem; }
.review { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem .9rem; background: #FFFDF8; }
.review p { margin: .35rem 0; font-size: .95rem; }
.review-head { display: flex; justify-content: space-between; gap: .5rem; }
.review-stars { color: var(--gold); letter-spacing: .05em; }
.presence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .65rem; margin: .5rem 0 1rem; }
.presence-tile { display: flex !important; flex-direction: column; align-items: center; gap: .35rem; padding: .85rem .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; text-align: center; margin: 0 !important; }
.presence-tile input { position: absolute; opacity: 0; pointer-events: none; }
.presence-tile:has(input:checked), .presence-tile.on { border-color: var(--sage-dark); background: var(--sage-soft); box-shadow: 0 0 0 2px var(--sage) inset; }
.mini-kpis .kpi { padding: .7rem; }
.mini-kpis .kpi-value { font-size: 1.5rem; }
code.breakall { word-break: break-all; }
body.is-avis .wrap { max-width: 760px; }
