/* =====================================================================
   Réservations St Marc — design system (glass UI, clair / sombre)
   Même base que Commandes St Marc, thème vert (principal) / orange (accent).
   ===================================================================== */

:root {
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --bg: #edf5ef;
    --blob-1: #86efac;
    --blob-2: #fdba74;
    --blob-3: #bef264;
    --blob-opacity: .5;

    --surface: rgba(255, 255, 255, .58);
    --surface-strong: rgba(255, 255, 255, .82);
    --surface-solid: #ffffff;
    --surface-hover: rgba(255, 255, 255, .7);
    --border: rgba(255, 255, 255, .75);
    --line: rgba(15, 23, 42, .08);

    --text: #0f172a;
    --text-2: #475569;
    --text-3: #8591a5;

    --primary: #16a34a;
    --primary-2: #22c55e;
    --primary-soft: rgba(22, 163, 74, .12);
    --primary-text: #15803d;
    --btn-1: #16a34a;
    --btn-2: #22c55e;

    --accent: #f97316;
    --accent-2: #fb923c;
    --accent-soft: rgba(249, 115, 22, .14);
    --accent-text: #c2410c;

    --brand: linear-gradient(135deg, #16a34a 0%, #84cc16 55%, #f97316 100%);

    --success: #16a34a;  --success-soft: rgba(22, 163, 74, .12);
    --warning: #d97706;  --warning-soft: rgba(217, 119, 6, .14);
    --danger: #dc2626;   --danger-soft: rgba(220, 38, 38, .11);
    --info: #2563eb;     --info-soft: rgba(37, 99, 235, .11);
    --teal: #0d9488;     --teal-soft: rgba(13, 148, 136, .13);
    --neutral: #64748b;  --neutral-soft: rgba(100, 116, 139, .12);

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -10px rgba(15, 23, 42, .14);
    --shadow-lg: 0 28px 64px -16px rgba(15, 23, 42, .3);
    --ring: 0 0 0 4px var(--primary-soft);
    --blur: saturate(180%) blur(22px);

    --r-xl: 22px;
    --r-lg: 18px;
    --r: 14px;
    --r-sm: 10px;
    --sidebar-w: 276px;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #07100b;
        --blob-1: #166534;
        --blob-2: #9a3412;
        --blob-3: #3f6212;
        --blob-opacity: .34;
        --surface: rgba(18, 30, 24, .55);
        --surface-strong: rgba(24, 38, 30, .82);
        --surface-solid: #142019;
        --surface-hover: rgba(255, 255, 255, .06);
        --border: rgba(255, 255, 255, .09);
        --line: rgba(255, 255, 255, .08);
        --text: #e8f0ea;
        --text-2: #a8b8ad;
        --text-3: #70807a;
        --primary: #4ade80;
        --primary-2: #86efac;
        --primary-soft: rgba(74, 222, 128, .16);
        --primary-text: #86efac;
        --btn-1: #15803d;
        --btn-2: #16a34a;
        --accent: #fb923c;
        --accent-2: #fdba74;
        --accent-soft: rgba(251, 146, 60, .16);
        --accent-text: #fdba74;
        --brand: linear-gradient(135deg, #22c55e 0%, #a3e635 55%, #fb923c 100%);
        --success: #4ade80;  --success-soft: rgba(74, 222, 128, .13);
        --warning: #fbbf24;  --warning-soft: rgba(251, 191, 36, .13);
        --danger: #f87171;   --danger-soft: rgba(248, 113, 113, .13);
        --info: #60a5fa;     --info-soft: rgba(96, 165, 250, .13);
        --teal: #2dd4bf;     --teal-soft: rgba(45, 212, 191, .13);
        --neutral: #94a3b8;  --neutral-soft: rgba(148, 163, 184, .13);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
        --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 16px 40px -12px rgba(0, 0, 0, .55);
        --shadow-lg: 0 32px 72px -16px rgba(0, 0, 0, .7);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #07100b;
    --blob-1: #166534;
    --blob-2: #9a3412;
    --blob-3: #3f6212;
    --blob-opacity: .34;
    --surface: rgba(18, 30, 24, .55);
    --surface-strong: rgba(24, 38, 30, .82);
    --surface-solid: #142019;
    --surface-hover: rgba(255, 255, 255, .06);
    --border: rgba(255, 255, 255, .09);
    --line: rgba(255, 255, 255, .08);
    --text: #e8f0ea;
    --text-2: #a8b8ad;
    --text-3: #70807a;
    --primary: #4ade80;
    --primary-2: #86efac;
    --primary-soft: rgba(74, 222, 128, .16);
    --primary-text: #86efac;
    --btn-1: #15803d;
    --btn-2: #16a34a;
    --accent: #fb923c;
    --accent-2: #fdba74;
    --accent-soft: rgba(251, 146, 60, .16);
    --accent-text: #fdba74;
    --brand: linear-gradient(135deg, #22c55e 0%, #a3e635 55%, #fb923c 100%);
    --success: #4ade80;  --success-soft: rgba(74, 222, 128, .13);
    --warning: #fbbf24;  --warning-soft: rgba(251, 191, 36, .13);
    --danger: #f87171;   --danger-soft: rgba(248, 113, 113, .13);
    --info: #60a5fa;     --info-soft: rgba(96, 165, 250, .13);
    --teal: #2dd4bf;     --teal-soft: rgba(45, 212, 191, .13);
    --neutral: #94a3b8;  --neutral-soft: rgba(148, 163, 184, .13);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 16px 40px -12px rgba(0, 0, 0, .55);
    --shadow-lg: 0 32px 72px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
}

/* --- Base ----------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
.icon { flex-shrink: 0; display: block; }
[hidden] { display: none !important; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.inline { display: inline-flex; margin: 0; }
.prose { white-space: normal; word-break: break-word; color: var(--text-2); }
code.code { font: 600 13px/1 ui-monospace, 'Cascadia Mono', Consolas, monospace; letter-spacing: .08em; padding: 4px 8px; border-radius: 8px; background: var(--neutral-soft); color: var(--text); }
code.code-lg { font-size: 22px; padding: 8px 14px; letter-spacing: .12em; }

/* --- Aurora background --------------------------------------------- */

.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora span {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: var(--blob-opacity);
    animation: drift 32s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { width: 560px; height: 560px; background: var(--blob-1); top: -180px; left: -120px; }
.aurora span:nth-child(2) { width: 660px; height: 660px; background: var(--blob-2); bottom: -240px; right: -180px; animation-delay: -11s; }
.aurora span:nth-child(3) { width: 420px; height: 420px; background: var(--blob-3); top: 32%; left: 48%; animation-delay: -21s; }
@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(90px, 60px) scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
    .aurora span { animation: none; }
    * { transition-duration: 0s !important; animation-duration: 0s !important; }
}

/* --- Glass ---------------------------------------------------------- */

.glass {
    background: var(--surface);
    border: 1px solid var(--border);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    box-shadow: var(--shadow);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass, .modal-card, .toast, .notice { background: var(--surface-solid); }
}

/* --- App shell ------------------------------------------------------ */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar { position: sticky; top: 0; height: 100vh; padding: 16px 0 16px 16px; z-index: 40; }
.sidebar-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: var(--r-xl);
    padding: 18px 14px 14px;
    overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: grid; place-items: center;
    color: #fff;
    background: var(--brand);
    box-shadow: 0 10px 22px -8px var(--primary);
    flex-shrink: 0;
}
.brand-logo.sm { width: 32px; height: 32px; border-radius: 10px; }
.brand-name { display: block; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand-sub { display: block; font-size: 12px; color: var(--text-3); }

.sidebar-cta { margin: 0 4px 6px; }

.nav-label {
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-3);
    padding: 16px 12px 6px;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px;
    border-radius: 12px;
    color: var(--text-2);
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.nav-count {
    margin-left: auto;
    min-width: 22px; height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 11.5px; font-weight: 700;
    display: grid; place-items: center;
}

.sidebar-foot {
    margin-top: auto;
    padding: 14px 4px 0;
    border-top: 1px solid var(--line);
    display: flex; align-items: center; gap: 8px;
}
.user-mini { flex: 1; min-width: 0; color: var(--text); padding: 4px 6px; margin: -4px -6px; }
.user-mini strong, .user-mini span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mini strong { font-size: 13.5px; font-weight: 600; }
.user-mini span { font-size: 12px; color: var(--text-3); }
.sidebar-foot form { margin: 0; }

.theme-toggle .i-sun { display: none; }
.theme-toggle[data-current="dark"] .i-sun { display: block; }
.theme-toggle[data-current="dark"] .i-moon { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 34px 32px 64px; }
.mobile-bar, .sidebar-backdrop { display: none; }

/* --- Page headers --------------------------------------------------- */

.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-head h1 { font-size: 26px; font-weight: 750; letter-spacing: -.025em; }
.page-sub { color: var(--text-2); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-actions form { margin: 0; }

.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-2);
    font-weight: 500; font-size: 13.5px;
    margin-bottom: 14px;
}
.back-link:hover { color: var(--text); text-decoration: none; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.hero-date { font-size: 13px; color: var(--text-3); font-weight: 500; }
.hero h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 2px; }
.hero p { color: var(--text-2); margin-top: 4px; }
.hero form { margin: 0; }

/* --- Layout helpers ------------------------------------------------- */

.stack { display: flex; flex-direction: column; gap: 20px; }
.grid { display: grid; gap: 20px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); align-items: start; }
.layout-detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }

