:root {
    --red: #c8102e;
    --red-dark: #9e0c24;
    --green: #146b3a;
    --green-light: #e7f4ec;
    --gold: #f2b134;
    --bg: #fbf7f2;
    --card: #ffffff;
    --text: #2a2522;
    --muted: #6f6560;
    --border: #e8dfd6;
    --radius: 14px;
    --shadow: 0 6px 24px rgba(80, 40, 20, .08);
    --chart-bar: #146b3a;
    --chart-bar-hover: #0f4f2b;
    --chart-grid: #f1ebe5;
    --chart-axis: #d9cec4;
    --chart-hover: rgba(20, 107, 58, .06);
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Flocons décoratifs */
.snow {
    position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
    background-image:
        radial-gradient(3px 3px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 80px 120px, #fff, transparent),
        radial-gradient(3px 3px at 150px 60px, #fff, transparent),
        radial-gradient(2px 2px at 200px 180px, #fff, transparent);
    background-size: 240px 240px;
    animation: snow 30s linear infinite;
}
@keyframes snow { to { background-position: 0 2400px; } }
@media (prefers-reduced-motion: reduce) { .snow { animation: none; } }

.site-header {
    position: relative; z-index: 1;
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    color: #fff;
    padding: 14px 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}
.site-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.site-nav { display: flex; gap: 18px; }
.site-nav a { color: #fff; text-decoration: none; font-weight: 600; opacity: .92; }
.site-nav a:hover { opacity: 1; text-decoration: underline; }
.hero-small { padding-bottom: 6px; }
.faq { border-bottom: 1px solid var(--border); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; color: var(--muted); }
.tabs { display: flex; gap: 6px; margin: 4px 0 16px; border-bottom: 2px solid var(--border); }
.tab { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--red); border-bottom-color: var(--red); }
.ticket { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.ticket.closed { opacity: .7; }
.ticket-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ticket-msg { background: var(--bg); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.ticket-reply { background: var(--green-light); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.ticket-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.ticket-actions form { margin: 0; }
.ticket textarea { margin-bottom: 8px; }
.brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.3rem; letter-spacing: .3px; }
.brand-icon { font-size: 1.5rem; }

.container {
    position: relative; z-index: 1;
    width: 100%; max-width: 980px;
    margin: 0 auto; padding: 28px 18px 40px;
    flex: 1;
}

.site-footer {
    position: relative; z-index: 1;
    text-align: center; color: var(--muted); font-size: .88rem;
    padding: 20px; border-top: 1px solid var(--border);
}

h1, h2 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: 2rem; }
h2 { font-size: 1.25rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 small { font-weight: 400; color: var(--muted); font-size: .85rem; }
a { color: var(--red); }
code { background: #f4ede6; padding: 1px 6px; border-radius: 6px; font-size: .92em; word-break: break-all; }

/* Accueil */
.hero { text-align: center; padding: 10px 0 24px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.accent { color: var(--red); }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 680px; margin: 0 auto 24px; }
.steps {
    list-style: none; padding: 0; margin: 0 auto 18px;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; text-align: left;
}
.steps li { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.steps li span {
    display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
    background: var(--green); color: #fff; font-weight: 700; margin-right: 6px;
}
.features { list-style: none; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.features li { background: var(--green-light); color: var(--green); padding: 6px 12px; border-radius: 999px; font-size: .92rem; font-weight: 600; }

/* Cartes et formulaires */
.card {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 22px; margin-bottom: 20px; border: 1px solid var(--border);
}
.card.center { text-align: center; }
.num {
    display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
    background: var(--red); color: #fff; font-size: 1rem;
}
.hint { color: var(--muted); font-size: .92rem; margin: 0 0 14px; }
.eyebrow { text-transform: uppercase; letter-spacing: 1px; font-size: .78rem; color: var(--green); font-weight: 700; margin: 0 0 4px; }
.empty { color: var(--muted); font-style: italic; }
.mt { margin-top: 14px; }

label { display: block; font-weight: 600; font-size: .93rem; margin-bottom: 12px; }
label small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=date], select, textarea {
    display: block; width: 100%; margin-top: 5px;
    padding: 10px 12px; font: inherit; font-weight: 400; color: var(--text);
    border: 1.5px solid var(--border); border-radius: 10px; background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(20, 107, 58, .15); }
textarea { resize: vertical; }

.grid-2, .grid-3 { display: grid; gap: 0 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.span-3 { grid-column: 1 / -1; }
.grid-2.cols { gap: 20px; align-items: start; }
@media (max-width: 720px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.participant-row, .exclusion-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.participant-row input, .exclusion-row select { margin-top: 0; }
.row-num { min-width: 26px; color: var(--muted); font-weight: 700; text-align: right; }
.x-sep { color: var(--red); font-weight: 700; }
@media (max-width: 600px) {
    .participant-row { flex-wrap: wrap; }
    .participant-row input { flex: 1 1 calc(100% - 80px); }
}
.counter { margin-left: 10px; color: var(--muted); font-size: .9rem; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.tags { font-size: .9rem; color: var(--muted); }
.tag {
    font: inherit; font-family: ui-monospace, Consolas, monospace; cursor: pointer;
    border: 1px dashed var(--green); background: var(--green-light); color: var(--green);
    border-radius: 8px; padding: 2px 8px; margin-left: 4px;
}

/* Boutons */
.btn {
    display: inline-flex; align-items: center; gap: 6px; justify-content: center;
    font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
    border: none; border-radius: 10px; padding: 10px 18px;
    background: var(--green); color: #fff; transition: transform .1s, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary { background: var(--red); }
.btn-primary:hover { background: var(--red-dark); }
.btn-light { background: #f4ede6; color: var(--text); }
.btn-light:hover { background: #ece2d8; }
.btn-danger { background: #fff; color: var(--red); border: 2px solid var(--red); }
.btn-small { padding: 6px 10px; font-size: .85rem; }
.btn-big { font-size: 1.15rem; padding: 15px 30px; }
.icon-btn {
    flex: none; width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
    background: #f4ede6; color: var(--muted); font-size: 1rem;
}
.icon-btn:hover { background: #fde3e6; color: var(--red); }
.submit-zone { text-align: center; padding: 10px 0 20px; }
.submit-zone .hint { margin-top: 10px; }

/* Alertes */
.alert { padding: 14px 18px; border-radius: 12px; margin-bottom: 20px; border: 1px solid; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert-success { background: var(--green-light); border-color: #b8dfc6; color: #0f4f2b; }
.alert-error { background: #fdecee; border-color: #f5c2c9; color: #8a0b20; }

/* Page organisateur */
.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); margin: 10px 0 14px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: var(--bg); border-radius: 12px; padding: 14px; text-align: center; }
.stat strong { display: block; font-size: 1.6rem; color: var(--green); }
.stat span { color: var(--muted); font-size: .88rem; }
@media (max-width: 600px) { .stats { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .5px; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.inline-form { display: flex; gap: 6px; align-items: center; min-width: 330px; }
.inline-form input { margin-top: 0; padding: 7px 10px; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .8rem; background: #f1ebe5; color: var(--muted); white-space: nowrap; }
.badge-ok { background: var(--green-light); color: var(--green); }
.badge-err { background: #fdecee; color: var(--red); }
.exclusion-list { margin: 0; padding-left: 20px; }
.mail-preview { background: var(--bg); border-radius: 10px; padding: 14px; font-size: .93rem; }
.danger-zone { border-color: #f5c2c9; }

/* Administration */
input[type=password], input[type=search] {
    display: block; width: 100%; margin-top: 5px;
    padding: 10px 12px; font: inherit; font-weight: 400; color: var(--text);
    border: 1.5px solid var(--border); border-radius: 10px; background: #fff;
}
.login-card { max-width: 420px; margin: 40px auto; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.stats-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) { .stats-4 { grid-template-columns: repeat(2, 1fr); } }
.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { margin-top: 0; }
.muted { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions form { margin: 0; }
/* Dans un tableau, la cellule doit rester une cellule (sinon sa bordure se décale) : les boutons s'alignent à l'intérieur. */
td.actions { display: table-cell; white-space: nowrap; text-align: right; }
td.actions form { display: inline-block; vertical-align: middle; margin: 2px 0 2px 4px; }
label.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.checkbox input { width: auto; margin: 0; }

/* Budget avec le signe € */
.input-suffix { position: relative; display: block; margin-top: 5px; }
.input-suffix input { margin-top: 0; padding-right: 34px; }
.input-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; pointer-events: none; }

/* Champ « Foyer » des participants */
.participant-row .p-group { flex: 0 0 150px; }
@media (max-width: 600px) { .participant-row .p-group { flex: 1 1 calc(100% - 80px); margin-left: 36px; } }

/* Brouillon et aperçu */
.draft-card { border: 2px dashed var(--gold); }
.alert-info { background: #fff8e6; border-color: #f2d48a; color: #6b4e00; }
.check-steps { margin: 0 0 18px; padding-left: 22px; color: var(--muted); }
.action-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.action-bar form { margin: 0; }
.mail-frame { width: 100%; height: 980px; border: 1px solid var(--border); border-radius: 12px; background: #f4ede6; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }
.badge-draft { background: #fff3d6; color: #8a6100; }

/* Envoi en cours, file d'emails, pagination */
.alert-warn { background: #fff8e6; border-color: #f2d48a; color: #6b4e00; }
.sending { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.spinner {
    width: 16px; height: 16px; border-radius: 50%; flex: none;
    border: 3px solid #f2d48a; border-top-color: #8a6100; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.quota { height: 8px; border-radius: 999px; background: #f1ebe5; overflow: hidden; }
.quota span { display: block; height: 100%; background: var(--green); }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 18px; }
.pagination .page {
    min-width: 36px; padding: 6px 10px; border-radius: 8px; text-align: center; text-decoration: none;
    border: 1px solid var(--border); color: var(--text, inherit); background: #fff;
}
.pagination a.page:hover { border-color: var(--red); color: var(--red); }
.pagination .current { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.pagination .page-gap { padding: 6px 2px; color: var(--muted); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Statistiques : histogrammes (une série, colonnes fines arrondies côté valeur) */
.tabs-small { margin: 0; border-bottom: none; }
.tabs-small .tab { padding: 4px 10px; font-size: .88rem; }
.chart { margin: 0 0 28px; }
.chart:last-child { margin-bottom: 0; }
.chart figcaption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 12px; }
.chart-body { display: flex; gap: 8px; height: 200px; padding-bottom: 22px; }
.chart-axis {
    display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end;
    font-size: .75rem; color: var(--muted); min-width: 28px; margin: -.5em 0;
}
.chart-plot {
    position: relative; flex: 1; display: flex; align-items: flex-end; gap: 2px;
    border-bottom: 1px solid var(--chart-axis);
}
.chart-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--chart-grid); pointer-events: none; }
.chart-col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; }
.chart-col:hover { background: var(--chart-hover); border-radius: 4px; }
.chart-bar { display: block; width: 100%; max-width: 24px; background: var(--chart-bar); border-radius: 4px 4px 0 0; }
.chart-col:hover .chart-bar { background: var(--chart-bar-hover); }
.chart-x { position: absolute; top: 100%; margin-top: 4px; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.chart-dense { gap: 0; }
.chart-table summary { cursor: pointer; color: var(--muted); font-size: .88rem; margin-top: 8px; }
.chart-table .table-wrap { max-height: 260px; overflow-y: auto; }

/* Confidentialité */
.legal h3 { margin-top: 18px; }
.legal ul { padding-left: 20px; }

/* Signalement à l'organisateur */
.report-card summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.report-card { padding: 16px 22px; }

/* Page participant */
.reveal { text-align: center; background: linear-gradient(160deg, #fff 60%, #fff4e0); }
.target-name {
    display: inline-block; font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 800; color: var(--red);
    background: #fff; border: 3px dashed var(--gold); border-radius: 16px; padding: 10px 26px; margin: 4px 0 6px;
}
.reveal .meta { justify-content: center; }
.wishlist { background: #fffaf0; border-left: 4px solid var(--gold); border-radius: 8px; padding: 14px; white-space: normal; }
#wishlist .btn, .chat-form .btn { margin-top: 10px; }

.messages {
    display: flex; flex-direction: column; gap: 10px;
    max-height: 380px; overflow-y: auto; padding: 6px 2px; margin-bottom: 12px;
}
.msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; }
.msg-mine { align-self: flex-end; background: var(--green-light); border-bottom-right-radius: 4px; }
.msg-other { align-self: flex-start; background: #fdecee; border-bottom-left-radius: 4px; }
.msg-author { font-size: .75rem; color: var(--muted); margin-bottom: 3px; }
.msg-body { overflow-wrap: anywhere; }

/* Bouton de thème (menu) */
.site-nav { align-items: center; flex-wrap: wrap; row-gap: 8px; }
.theme-picker { margin: 0; }
.theme-picker select {
    display: inline-block; width: auto; margin: 0; cursor: pointer;
    font: inherit; font-size: .85rem; font-weight: 600; color: #fff;
    background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 4px 10px;
}
.theme-picker select:hover { background: rgba(255, 255, 255, .25); }
.theme-picker option { color: #2a2522; background: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Cadeau acheté, idées de cadeaux */
.center-bar { justify-content: center; }
.reveal .action-bar { margin: 6px 0 10px; }
.gift-done { background: var(--green-light); color: var(--green); border: 1px solid var(--green); }
.ideas { margin-top: 14px; background: var(--green-light); border: 1px solid #b8dfc6; border-radius: 12px; padding: 14px 16px; }
.ideas ul { margin: 6px 0 12px; padding-left: 20px; }

/* Inscription par lien, import de liste */
.copy-field { display: flex; gap: 8px; }
.copy-field input { margin-top: 0; }
.signup-option { align-items: flex-start; background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.signup-option input { margin-top: 4px !important; }
.import-box { margin: 0 0 14px; }
.import-box summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.join-card { max-width: 640px; margin-left: auto; margin-right: auto; }
.join-card .btn-big { margin-top: 8px; }

/* ===========================================================================
 * Thème sombre : choisi avec le bouton du menu (ou automatiquement selon l'appareil).
 * Activé par l'attribut data-theme="dark" sur <html> (voir assets/theme.js).
 * :where() garde la même priorité que les règles normales, qui sont ainsi simplement remplacées.
 * Les aperçus d'emails restent clairs (les emails sont lus dans la messagerie).
 * ========================================================================= */
:root[data-theme="dark"] {
    --red: #d42a43;          /* fonds de boutons : texte blanc lisible */
    --red-dark: #b01f36;
    --green: #5dd28f;        /* texte et accents verts sur fond sombre */
    --green-light: #1d3a2a;
    --gold: #e0a52e;
    --bg: #1a1614;
    --card: #24201d;
    --text: #f2ebe5;
    --muted: #b3a8a0;
    --border: #3a3330;
    --shadow: 0 6px 24px rgba(0, 0, 0, .35);
    --chart-bar: #5dd28f;
    --chart-bar-hover: #8fe3b2;
    --chart-grid: #2f2926;
    --chart-axis: #4a423e;
    --chart-hover: rgba(93, 210, 143, .08);
    color-scheme: dark;
}
:where([data-theme="dark"], [data-theme="nuit"]) a, :where([data-theme="dark"], [data-theme="nuit"]) .accent, :where([data-theme="dark"], [data-theme="nuit"]) .tab.active,
:where([data-theme="dark"], [data-theme="nuit"]) .x-sep, :where([data-theme="dark"], [data-theme="nuit"]) .pagination a.page:hover { color: #ff8f9c; }
:where([data-theme="dark"], [data-theme="nuit"]) .tab.active { border-bottom-color: #ff8f9c; }
:where([data-theme="dark"], [data-theme="nuit"]) .snow { opacity: .25; }
:where([data-theme="dark"], [data-theme="nuit"]) .site-header { background: linear-gradient(135deg, #a3142b, #6e0d1d); }
:where([data-theme="dark"], [data-theme="nuit"]) .site-header a, :where([data-theme="dark"], [data-theme="nuit"]) .site-nav a, :where([data-theme="dark"], [data-theme="nuit"]) .brand { color: #fff; }

:where([data-theme="dark"], [data-theme="nuit"]) :is(input[type=text], input[type=email], input[type=date], input[type=password], input[type=search], select, textarea) {
    background: #1d1917; color: var(--text); border-color: #4a423e;
}
:where([data-theme="dark"], [data-theme="nuit"]) :is(input, select, textarea):focus { box-shadow: 0 0 0 3px rgba(93, 210, 143, .2); }
:where([data-theme="dark"], [data-theme="nuit"]) code { background: #332c29; }

:where([data-theme="dark"], [data-theme="nuit"]) .btn { background: #1d7a45; color: #fff; }
:where([data-theme="dark"], [data-theme="nuit"]) .btn-primary { background: var(--red); }
:where([data-theme="dark"], [data-theme="nuit"]) .btn-primary:hover { background: var(--red-dark); }
:where([data-theme="dark"], [data-theme="nuit"]) .btn-light, :where([data-theme="dark"], [data-theme="nuit"]) .icon-btn { background: #352e2b; color: var(--text); }
:where([data-theme="dark"], [data-theme="nuit"]) .btn-light:hover { background: #423936; }
:where([data-theme="dark"], [data-theme="nuit"]) .icon-btn:hover { background: #4a2228; color: #ff8f9c; }
:where([data-theme="dark"], [data-theme="nuit"]) .btn-danger { background: transparent; color: #ff8f9c; border-color: #ff8f9c; }
:where([data-theme="dark"], [data-theme="nuit"]) .steps li span, :where([data-theme="dark"], [data-theme="nuit"]) .num { background: #1d7a45; }

:where([data-theme="dark"], [data-theme="nuit"]) .alert-success { background: #1d3a2a; border-color: #2e5a41; color: #c6f0d6; }
:where([data-theme="dark"], [data-theme="nuit"]) .alert-error { background: #3d1a20; border-color: #6b2a35; color: #ffc9d0; }
:where([data-theme="dark"], [data-theme="nuit"]) .alert-info, :where([data-theme="dark"], [data-theme="nuit"]) .alert-warn { background: #3a2f15; border-color: #6b5524; color: #f6dfa3; }
:where([data-theme="dark"], [data-theme="nuit"]) .badge { background: #352e2b; }
:where([data-theme="dark"], [data-theme="nuit"]) .badge-ok { background: #1d3a2a; color: var(--green); }
:where([data-theme="dark"], [data-theme="nuit"]) .badge-err { background: #3d1a20; color: #ff9aa6; }
:where([data-theme="dark"], [data-theme="nuit"]) .badge-draft { background: #3a2f15; color: #f6d17a; }
:where([data-theme="dark"], [data-theme="nuit"]) .spinner { border-color: #6b5524; border-top-color: #f6d17a; }
:where([data-theme="dark"], [data-theme="nuit"]) .quota { background: #352e2b; }

:where([data-theme="dark"], [data-theme="nuit"]) .reveal { background: linear-gradient(160deg, var(--card) 60%, #3a2c18); }
:where([data-theme="dark"], [data-theme="nuit"]) .target-name { background: #1d1917; color: #ff8f9c; }
:where([data-theme="dark"], [data-theme="nuit"]) .wishlist { background: #2e2619; }
:where([data-theme="dark"], [data-theme="nuit"]) .ideas { background: #1d3a2a; border-color: #2e5a41; }
:where([data-theme="dark"], [data-theme="nuit"]) .msg-other { background: #3d1a20; }
:where([data-theme="dark"], [data-theme="nuit"]) .ticket-reply { background: #1d3a2a; }
:where([data-theme="dark"], [data-theme="nuit"]) .pagination .page { background: var(--card); }
:where([data-theme="dark"], [data-theme="nuit"]) .pagination .current { background: var(--red); border-color: var(--red); color: #fff; }
:where([data-theme="dark"], [data-theme="nuit"]) .tag { background: #1d3a2a; }
:where([data-theme="dark"], [data-theme="nuit"]) .mail-frame { background: #fff; }

/* ===========================================================================
 * Thèmes festifs (menu « Thème »). Chacun redéfinit la palette ; les règles du site
 * utilisant ces variables, seules quelques retouches sont nécessaires.
 * Contraste vérifié : texte blanc lisible sur --red (boutons) et --green (boutons secondaires).
 * ========================================================================= */

/* --- 🌲 Sapin : vert profond, touches dorées, rouge discret --- */
:root[data-theme="sapin"] {
    --red: #1f5f3a; --red-dark: #0f3b22;           /* couleur principale : vert sapin */
    --green: #8a6414; --green-light: #f6efdc;        /* secondaire : or bruni */
    --gold: #d4a537;
    --bg: #f1f5ef; --card: #ffffff; --text: #1e2a22; --muted: #5d6b61; --border: #d6e1d6;
    --chart-bar: #1f5f3a; --chart-bar-hover: #0f3b22; --chart-grid: #e6ede5; --chart-axis: #c5d3c6; --chart-hover: rgba(31, 95, 58, .06);
}
:where([data-theme="sapin"]) .site-header { background: linear-gradient(135deg, #1f5f3a, #0f3b22); border-bottom: 3px solid #d4a537; }
:where([data-theme="sapin"]) .target-name { color: #b3122e; }
:where([data-theme="sapin"]) .btn-danger { color: #b3122e; border-color: #b3122e; }
:where([data-theme="sapin"]) .reveal { background: linear-gradient(160deg, #fff 60%, #f3ead0); }
:where([data-theme="sapin"]) .btn-light, :where([data-theme="sapin"]) .icon-btn, :where([data-theme="sapin"]) code { background: #e8efe6; }
:where([data-theme="sapin"]) .btn-light:hover { background: #dbe6d8; }

/* --- ❄️ Givre : bleu glacier et blanc --- */
:root[data-theme="givre"] {
    --red: #1f5fa8; --red-dark: #174a85;
    --green: #0e6f7d; --green-light: #e2f3f6;
    --gold: #9cc9ec;
    --bg: #eef5fb; --card: #ffffff; --text: #1b2a3a; --muted: #55677a; --border: #d3e1ee;
    --chart-bar: #1f5fa8; --chart-bar-hover: #174a85; --chart-grid: #e3edf6; --chart-axis: #c4d5e6; --chart-hover: rgba(31, 95, 168, .06);
}
:where([data-theme="givre"]) .site-header { background: linear-gradient(135deg, #4a8bd0, #174a85); }
:where([data-theme="givre"]) .snow {
    opacity: .9;
    background-image:
        radial-gradient(3px 3px at 20px 30px, #a9cbe9, transparent),
        radial-gradient(2px 2px at 80px 120px, #bcd7ef, transparent),
        radial-gradient(3px 3px at 150px 60px, #a9cbe9, transparent),
        radial-gradient(2px 2px at 200px 180px, #bcd7ef, transparent);
}
:where([data-theme="givre"]) .reveal { background: linear-gradient(160deg, #fff 60%, #e1eefa); }
:where([data-theme="givre"]) .wishlist { background: #f3f8fd; }
:where([data-theme="givre"]) .btn-light, :where([data-theme="givre"]) .icon-btn, :where([data-theme="givre"]) code { background: #e4edf6; }
:where([data-theme="givre"]) .btn-light:hover { background: #d6e4f1; }

/* --- 🍪 Pain d'épices : caramel, crème et chocolat --- */
:root[data-theme="epices"] {
    --red: #9c4a22; --red-dark: #74361a;
    --green: #5a7329; --green-light: #eef2df;
    --gold: #d99a4e;
    --bg: #f7ecdc; --card: #fffaf2; --text: #3a281b; --muted: #765e4c; --border: #e7d3ba;
    --chart-bar: #9c4a22; --chart-bar-hover: #74361a; --chart-grid: #f0e3d1; --chart-axis: #dcc6a8; --chart-hover: rgba(156, 74, 34, .06);
}
:where([data-theme="epices"]) .site-header { background: linear-gradient(135deg, #8f4421, #5a2a13); border-bottom: 3px dotted #f3d9b1; }
:where([data-theme="epices"]) .reveal { background: linear-gradient(160deg, #fffaf2 60%, #f6dfc0); }
:where([data-theme="epices"]) .target-name { background: #fffaf2; }
:where([data-theme="epices"]) :is(input[type=text], input[type=email], input[type=date], input[type=password], input[type=search], select, textarea) { background: #fffdf9; }
:where([data-theme="epices"]) .btn-light, :where([data-theme="epices"]) .icon-btn, :where([data-theme="epices"]) code { background: #efe0cc; }
:where([data-theme="epices"]) .btn-light:hover { background: #e6d2b8; }

/* --- 🍬 Sucre d'orge : rose et rouge vif, ludique --- */
:root[data-theme="sucre"] {
    --red: #c81d63; --red-dark: #9c1449;
    --green: #1f8a5c; --green-light: #e3f6ec;
    --gold: #ff8fbd;
    --bg: #fff3f7; --card: #ffffff; --text: #3a1f2b; --muted: #82596a; --border: #f4d0de;
    --chart-bar: #c81d63; --chart-bar-hover: #9c1449; --chart-grid: #fbe6ee; --chart-axis: #efc3d4; --chart-hover: rgba(200, 29, 99, .06);
}
:where([data-theme="sucre"]) .site-header { background: repeating-linear-gradient(135deg, #c81d63 0 18px, #dc3a78 18px 36px); }
:where([data-theme="sucre"]) .reveal { background: linear-gradient(160deg, #fff 60%, #ffe1ec); }
:where([data-theme="sucre"]) .target-name { border-style: solid; border-color: #c81d63; box-shadow: 0 0 0 4px #fff, 0 0 0 7px #1f8a5c; }
:where([data-theme="sucre"]) .btn-light, :where([data-theme="sucre"]) .icon-btn, :where([data-theme="sucre"]) code { background: #fbe4ec; }
:where([data-theme="sucre"]) .btn-light:hover { background: #f7d3e0; }

/* --- ✨ Nuit étoilée : bleu nuit et or (thème sombre : reprend les règles du mode sombre ci-dessus) --- */
:root[data-theme="nuit"] {
    --red: #3a5bc7; --red-dark: #2c47a3;
    --green: #e8c766; --green-light: #2b2817;
    --gold: #e8c766;
    --bg: #0d1322; --card: #151d31; --text: #e8ecf6; --muted: #9aa5c0; --border: #28324b;
    --shadow: 0 6px 24px rgba(0, 0, 0, .45);
    --chart-bar: #e8c766; --chart-bar-hover: #f3dc97; --chart-grid: #1f2840; --chart-axis: #34405e; --chart-hover: rgba(232, 199, 102, .08);
    color-scheme: dark;
}
:where([data-theme="nuit"]) a, :where([data-theme="nuit"]) .accent, :where([data-theme="nuit"]) .tab.active,
:where([data-theme="nuit"]) .x-sep, :where([data-theme="nuit"]) .pagination a.page:hover { color: #f0d27e; }
:where([data-theme="nuit"]) .tab.active { border-bottom-color: #f0d27e; }
:where([data-theme="nuit"]) .site-header { background: linear-gradient(135deg, #1b2b5e, #0a1024); border-bottom: 1px solid #e8c766; }
:where([data-theme="nuit"]) .site-header a, :where([data-theme="nuit"]) .brand { color: #fff; }
:where([data-theme="nuit"]) :is(input[type=text], input[type=email], input[type=date], input[type=password], input[type=search], select, textarea) {
    background: #0f1628; border-color: #34405e;
}
:where([data-theme="nuit"]) .btn { background: #2c3a63; }
/* (re)définis après .btn, qui a la même priorité */
:where([data-theme="nuit"]) .btn-primary { background: var(--red); }
:where([data-theme="nuit"]) .btn-primary:hover { background: var(--red-dark); }
:where([data-theme="nuit"]) .btn-danger { background: transparent; color: #ff9aa6; border-color: #ff9aa6; }
:where([data-theme="nuit"]) .gift-done { background: var(--green-light); color: var(--green); }
:where([data-theme="nuit"]) .btn-light, :where([data-theme="nuit"]) .icon-btn, :where([data-theme="nuit"]) code,
:where([data-theme="nuit"]) .badge, :where([data-theme="nuit"]) .quota { background: #222c45; }
:where([data-theme="nuit"]) .btn-light:hover { background: #2c3756; }
:where([data-theme="nuit"]) .steps li span, :where([data-theme="nuit"]) .num { background: #2c3a63; }
:where([data-theme="nuit"]) .reveal { background: linear-gradient(160deg, var(--card) 55%, #2a2440); }
:where([data-theme="nuit"]) .target-name { background: #0f1628; color: #f0d27e; }
:where([data-theme="nuit"]) .wishlist { background: #1d2236; }
:where([data-theme="nuit"]) .msg-other { background: #2a2440; }
/* Étoiles fixes qui scintillent au lieu de la neige */
:where([data-theme="nuit"]) .snow {
    opacity: .7;
    background-image:
        radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 90px 140px, #f0d27e, transparent),
        radial-gradient(1px 1px at 160px 70px, #fff, transparent),
        radial-gradient(2px 2px at 210px 200px, #fff, transparent),
        radial-gradient(1.5px 1.5px at 60px 210px, #f0d27e, transparent);
    background-size: 240px 240px;
    animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .35; } to { opacity: .8; } }
@media (prefers-reduced-motion: reduce) { :where([data-theme="nuit"]) .snow { animation: none; } }

/* --- 🎂 Anniversaire : violet festif, confettis --- */
:root[data-theme="anniv"] {
    --red: #6a2bb3; --red-dark: #4f1f87;
    --green: #0f7a6c; --green-light: #e0f4f1;
    --gold: #ffb627;
    --bg: #f8f4ff; --card: #ffffff; --text: #2b2140; --muted: #6b5f80; --border: #e3d8f3;
    --chart-bar: #6a2bb3; --chart-bar-hover: #4f1f87; --chart-grid: #efe8fa; --chart-axis: #d6c8ec; --chart-hover: rgba(106, 43, 179, .06);
}
:where([data-theme="anniv"]) .site-header { background: linear-gradient(135deg, #7b35c9, #4f1f87); border-bottom: 3px solid #ffb627; }
:where([data-theme="anniv"]) .snow {
    opacity: .8;
    background-image:
        radial-gradient(4px 4px at 20px 30px, #ffb627, transparent),
        radial-gradient(3px 3px at 80px 120px, #ff5e8a, transparent),
        radial-gradient(4px 4px at 150px 60px, #2ec4b6, transparent),
        radial-gradient(3px 3px at 200px 180px, #8f5bdb, transparent);
}
:where([data-theme="anniv"]) .reveal { background: linear-gradient(160deg, #fff 60%, #efe3ff); }
:where([data-theme="anniv"]) .btn-light, :where([data-theme="anniv"]) .icon-btn, :where([data-theme="anniv"]) code { background: #efe8fa; }
:where([data-theme="anniv"]) .btn-light:hover { background: #e4d9f5; }

/* --- 💝 Saint-Valentin : framboise et rose poudré, petits cœurs --- */
:root[data-theme="valentin"] {
    --red: #b0174f; --red-dark: #86103b;
    --green: #7a3e9d; --green-light: #f3e9f9;
    --gold: #ff9cb8;
    --bg: #fff5f8; --card: #ffffff; --text: #3d1d2a; --muted: #85606f; --border: #f5d5e0;
    --chart-bar: #b0174f; --chart-bar-hover: #86103b; --chart-grid: #fbe7ee; --chart-axis: #efc6d5; --chart-hover: rgba(176, 23, 79, .06);
}
:where([data-theme="valentin"]) .site-header { background: linear-gradient(135deg, #c81d5e, #86103b); }
:where([data-theme="valentin"]) .snow {
    opacity: .6;
    background-image:
        radial-gradient(4px 4px at 20px 30px, #ff9cb8, transparent),
        radial-gradient(3px 3px at 80px 120px, #ffc2d4, transparent),
        radial-gradient(4px 4px at 150px 60px, #ff9cb8, transparent),
        radial-gradient(3px 3px at 200px 180px, #ffc2d4, transparent);
}
:where([data-theme="valentin"]) .reveal { background: linear-gradient(160deg, #fff 60%, #ffe3ec); }
:where([data-theme="valentin"]) .btn-light, :where([data-theme="valentin"]) .icon-btn, :where([data-theme="valentin"]) code { background: #fbe7ee; }
:where([data-theme="valentin"]) .btn-light:hover { background: #f7d6e2; }

/* --- 🐣 Pâques : vert tendre, jaune poussin et pastels --- */
:root[data-theme="paques"] {
    --red: #3f7d20; --red-dark: #2e5d17;
    --green: #a35c00; --green-light: #fff3d6;
    --gold: #ffd23f;
    --bg: #f7fbef; --card: #ffffff; --text: #26331c; --muted: #5f6d53; --border: #dfe9cf;
    --chart-bar: #3f7d20; --chart-bar-hover: #2e5d17; --chart-grid: #ecf3e0; --chart-axis: #cfdcb9; --chart-hover: rgba(63, 125, 32, .06);
}
:where([data-theme="paques"]) .site-header { background: linear-gradient(135deg, #4f9a2a, #2e5d17); border-bottom: 3px dashed #ffd23f; }
:where([data-theme="paques"]) .snow {
    opacity: .7;
    background-image:
        radial-gradient(4px 5px at 20px 30px, #ffd23f, transparent),
        radial-gradient(3px 4px at 80px 120px, #b8e0f6, transparent),
        radial-gradient(4px 5px at 150px 60px, #f7b8d2, transparent),
        radial-gradient(3px 4px at 200px 180px, #c9e7a7, transparent);
    animation: none;
}
:where([data-theme="paques"]) .reveal { background: linear-gradient(160deg, #fff 60%, #fff3c4); }
:where([data-theme="paques"]) .btn-light, :where([data-theme="paques"]) .icon-btn, :where([data-theme="paques"]) code { background: #ecf3e0; }
:where([data-theme="paques"]) .btn-light:hover { background: #e0ebcf; }

/* --- 🎃 Halloween : citrouille, violet sorcière, nuit noire --- */
:root[data-theme="halloween"] {
    --red: #c2410c; --red-dark: #9a3412;
    --green: #6b21a8; --green-light: #f3e8ff;
    --gold: #f97316;
    --bg: #fff6ed; --card: #ffffff; --text: #2a1a12; --muted: #74594a; --border: #f5dcc6;
    --chart-bar: #c2410c; --chart-bar-hover: #9a3412; --chart-grid: #fcebdc; --chart-axis: #efcfb3; --chart-hover: rgba(194, 65, 12, .06);
}
:where([data-theme="halloween"]) .site-header { background: linear-gradient(135deg, #1c1917, #4c1d95); border-bottom: 3px solid #f97316; }
:where([data-theme="halloween"]) .snow {
    opacity: .55;
    background-image:
        radial-gradient(3px 3px at 20px 30px, #f97316, transparent),
        radial-gradient(2px 2px at 80px 120px, #a855f7, transparent),
        radial-gradient(3px 3px at 150px 60px, #f97316, transparent),
        radial-gradient(2px 2px at 200px 180px, #a855f7, transparent);
}
:where([data-theme="halloween"]) .reveal { background: linear-gradient(160deg, #fff 60%, #ffe4cc); }
:where([data-theme="halloween"]) .btn-light, :where([data-theme="halloween"]) .icon-btn, :where([data-theme="halloween"]) code { background: #fcebdc; }
:where([data-theme="halloween"]) .btn-light:hover { background: #f8dcc4; }

/* --- 💐 Fête des mères / des pères : rose ancien et vert d'eau --- */
:root[data-theme="parents"] {
    --red: #b4436c; --red-dark: #8c3354;
    --green: #0f766e; --green-light: #e0f2f0;
    --gold: #f4a6b8;
    --bg: #fff8f5; --card: #ffffff; --text: #33232a; --muted: #7a6168; --border: #f1dcd9;
    --chart-bar: #b4436c; --chart-bar-hover: #8c3354; --chart-grid: #f9e8e6; --chart-axis: #ebcfcc; --chart-hover: rgba(180, 67, 108, .06);
}
:where([data-theme="parents"]) .site-header { background: linear-gradient(135deg, #c25b80, #8c3354); }
:where([data-theme="parents"]) .snow {
    opacity: .6; animation-duration: 45s;
    background-image:
        radial-gradient(4px 4px at 20px 30px, #f4a6b8, transparent),
        radial-gradient(3px 3px at 80px 120px, #9fd8d1, transparent),
        radial-gradient(4px 4px at 150px 60px, #f9c9d4, transparent),
        radial-gradient(3px 3px at 200px 180px, #9fd8d1, transparent);
}
:where([data-theme="parents"]) .reveal { background: linear-gradient(160deg, #fff 60%, #fde6ec); }
:where([data-theme="parents"]) .btn-light, :where([data-theme="parents"]) .icon-btn, :where([data-theme="parents"]) code { background: #f9e8e6; }
:where([data-theme="parents"]) .btn-light:hover { background: #f4d9d6; }

/* --- 🥂 Nouvel An : bleu minuit, or et paillettes --- */
:root[data-theme="nouvelan"] {
    --red: #1e3a8a; --red-dark: #172c69;
    --green: #8a6414; --green-light: #f6efdc;
    --gold: #d4af37;
    --bg: #f6f5f0; --card: #ffffff; --text: #1c2033; --muted: #5d6275; --border: #e2e0d6;
    --chart-bar: #1e3a8a; --chart-bar-hover: #172c69; --chart-grid: #ecebe4; --chart-axis: #d3d1c5; --chart-hover: rgba(30, 58, 138, .06);
}
:where([data-theme="nouvelan"]) .site-header { background: linear-gradient(135deg, #0f172a, #1e3a8a); border-bottom: 2px solid #d4af37; }
:where([data-theme="nouvelan"]) .snow {
    opacity: .7;
    background-image:
        radial-gradient(2px 2px at 20px 30px, #d4af37, transparent),
        radial-gradient(1.5px 1.5px at 90px 140px, #c0c0c0, transparent),
        radial-gradient(2px 2px at 160px 70px, #d4af37, transparent),
        radial-gradient(1.5px 1.5px at 210px 200px, #c0c0c0, transparent);
    animation: twinkle 3s ease-in-out infinite alternate;
}
:where([data-theme="nouvelan"]) .reveal { background: linear-gradient(160deg, #fff 60%, #f3ead0); }
:where([data-theme="nouvelan"]) .target-name { color: #8a6414; }
:where([data-theme="nouvelan"]) .btn-light, :where([data-theme="nouvelan"]) .icon-btn, :where([data-theme="nouvelan"]) code { background: #ecebe4; }
:where([data-theme="nouvelan"]) .btn-light:hover { background: #e1dfd5; }
@media (prefers-reduced-motion: reduce) { :where([data-theme="nouvelan"]) .snow { animation: none; } }

/* ===========================================================================
 * Liste de souhaits détaillée, profil cadeau
 * ========================================================================= */
.wish-row { display: flex; gap: 8px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.wish-row:first-child { padding-top: 0; }
.wish-move { display: flex; flex-direction: column; gap: 4px; }
.wish-move .icon-btn { width: 28px; height: 24px; border-radius: 6px; font-size: .7rem; }
.wish-fields { flex: 1; min-width: 0; }
.wish-fields input, .wish-fields select { margin-top: 0; }
.wish-sub { display: grid; grid-template-columns: 1fr 110px 1fr; gap: 6px; margin-top: 6px; }
.wish-sub input, .wish-sub select { padding: 7px 10px; font-size: .88rem; }
@media (max-width: 600px) { .wish-sub { grid-template-columns: 1fr 1fr; } .wish-sub input[name$="[url]"] { grid-column: 1 / -1; } }
#add-wish { margin-top: 10px; }
.profile-box { margin: 6px 0 4px; background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.profile-box summary { cursor: pointer; font-weight: 600; }
.profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 12px; }
@media (max-width: 600px) { .profile-grid { grid-template-columns: 1fr; } }
.wish-view { margin: 0 0 12px; padding-left: 22px; }
.wish-view li { margin-bottom: 8px; }
.wish-view .wish-title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.wish-view .wish-meta { display: block; font-size: .85rem; color: var(--muted); }
.profile-view { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; margin: 0; }
.profile-view div { background: var(--bg); border-radius: 8px; padding: 6px 10px; }
.profile-view dt { font-size: .8rem; color: var(--muted); }
.profile-view dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 600px) { .profile-view { grid-template-columns: 1fr; } }

/* ===========================================================================
 * QR code, affiche, mode soirée
 * ========================================================================= */
.qr { display: block; width: 100%; height: auto; border-radius: 8px; }
.join-share { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.join-qr { flex: 0 0 170px; background: #fff; padding: 6px; border-radius: 12px; border: 1px solid var(--border); }
.join-actions { flex: 1 1 280px; }
.party-box { background: var(--bg); border-radius: 12px; padding: 12px 14px; }
.party-box summary { cursor: pointer; font-weight: 700; }
.party-card { border: 2px dashed var(--gold); }
.party-screen { text-align: center; }
.party-screen h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.party-layout { display: flex; gap: 30px; justify-content: center; align-items: flex-start; flex-wrap: wrap; margin: 10px 0 18px; }
.party-qr { flex: 0 1 380px; background: #fff; border-radius: 18px; padding: 12px; box-shadow: var(--shadow); }
.party-scan { margin: 8px 0 0; font-size: 1.2rem; font-weight: 700; color: #2a2522; }
.party-names { flex: 1 1 260px; text-align: left; }
.party-count { font-size: 1.3rem; margin: 0 0 10px; }
.party-count strong { font-size: 2rem; color: var(--green); }
.party-names ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 18px; font-size: 1.15rem; }
.party-names li { padding: 4px 0; break-inside: avoid; color: var(--muted); }
.party-names li.is-done { color: var(--text); font-weight: 700; }
.party-pick { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 18px 0 6px; }
.party-pick form { margin: 0; }
.party-pick .btn { font-size: 1.1rem; padding: 12px 20px; }
.party-taken { opacity: .55; cursor: default; }

/* Paquet cadeau à ouvrir (découverte de la cible) */
.gift-reveal {
    position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px;
    background: radial-gradient(circle at 50% 40%, rgba(200, 16, 46, .92), rgba(60, 5, 15, .97));
}
.gift-box { border: none; background: none; cursor: pointer; color: #fff; font: inherit; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.gift-emoji { font-size: clamp(7rem, 30vw, 11rem); line-height: 1; animation: gift-wiggle 1.4s ease-in-out infinite; filter: drop-shadow(0 10px 25px rgba(0, 0, 0, .35)); }
.gift-label { font-size: 1.25rem; font-weight: 700; max-width: 420px; text-align: center; }
.gift-box:focus-visible { outline: 3px solid #fff; outline-offset: 10px; border-radius: 16px; }
.gift-reveal.is-opening { animation: gift-fade .7s ease forwards; }
.gift-reveal.is-opening .gift-emoji { animation: gift-pop .7s ease forwards; }
.reveal-pending .target-name { visibility: hidden; }
.reveal-done .target-name { animation: target-in .8s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes gift-wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(7deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(3deg); } }
@keyframes gift-pop { 40% { transform: scale(1.25); } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes gift-fade { to { opacity: 0; visibility: hidden; } }
@keyframes target-in { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .gift-emoji, .gift-reveal.is-opening, .gift-reveal.is-opening .gift-emoji, .reveal-done .target-name { animation: none; }
}

/* Affiche à imprimer */
.poster-tools { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.poster { text-align: center; max-width: 640px; margin: 0 auto; }
.poster-kicker { font-size: 1.3rem; font-weight: 800; color: var(--red); margin: 0; }
.poster h1 { font-size: clamp(2rem, 6vw, 3rem); }
.poster-lead { font-size: 1.2rem; }
.poster-qr { width: min(360px, 80%); margin: 10px auto; }
.poster .meta { justify-content: center; font-size: 1.05rem; }
.poster-url { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; color: var(--muted); word-break: break-all; }
@media print {
    .site-header, .site-footer, .snow, .no-print, .alert { display: none !important; }
    body, .container { background: #fff !important; color: #000 !important; }
    .poster { box-shadow: none; border: none; }
}

/* Page hors ligne : une seule langue affichée (voir offline.html) */
[data-l] { display: none; }
html[lang="fr"] [data-l="fr"], html[lang="en"] [data-l="en"], html[lang="de"] [data-l="de"] { display: block; }

/* Thèmes sombres : nouveaux éléments */
:where([data-theme="dark"], [data-theme="nuit"]) .join-qr { border-color: #4a423e; }

/* ===========================================================================
 * Mode entreprise, import CSV, messages rapides, organisateur participant, liste imprimable
 * ========================================================================= */
.group-mode { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 6px; }
.group-mode .checkbox { margin: 0; }
.file-pick { display: block; margin-top: 10px; font-size: .92rem; }
.file-pick input[type=file] { display: block; margin-top: 6px; font-size: .88rem; }
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.quick-chips .tag { font-size: .82rem; cursor: pointer; text-align: left; }
.safe-box { margin: 12px 0; background: var(--green-light); border-radius: 12px; padding: 10px 14px; }
.safe-box summary { cursor: pointer; font-weight: 700; }
.safe-box ul { margin-bottom: 0; padding-left: 20px; }
.print-table td { vertical-align: top; }
.print-check { width: 28px; font-size: 1.2rem; color: var(--muted); }
.print-url { color: var(--muted); overflow-wrap: anywhere; }
@media print {
    .print-list { box-shadow: none; border: none; padding: 0; }
    .print-list .print-url { color: #333 !important; }
}

/* ===========================================================================
 * Administration : barre de navigation latérale, groupes de boutons et menus d'actions
 * ========================================================================= */
.container:has(> .admin-layout) { max-width: 1260px; }
.admin-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.admin-main > .card:first-child { margin-top: 0; }
.admin-side {
    position: sticky; top: 16px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 14px 10px;
}
.admin-side .eyebrow { margin: 0 8px 8px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 600;
    border-left: 3px solid transparent;
}
.side-link:hover { background: var(--bg); }
.side-link.active { background: var(--bg); color: var(--red); border-left-color: var(--red); }
.side-link .badge { font-size: .75rem; }
.side-logout { margin: 12px 8px 0; padding-top: 12px; border-top: 1px solid var(--border); }
.side-logout .btn { width: 100%; }
@media (max-width: 820px) {
    .admin-layout { grid-template-columns: 1fr; gap: 12px; }
    .admin-side { position: static; padding: 8px; display: flex; align-items: center; gap: 8px; }
    .admin-side .eyebrow { display: none; }
    .side-nav { flex-direction: row; overflow-x: auto; flex: 1; }
    .side-link { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; }
    .side-link.active { border-bottom-color: var(--red); }
    .side-logout { margin: 0; padding: 0; border: none; }
    .side-logout .btn { width: auto; }
}

/* Groupe de boutons accolés : [Action principale][▾] */
td.cell-menu { white-space: nowrap; text-align: right; width: 1%; }
.btn-group { display: inline-flex; align-items: stretch; vertical-align: middle; }
.btn-group > form { margin: 0; display: flex; }
.btn-group > * > .btn, .btn-group > .btn, .btn-group summary.btn { border-radius: 0; margin: 0; height: 100%; }
.btn-group > :first-child, .btn-group > :first-child > .btn { border-top-left-radius: 9px; border-bottom-left-radius: 9px; }
.btn-group > :last-child > .btn, .btn-group > .btn:last-child, .btn-group > details:last-child > summary { border-top-right-radius: 9px; border-bottom-right-radius: 9px; }
.btn-group > * + * { border-left: 1px solid rgba(0, 0, 0, .12); }
.btn-group-danger:hover { background: #fdecee; color: #b3122e; }

/* Menu déroulant (details.menu) : la liste est placée par assets/app.js */
.menu { position: relative; display: flex; }
.menu > summary { list-style: none; cursor: pointer; padding-left: 10px; padding-right: 10px; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 60; min-width: 220px;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    padding: 6px; text-align: left; white-space: normal;
}
.menu-list form { margin: 0; }
.menu-list hr { border: none; border-top: 1px solid var(--border); margin: 4px 2px; }
.menu-item {
    display: block; width: 100%; padding: 8px 10px; border: none; border-radius: 8px; background: none;
    font: inherit; font-size: .9rem; color: var(--text); text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--bg); outline: none; }
.menu-danger { color: #b3122e; }
.menu-danger:hover, .menu-danger:focus-visible { background: #fdecee; }
:where([data-theme="dark"], [data-theme="nuit"]) .menu-danger { color: #ff9aa6; }
:where([data-theme="dark"], [data-theme="nuit"]) .menu-danger:hover { background: #3d1a20; }
.ticket-actions .btn-group { margin-left: auto; }

/* Administration : filtres rapides et actions groupées */
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 6px; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--card); color: var(--text); text-decoration: none; font-size: .88rem; font-weight: 600;
}
.filter-chip:hover { background: var(--bg); }
.filter-chip.active { background: var(--red); border-color: var(--red); color: #fff; }
.filter-count { font-size: .78rem; padding: 0 6px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.filter-chip.active .filter-count { background: rgba(255, 255, 255, .25); color: #fff; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 4px; }
.bulk-bar select { width: auto; margin: 0; padding: 6px 10px; font-size: .88rem; }
.bulk-count { font-size: .88rem; color: var(--muted); min-width: 80px; }
th.cell-check, td.cell-check { width: 1%; padding-right: 0; }
.cell-check input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.table tr.is-selected td { background: var(--green-light); }