/* --- Cards ---------------------------------------------------------- */

.card { border-radius: var(--r-lg); padding: 22px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head form { margin: 0; }
.card-flush > .card-head { padding: 20px 22px 0; margin-bottom: 14px; }
.card-head h2 { font-size: 15.5px; font-weight: 650; }
.card-head .sub { font-size: 12.5px; color: var(--text-3); font-weight: 500; margin-top: 2px; }
.card-head a.link { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.card-details > summary { list-style: none; cursor: pointer; padding: 20px 22px; margin: 0; }
.card-details > summary::-webkit-details-marker { display: none; }
.card-details > summary .icon { color: var(--text-3); transition: transform .2s; }
.card-details[open] > summary .icon { transform: rotate(180deg); }
.card-details[open] > summary { padding-bottom: 0; margin-bottom: 14px; }

.tone-neutral { background: var(--neutral-soft); color: var(--neutral); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-teal { background: var(--teal-soft); color: var(--teal); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-primary { background: var(--primary-soft); color: var(--primary-text); }
.tone-accent { background: var(--accent-soft); color: var(--accent-text); }

/* --- Stat cards ----------------------------------------------------- */

.stat {
    display: flex; align-items: center; gap: 16px;
    padding: 20px;
    border-radius: var(--r-lg);
    color: var(--text);
    transition: transform .18s, box-shadow .18s;
}
a.stat:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; flex-shrink: 0; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 500; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.kpi { padding: 10px 8px; border-radius: 12px; background: var(--surface-strong); border: 1px solid var(--line); text-align: center; }
.kpi strong { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 500; margin-top: 2px; }

/* --- Tiles ---------------------------------------------------------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tile {
    display: flex; align-items: center; gap: 14px;
    padding: 16px;
    border-radius: var(--r);
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--text);
    transition: border-color .15s, transform .15s;
}
.tile:hover { text-decoration: none; border-color: var(--primary); transform: translateY(-1px); }
.tile .stat-icon { width: 40px; height: 40px; border-radius: 12px; }
.tile strong { display: block; font-weight: 600; }
.tile span { display: block; font-size: 12.5px; color: var(--text-3); }
.tile > .icon:last-child { margin-left: auto; color: var(--text-3); }

/* --- Buttons -------------------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none !important;
    transition: transform .12s, box-shadow .15s, background .15s, filter .15s, opacity .15s;
}
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--btn-1), var(--btn-2)); box-shadow: 0 8px 20px -8px var(--primary); }
.btn-primary:hover:not([disabled]) { filter: brightness(1.07); box-shadow: 0 12px 26px -8px var(--primary); }
.btn-accent { color: #fff; background: linear-gradient(135deg, #ea580c, #f97316); box-shadow: 0 8px 20px -8px #f97316; }
.btn-accent:hover:not([disabled]) { filter: brightness(1.06); }
.btn-secondary { background: var(--surface-strong); border-color: var(--line); color: var(--text); }
.btn-secondary:hover { background: var(--surface-solid); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-success { color: #fff; background: linear-gradient(135deg, #15803d, #22c55e); box-shadow: 0 8px 20px -8px #16a34a; }
.btn-success:hover { filter: brightness(1.06); }
.btn-danger { color: #fff; background: linear-gradient(135deg, #dc2626, #f43f5e); box-shadow: 0 8px 20px -8px #dc2626; }
.btn-danger:hover { filter: brightness(1.06); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; gap: 6px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 13px; }
.btn-block { width: 100%; }

.btn-icon {
    width: 36px; height: 36px;
    display: inline-grid; place-items: center;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.btn-icon:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-icon.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-icon-sm { width: 26px; height: 26px; border-radius: 7px; }

/* --- Forms ---------------------------------------------------------- */

.form-grid { display: grid; gap: 16px; }
.form-grid > * { min-width: 0; }
.form-grid input, .form-grid textarea, .form-grid select { max-width: 100%; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-label .req { color: var(--danger); }
.field-hint { font-size: 12px; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; }
.field-error { font-size: 12.5px; color: var(--danger); font-weight: 500; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; }

:where(input:not([type=checkbox], [type=radio], [type=file], [type=hidden]), select, textarea) {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
:where(textarea) { height: auto; min-height: 92px; padding: 11px 14px; resize: vertical; line-height: 1.5; }
:where(select) {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238591a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
}
select option, select optgroup { background: var(--surface-solid); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); background-color: var(--surface-solid); }
input.is-invalid, select.is-invalid, textarea.is-invalid { border-color: var(--danger); }
::placeholder { color: var(--text-3); opacity: 1; }
.input-xs { width: 90px !important; height: 36px !important; padding: 0 10px !important; }

.input-affix { position: relative; }
.input-affix input { padding-right: 90px !important; }
.input-affix .affix {
    position: absolute; right: 13px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-3); font-size: 13px; font-weight: 500;
    pointer-events: none;
}

/* Toggle chips (checkbox) */
.toggle-group { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle-chip { position: relative; cursor: pointer; }
.toggle-chip input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-chip span {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--text-2);
    font-size: 13px; font-weight: 500;
    transition: background .15s, border-color .15s, color .15s;
    user-select: none;
}
.toggle-chip span .icon { display: none; }
.toggle-chip:hover span { border-color: var(--text-3); }
.toggle-chip input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); font-weight: 600; }
.toggle-chip input:checked + span .icon { display: block; }
.toggle-chip input:focus-visible + span { box-shadow: var(--ring); }
.toggle-days .toggle-chip span { width: 38px; padding: 0; font-weight: 700; }

/* Lignes de choix radio avec champ associé */
.radio-rows { display: flex; flex-direction: column; gap: 8px; }
.radio-row {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    cursor: pointer;
    font-size: 13.5px;
    transition: border-color .15s, background .15s;
}
.radio-row:hover { border-color: var(--text-3); }
.radio-row:has(input[type=radio]:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio-row input[type=radio] { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); flex-shrink: 0; }
.radio-row input:not([type=radio]) { width: auto; height: 36px; flex: 0 1 220px; }
.radio-row:not(:has(input[type=radio]:checked)) input:not([type=radio]) { opacity: .55; }

/* Switch */
.switch-row { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--text-2); }
.switch {
    appearance: none; -webkit-appearance: none;
    width: 40px; height: 24px;
    margin: 0;
    border-radius: 999px;
    background: var(--neutral-soft);
    border: 1px solid var(--line);
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .18s, border-color .18s;
}
.switch::before {
    content: "";
    position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .18s;
}
.switch:checked { background: var(--primary); border-color: var(--primary); }
.switch:checked::before { transform: translateX(16px); }
.switch:focus-visible { outline: none; box-shadow: var(--ring); }
.switch:disabled { opacity: .5; cursor: not-allowed; }

.rec-preview { padding: 12px 14px; border-radius: 12px; background: var(--primary-soft); color: var(--text-2); font-size: 13px; line-height: 1.5; }
.rec-preview:empty { display: none; }
.rec-preview strong { color: var(--primary-text); }

/* --- Status pills --------------------------------------------------- */

.status {
    display: inline-flex; align-items: center; gap: 6px;
    height: 24px; padding: 0 10px;
    border-radius: 999px;
    font-size: 12px; font-weight: 600;
    white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status .icon + *, .status > .icon { margin: 0; }
.status:has(> .icon)::before { display: none; }
.status-lg { height: 30px; padding: 0 14px; font-size: 13px; }
.status-ouvert { background: var(--success-soft); color: var(--success); }
.status-complet { background: var(--accent-soft); color: var(--accent-text); }
.status-cloture { background: var(--warning-soft); color: var(--warning); }
.status-en_cours { background: var(--info-soft); color: var(--info); }
.status-passe { background: var(--neutral-soft); color: var(--neutral); }
.status-annule { background: var(--danger-soft); color: var(--danger); }
.status-a_venir { background: var(--primary-soft); color: var(--primary-text); }
.status-actif, .status-compte_actif { background: var(--success-soft); color: var(--success); }
.status-desactive { background: var(--danger-soft); color: var(--danger); }
.status-inscrit { background: var(--primary-soft); color: var(--primary-text); }
.status-present { background: var(--success-soft); color: var(--success); }
.status-attendu { background: var(--neutral-soft); color: var(--neutral); }

.pill {
    display: inline-flex; align-items: center; gap: 5px;
    height: 22px; padding: 0 9px;
    border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
    background: var(--neutral-soft); color: var(--text-2);
    white-space: nowrap;
}
.pill.primary { background: var(--primary-soft); color: var(--primary-text); }
.pill.accent { background: var(--accent-soft); color: var(--accent-text); }
.pill.neutral { background: var(--neutral-soft); color: var(--text-2); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }

/* --- Avatars -------------------------------------------------------- */

.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: inline-grid; place-items: center;
    color: #fff;
    font-size: 12.5px; font-weight: 700;
    letter-spacing: .01em;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--surface-strong);
}
.avatar-sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar-lg { width: 46px; height: 46px; font-size: 15px; }

/* --- Bloc calendrier ------------------------------------------------ */

.cal {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    width: 58px; height: 62px;
    border-radius: 14px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    line-height: 1;
    flex-shrink: 0;
    color: var(--text);
}
.cal-dow { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.cal-day { font-size: 22px; font-weight: 800; letter-spacing: -.03em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.cal-month { font-size: 11px; font-weight: 600; color: var(--accent-text); text-transform: lowercase; }
.cal-sm { width: 46px; height: 50px; border-radius: 11px; }
.cal-sm .cal-dow { font-size: 9px; }
.cal-sm .cal-day { font-size: 18px; margin: 1px 0; }
.cal-sm .cal-month { font-size: 10px; }

/* --- Places (jauge) ------------------------------------------------- */

.places { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.places-bar { width: 72px; height: 6px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; flex-shrink: 0; }
.places-bar span { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width .3s; }
.places-warn .places-bar span { background: var(--accent); }
.places-full .places-bar span { background: var(--danger); }
.places-full .places-txt { color: var(--danger); }
.places-open { color: var(--text-2); }
.places-compact { font-size: 12px; }
.places-compact .places-bar { width: 56px; }

/* --- Cartes d'événements -------------------------------------------- */

.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin-top: 16px; }
.event-card {
    display: flex; gap: 16px; align-items: flex-start;
    padding: 18px;
    border-radius: var(--r-lg);
    color: var(--text);
    transition: transform .18s, box-shadow .18s, border-color .18s;
}
.event-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.event-card.is-annule, .event-card.is-passe { opacity: .7; }
.event-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.event-title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; word-break: break-word; }
.event-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--text-2); }
.event-meta > span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.event-meta .icon { color: var(--text-3); }
.event-more { color: var(--accent-text); font-weight: 600; }
.event-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.event-badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* --- Détail d'un événement ------------------------------------------ */

.detail-head { border-radius: var(--r-lg); padding: 24px; margin-bottom: 20px; }
.detail-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.detail-main { flex: 1 1 420px; min-width: 0; }
.detail-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-title h1 { font-size: 25px; font-weight: 800; letter-spacing: -.025em; word-break: break-word; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; color: var(--text-2); font-size: 13.5px; }
.detail-meta > span { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.detail-meta .icon { color: var(--text-3); }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.date-list { display: flex; flex-direction: column; gap: 8px; }
.date-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    grid-template-areas: "cal main places state actions";
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
}
.date-row.is-annule, .date-row.is-passe { opacity: .72; }
.date-row.is-annule .cal, .date-row.is-passe .cal { filter: grayscale(1); }
.date-row > .cal { grid-area: cal; }
.date-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.date-main strong { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-main span { font-size: 12.5px; color: var(--text-3); }
.date-places { grid-area: places; }
.date-state { grid-area: state; }
.date-actions { grid-area: actions; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.date-actions form { margin: 0; }
.date-archive { margin-top: 14px; }
.date-archive > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 6px 0 12px; }
.date-archive > summary::-webkit-details-marker { display: none; }
.date-archive > summary .icon { transition: transform .2s; }
.date-archive[open] > summary .icon { transform: rotate(180deg); }

.action-card p { color: var(--text-2); font-size: 13.5px; }
.action-stack { display: flex; flex-direction: column; gap: 8px; }
.action-stack form { margin: 0; }

.notice {
    display: flex; gap: 14px;
    padding: 16px 18px;
    border-radius: var(--r-lg);
    background: var(--surface-strong);
    border: 1px solid var(--border);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    box-shadow: var(--shadow);
    font-size: 13.5px;
}
.notice-danger { border-left: 4px solid var(--danger); }
.notice-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.notice strong { display: block; font-size: 14px; margin-bottom: 2px; }
.notice p { color: var(--text-2); word-break: break-word; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 34px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.tl-dot { position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.tl-title { font-size: 13px; font-weight: 500; color: var(--text); word-break: break-word; }
.tl-meta { font-size: 12px; color: var(--text-3); }

/* --- Tables --------------------------------------------------------- */

.table-wrap { overflow-x: auto; container: liste / inline-size; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    font-size: 11.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-3);
    padding: 12px 22px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: 14px 22px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr[data-href] { cursor: pointer; transition: background .12s; }
.table tbody tr[data-href]:hover { background: var(--surface-hover); }
.cell-title a { color: var(--text); font-weight: 600; }
.cell-title strong { display: block; font-weight: 600; }
.cell-sub { display: block; font-size: 12.5px; color: var(--text-3); max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-user { display: flex; align-items: center; gap: 10px; white-space: nowrap; min-width: 0; }
.cell-date { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.cell-nowrap { white-space: nowrap; }
.col-action { width: 1%; white-space: nowrap; text-align: right; }
.col-action form { margin: 0; vertical-align: middle; }
.col-action .btn, .col-action .btn-icon { vertical-align: middle; }
.col-action > * + * { margin-left: 4px; }
.col-num { width: 44px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.participants-table tr.is-present td { background: var(--success-soft); }

/* --- Toolbar / filters ---------------------------------------------- */

.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    padding: 14px 22px;
    border-bottom: 1px solid var(--line);
}
.toolbar-free { border: none; padding: 0; margin-bottom: 4px; }
.toolbar-title { font-size: 15.5px; font-weight: 650; }
.toolbar-info { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 340px; display: block; }
.search-lg { max-width: 460px; }
.search .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input { padding-left: 40px !important; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
    display: inline-flex; align-items: center; gap: 5px;
    height: 32px; padding: 0 13px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text-2);
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.chip:hover { background: var(--surface-hover); color: var(--text); }
.chip.active { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; font-weight: 600; }
.filter-empty { padding: 32px; text-align: center; color: var(--text-3); }
.toolbar-stack { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
.toolbar-stack > * { min-width: 0; max-width: 100%; }
.toolbar-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar-row > * { min-width: 0; }
.toolbar-row .search { max-width: none; flex: 1 1 240px; }
.toolbar-select { width: auto !important; min-width: 170px; flex: 0 1 220px; height: 38px !important; font-size: 13px !important; }
.toolbar-select-wide { flex: 1 1 360px; max-width: 100%; }
.toolbar select, .toolbar input { max-width: 100%; }

/* --- Empty states --------------------------------------------------- */

.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-sm { padding: 28px 16px; }
.empty-icon {
    width: 56px; height: 56px;
    border-radius: 18px;
    display: grid; place-items: center;
    background: var(--primary-soft); color: var(--primary-text);
    margin-bottom: 6px;
}
.empty-sm .empty-icon { width: 44px; height: 44px; border-radius: 14px; }
.empty h3 { font-size: 16px; font-weight: 650; }
.empty p { color: var(--text-2); max-width: 400px; }
.empty .btn, .empty form { margin-top: 10px; }

/* --- Mini list ------------------------------------------------------ */

.mini-list { display: flex; flex-direction: column; margin: -6px -10px; }
.mini-row {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 10px;
    border-radius: 12px;
    color: var(--text);
    transition: background .12s;
}
.mini-row:hover { background: var(--surface-hover); text-decoration: none; }
.mini-main { flex: 1; min-width: 0; }
.mini-main strong { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-main span { display: block; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-end { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }

/* --- Billet (QR code) ----------------------------------------------- */

.ticket-wrap { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.ticket { border-radius: var(--r-xl); padding: 26px 28px; position: relative; overflow: hidden; }
.ticket::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 6px; background: var(--brand); }
.ticket.is-present::before { background: var(--success); }
.ticket.is-annule::before, .ticket.is-passe::before { background: var(--neutral); }
.ticket.is-annule .qr-box, .ticket.is-passe .qr-box { opacity: .3; filter: grayscale(1); }
.ticket-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ticket-brand { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.ticket-title { font-size: 24px; font-weight: 800; letter-spacing: -.025em; word-break: break-word; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13.5px; color: var(--text-2); }
.ticket-meta > span { display: inline-flex; align-items: center; gap: 7px; }
.ticket-meta .icon { color: var(--text-3); }
.ticket-body { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "qr person" "qr code"; gap: 12px 24px; align-items: center; margin: 22px 0 18px; padding: 20px; border-radius: 18px; background: var(--surface-solid); border: 1px solid var(--line); }
.qr-box { grid-area: qr; width: 200px; height: 200px; padding: 8px; background: #fff; border-radius: 12px; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.ticket-person { grid-area: person; display: flex; align-items: center; gap: 12px; min-width: 0; }
.ticket-person strong { display: block; font-size: 16px; font-weight: 700; }
.ticket-person span { display: block; font-size: 13px; word-break: break-all; }
.ticket-code { grid-area: code; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ticket-code .k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.ticket-hint { color: var(--text-2); font-size: 13.5px; }
.ticket-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.ticket-actions form { margin: 0; }

/* --- Scanner -------------------------------------------------------- */

.scanner { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.scanner-card { grid-row: span 2; }
.scan-view { position: relative; margin-top: 16px; border-radius: 16px; overflow: hidden; background: #0b1410; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; color: #d6e3da; }
.scan-placeholder p { max-width: 320px; font-size: 13.5px; }
.scan-placeholder .empty-icon { background: rgba(255, 255, 255, .1); color: #fff; }
.scan-frame { position: absolute; inset: 14%; pointer-events: none; }
.scan-frame span { position: absolute; width: 34px; height: 34px; border: 3px solid var(--accent); }
.scan-frame span:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.scan-frame span:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.scan-frame span:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.scan-frame span:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }
.scan-view.is-hit { box-shadow: inset 0 0 0 6px var(--success); }
.scan-view.is-miss { box-shadow: inset 0 0 0 6px var(--danger); }
.scan-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.scan-status { flex: 1; }
.scan-manual { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.scan-manual-row { display: flex; gap: 8px; }
.scan-manual-row input { flex: 1; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; letter-spacing: .1em; text-transform: uppercase; }
.scanner-result { border-left: 5px solid var(--neutral); animation: pop .2s ease-out; }
.scanner-result.is-success { border-left-color: var(--success); }
.scanner-result.is-warning { border-left-color: var(--warning); }
.scanner-result.is-danger { border-left-color: var(--danger); }
.scanner-result.is-primary { border-left-color: var(--primary); }
.scan-result-head { display: flex; gap: 14px; align-items: flex-start; }
.scan-result-head h2 { font-size: 18px; font-weight: 750; }
.scan-result-head p { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.scan-result-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; }
.scan-result-details { margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.scan-result-details > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; font-size: 13.5px; }
.scan-result-details dt { color: var(--text-3); font-weight: 500; }
.scan-result-details dd { margin: 0; font-weight: 600; word-break: break-word; }
.scan-result-details:empty { display: none; }
.scanner-result .ticket-actions { margin-top: 18px; justify-content: flex-start; }
.scan-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.scan-log li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-strong); border: 1px solid var(--line); font-size: 13px; }
.scan-log li .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--neutral); }
.scan-log li.is-ok .dot { background: var(--success); }
.scan-log li.is-warn .dot { background: var(--warning); }
.scan-log li.is-ko .dot { background: var(--danger); }
.scan-log li strong { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-log li time { color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* --- Dialogs -------------------------------------------------------- */

.modal {
    padding: 16px;
    border: none;
    background: transparent;
    width: 100%; height: 100%;
    max-width: none; max-height: none;
    margin: 0;
    color: var(--text);
}
.modal[open] { display: flex; align-items: center; justify-content: center; }
.modal::backdrop { background: rgba(8, 20, 12, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal-card {
    width: min(640px, 100%);
    max-height: calc(100vh - 32px);
    overflow: auto;
    margin: 0;
    border-radius: var(--r-xl);
    background: var(--surface-strong);
    border: 1px solid var(--border);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    box-shadow: var(--shadow-lg);
    animation: pop .2s ease-out;
}
.modal-sm .modal-card { width: min(460px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal-head h2 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 18px 22px; }
.modal-body > p { color: var(--text-2); font-size: 13.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 4px 22px 22px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.confirm-body { display: flex; gap: 14px; padding: 22px 22px 18px; }
.confirm-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); flex-shrink: 0; }
.confirm-icon.danger { background: var(--danger-soft); color: var(--danger); }
.confirm-body h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.confirm-body p { color: var(--text-2); font-size: 13.5px; }

/* --- Administration ------------------------------------------------- */

.quick-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.qf {
    display: inline-flex; align-items: baseline; gap: 7px;
    padding: 8px 14px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    color: var(--text-2);
    font-size: 13px; font-weight: 500;
    transition: background .15s, border-color .15s;
}
.qf strong { color: var(--text); font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; }
.qf:hover { text-decoration: none; background: var(--surface-strong); }
.qf.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); }
.qf.active strong { color: var(--primary-text); }
.qf-warn strong { color: var(--warning); }

.bulk-bar {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 22px;
    background: var(--primary-soft);
    border-bottom: 1px solid var(--line);
    margin: 0;
}
.bulk-bar select { width: auto; height: 34px; font-size: 13px; }
.bulk-count { color: var(--primary-text); font-size: 13.5px; margin-right: 4px; }

.users-table .col-check { width: 44px; padding-right: 0; }
.users-table .col-check input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.users-table tr.is-inactive td:not(.col-action) { opacity: .55; }
.users-table tr.is-selected { background: var(--primary-soft); }
.role-pills { display: flex; flex-wrap: wrap; gap: 4px; max-width: 360px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid var(--line); font-size: 13px; }
.pager-links { display: flex; align-items: center; gap: 10px; }
.pager-pos { color: var(--text-2); font-weight: 600; }

.role-choices { display: flex; flex-direction: column; gap: 8px; }
.role-choice { position: relative; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.role-choice input { position: absolute; opacity: 0; pointer-events: none; }
.role-choice-body {
    flex: 1;
    display: flex; flex-direction: column;
    padding: 11px 48px 11px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.role-choice-body strong { font-weight: 650; }
.role-choice-body span { font-size: 12.5px; color: var(--text-3); }
.role-choice:hover .role-choice-body { border-color: var(--text-3); }
.role-choice input:checked + .role-choice-body { border-color: var(--primary); background: var(--primary-soft); }
.role-choice input:focus-visible + .role-choice-body { box-shadow: var(--ring); }
.role-choice input:disabled + .role-choice-body { opacity: .6; }
.role-choice-check {
    position: absolute; right: 16px;
    width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center;
    border: 1.5px solid var(--line);
    color: transparent;
    transition: background .15s, border-color .15s, color .15s;
}
.role-choice input:checked ~ .role-choice-check { background: var(--primary); border-color: var(--primary); color: #fff; }

/* --- Toasts --------------------------------------------------------- */

.toasts { position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 13px 12px 13px 14px;
    border-radius: 16px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toast-in .35s cubic-bezier(.2, .9, .3, 1.15);
}
.toast.leaving { animation: toast-out .25s ease-in forwards; }
.toast-icon { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.toast-success .toast-icon { background: var(--success-soft); color: var(--success); }
.toast-error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast-warning .toast-icon { background: var(--warning-soft); color: var(--warning); }
.toast-msg { flex: 1; font-size: 13.5px; font-weight: 500; padding-top: 5px; }
.toast-close { border: none; background: none; color: var(--text-3); cursor: pointer; padding: 5px; border-radius: 8px; display: grid; place-items: center; }
.toast-close:hover { background: var(--surface-hover); color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(28px); } }

/* --- Auth & errors -------------------------------------------------- */

.auth-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 18px; }
.auth-card { width: 100%; max-width: 420px; border-radius: 26px; padding: 40px 32px 26px; text-align: center; }
.auth-logo {
    width: 62px; height: 62px;
    border-radius: 19px;
    margin: 0 auto 22px;
    display: grid; place-items: center;
    color: #fff;
    background: var(--brand);
    box-shadow: 0 18px 36px -12px var(--primary);
}
.auth-card h1 { font-size: 25px; font-weight: 800; letter-spacing: -.025em; }
.auth-card > p { color: var(--text-2); margin: 10px 0 28px; }
.btn-ms {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    height: 50px;
    border-radius: 14px;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    color: var(--text);
    font-weight: 600; font-size: 15px;
    box-shadow: var(--shadow-sm);
    transition: transform .12s, box-shadow .15s, border-color .15s;
}
.btn-ms:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--primary); }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-3); }
.auth-legal { font-size: 12px; color: var(--text-3); }
.auth-theme { position: fixed; top: 16px; right: 16px; }

.error-wrap { min-height: 60vh; display: grid; place-items: center; }
.auth-shell .error-wrap { min-height: auto; }
.error-card { width: 100%; max-width: 440px; text-align: center; border-radius: 24px; padding: 40px 32px; }
.error-code {
    font-size: 68px; font-weight: 800; letter-spacing: -.05em; line-height: 1;
    background: var(--brand);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.error-card h1 { font-size: 20px; margin: 14px 0 8px; }
.error-card p { color: var(--text-2); margin-bottom: 24px; }

/* --- Impression du billet ------------------------------------------- */

@media print {
    .aurora, .sidebar, .mobile-bar, .sidebar-backdrop, .toasts, .no-print, .theme-toggle { display: none !important; }
    .app { display: block; }
    .content { padding: 0; max-width: none; }
    body { background: #fff; }
    .glass, .ticket-body { box-shadow: none; background: #fff; }
}

/* --- Responsive ----------------------------------------------------- */

@media (max-width: 1180px) {
    .layout-detail { grid-template-columns: minmax(0, 1fr); }
    .scanner { grid-template-columns: minmax(0, 1fr); }
    .scanner-card { grid-row: auto; }
}

@media (max-width: 1024px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0;
        width: min(var(--sidebar-w), 86vw);
        padding: 12px;
        transform: translateX(-105%);
        transition: transform .28s cubic-bezier(.2, .8, .2, 1);
    }
    .app.nav-open .sidebar { transform: none; }
    .sidebar-backdrop {
        display: block;
        position: fixed; inset: 0;
        z-index: 39;
        background: rgba(8, 20, 12, .42);
        opacity: 0; pointer-events: none;
        transition: opacity .25s;
    }
    .app.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
    .mobile-bar {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        position: sticky; top: 12px; z-index: 30;
        margin: 12px 16px 0;
        padding: 8px 10px;
        border-radius: 16px;
    }
    .mobile-bar .brand { padding: 0; gap: 10px; }
    .content { padding: 24px 16px 56px; }
    .toasts { top: 84px; }
}

/* Tableaux : s'adaptent à la place réelle dans la carte (menu latéral ouvert ou non). */
@container liste (max-width: 1180px) {
    .table th { white-space: normal; }
    .table th, .table td { padding-left: 10px; padding-right: 10px; }
    .table th:first-child, .table td:first-child { padding-left: 20px; }
    .table .cell-user { gap: 8px; }
    .table .cell-sub { max-width: 220px; }
    .table .cell-nowrap, .users-table .nowrap { white-space: normal; min-width: 64px; }
}
@container liste (max-width: 900px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { position: relative; padding: 14px 16px; border-bottom: 1px solid var(--line); }
    .table-stack tbody tr:last-child { border-bottom: none; }
    .table-stack td, .table-stack td:first-child { padding: 3px 0; border: none !important; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
    .table-stack td::before { content: attr(data-label); flex-shrink: 0; font-size: 12px; color: var(--text-3); font-weight: 500; }
    .table-stack td > * { min-width: 0; }
    .table-stack td[data-label="Événement"], .table-stack td[data-label="Utilisateur"], .table-stack td[data-label="Participant"] { display: block; padding: 0 40px 8px 0; }
    .table-stack td[data-label="Événement"]::before, .table-stack td[data-label="Utilisateur"]::before, .table-stack td[data-label="Participant"]::before { display: none; }
    .table-stack td.col-check { position: absolute; top: 12px; right: 12px; width: auto; padding: 4px; display: block; }
    .table-stack td.col-check::before, .table-stack td.col-action::before, .table-stack td.col-num::before { content: none; }
    .table-stack td.col-num { display: none; }
    .table-stack td.col-action { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 6px; padding-top: 10px; width: 100%; }
    .table-stack td.col-action > * + * { margin-left: 0; }
    .table-stack .cell-sub { max-width: none; white-space: normal; }
    .table-stack td[data-label="Date"] { display: block; padding-bottom: 8px; }
    .table-stack td[data-label="Date"]::before { display: none; }
    .participants-table tr.is-present { background: var(--success-soft); }
    .participants-table tr.is-present td { background: transparent; }
}

@media (max-width: 760px) {
    body { font-size: 14px; }
    .cols-2, .cols-3, .grid-cards { grid-template-columns: minmax(0, 1fr); }
    .page-head h1 { font-size: 22px; }
    .hero h1 { font-size: 24px; }
    .page-head, .hero { align-items: stretch; }
    .page-actions, .page-actions form, .hero form { width: 100%; }
    .page-actions .btn, .hero .btn { width: 100%; }
    .card { padding: 18px; }
    .card.card-flush { padding: 0; }
    .card-flush > .card-head { padding: 18px 16px 0; }
    .card-details > summary { padding: 18px 16px; }
    .detail-head { padding: 18px; }
    .detail-title h1 { font-size: 21px; }
    .detail-actions, .detail-actions .btn { width: 100%; }
    .card-head { flex-wrap: wrap; }
    .card-head > form, .card-head > form .btn { width: 100%; }
    .event-grid { grid-template-columns: minmax(0, 1fr); }
    .date-row { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "cal main" "places state" "actions actions"; gap: 10px 12px; }
    .date-actions { justify-content: flex-start; }
    .date-state { justify-self: end; }
    .kpis { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .kpi strong { font-size: 18px; }
    .toolbar { padding: 14px 16px; }
    .toolbar-row .search, .search { max-width: none; min-width: 0; flex: 1 1 100%; }
    .toolbar-select { flex: 1 1 100%; min-width: 0; }
    .bulk-bar { padding: 10px 16px; }
    .pager { padding: 14px 16px; }
    .ticket { padding: 20px 18px; }
    .ticket-title { font-size: 20px; }
    .ticket-body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "qr" "person" "code"; justify-items: center; text-align: center; padding: 16px; }
    .ticket-person { flex-direction: column; }
    .ticket-code { align-items: center; }
    .ticket-actions .btn, .ticket-actions form { width: 100%; }
    .scan-result-details > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .scan-manual-row { flex-direction: column; }
    .radio-row input:not([type=radio]) { flex-basis: 100%; }
    .toasts { top: auto; bottom: 16px; right: 16px; left: 16px; width: auto; }
    .modal { padding: 10px; align-items: flex-end !important; }
    .modal-card { max-height: calc(100vh - 20px); }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .btn { width: 100%; }
    .form-actions { flex-direction: column-reverse; align-items: stretch; }
}
