/* ==========================================================================
   Ligue de Billard — design system
   Palette drawn from the table itself: felt, ivory cue ball, cue chalk,
   walnut rail. Diamond dividers echo the sight marks inlaid on a real
   cushion rail (8 per long rail) — the one motif repeated throughout.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@600;700;800;900&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&family=Space+Mono:wght@400;700&display=swap');

:root {
    --felt: #1b4b3d;
    --felt-deep: #0e2e26;
    --ivory: #f6f1e4;
    --ivory-dim: #ece3cd;
    --chalk: #3e9c97;
    --chalk-deep: #2c726e;
    --walnut: #7a4b27;
    --walnut-dim: #a9805a;
    --ink: #1b211e;
    --ink-soft: #4b524d;

    --ball-tournoi: #b3272d;
    --ball-entrainement: #d99a1f;
    --ball-autre: #55645c;
    --ball-stage: var(--chalk);
    --ball-formation: var(--walnut);

    --font-display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
    --font-body: 'Source Serif 4', Georgia, serif;
    --font-mono: 'Space Mono', 'Courier New', monospace;

    --measure: 68ch;
    --radius: 3px;
    --shadow: 0 2px 10px rgba(14, 46, 38, 0.16);
}

/* -- Reset ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }

body {
    margin: 0;
    background: var(--ivory);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--chalk-deep); }
a:hover { color: var(--felt); }

input[type="checkbox"], input[type="radio"] { accent-color: var(--felt); }

:focus-visible {
    outline: 3px solid var(--chalk);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* -- Scroll-reveal (progressive enhancement) --------------------------------
   Visible by default; only hidden-then-revealed once `.js` confirms motion.js
   loaded, so a JS failure never leaves content stuck at opacity 0.
   -------------------------------------------------------------------------- */

.js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: calc(var(--i, 0) * 70ms);
}

.js .reveal.is-visible { opacity: 1; transform: translateY(0); }

/* -- Type ------------------------------------------------------------------ */

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.05;
    color: var(--felt-deep);
    margin: 0 0 0.5rem;
}

h2, h3 { margin-top: 4rem; }

h1 { font-size: clamp(2.1rem, 4vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1rem; max-width: var(--measure); }

.eyebrow {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--chalk-deep);
    margin-bottom: 0.6rem;
}

.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: var(--measure); }

/* -- Hero (landing / events page) -------------------------------------------- */

.hero { padding: 1.5rem 0 0.5rem; max-width: 46rem; }

.hero h1 { max-width: 20ch; }

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin: 1.7rem 0 0.6rem;
}

.hero__actions .btn { padding: 0.75rem 1.4rem; font-size: 0.86rem; }

/* -- Full-bleed section wrapper: break a block out of main's max-width ------ */

.full-bleed {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.full-bleed__inner {
    max-width: 68rem;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* -- Landing hero: felt canvas with the diamond motif + ball accents -------- */

.hero--landing {
    position: relative;
    overflow: hidden;
    background: radial-gradient(120% 90% at 50% 10%, #235e4c 0%, var(--felt) 45%, var(--felt-deep) 100%);
    color: var(--ivory);
    padding: 3rem 0 3.5rem;
    margin-top: -2.5rem;
    max-width: none;
}

.hero--landing .eyebrow { color: var(--chalk); }
.hero--landing h1 { color: var(--ivory); }
.hero--landing .lede { color: var(--ivory-dim); }

.hero--landing .btn--ghost {
    color: var(--ivory);
    border-color: rgba(246, 241, 228, 0.5);
}

.hero--landing .btn--ghost:hover {
    background: rgba(246, 241, 228, 0.12);
    border-color: var(--ivory);
    color: var(--ivory);
}

.hero-diamonds {
    position: absolute;
    inset: -10% -5%;
    opacity: 0.5;
    pointer-events: none;
    will-change: transform;
}

.hero-diamonds span {
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--chalk);
    transform: rotate(45deg);
    opacity: 0.3;
}

.hero-ball {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(0.5px);
}

.hero-ball--lg { width: 160px; height: 160px; right: 8%; top: 12%; }
.hero-ball--sm { width: 88px; height: 88px; right: 22%; top: 50%; }

code, .mono { font-family: var(--font-mono); }

/* -- Layout shell ----------------------------------------------------------- */

.site-header {
    background: var(--felt);
    color: var(--ivory);
    position: sticky;
    top: 0;
    z-index: 40;
    transition: box-shadow 0.3s ease;
}

.site-header--scrolled { box-shadow: 0 4px 24px rgba(14, 46, 38, 0.35); }

.site-header__bar {
    max-width: 68rem;
    margin: 0 auto;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    transition: padding 0.3s ease;
}

.site-header--scrolled .site-header__bar { padding: 0.55rem 1.5rem; }

.brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: 0.02em;
    color: var(--ivory);
    text-decoration: none;
    white-space: nowrap;
}

.brand:hover { color: var(--chalk); }

.site-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 1.1rem;
    min-width: 0;
    flex: 1 1 auto;
}

.site-nav a,
.site-nav .nav-form button {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ivory);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0.3rem 0;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav .nav-form button:hover {
    color: var(--chalk);
    border-bottom-color: var(--chalk);
}

.nav-form { display: inline; margin: 0; }

/* Account cluster (admin menu / account / sign out) gets a divider from the
   player-facing links — border-based so it never strands as an orphaned
   separator when the nav wraps. */
.nav-account {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 1.1rem;
    padding-left: 1.1rem;
    border-left: 1px solid rgba(246, 241, 228, 0.25);
}

.nav-dropdown { position: relative; }

.nav-dropdown > summary {
    list-style: none;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ivory-dim);
    padding: 0.3rem 0;
    border-bottom: 2px solid transparent;
}

.nav-dropdown > summary::-webkit-details-marker { display: none; }
.nav-dropdown > summary::marker { content: ''; }

.nav-dropdown > summary::after {
    content: '\25BE';
    margin-left: 0.4em;
    font-size: 0.75em;
}

.nav-dropdown > summary:hover,
.nav-dropdown[open] > summary {
    color: var(--chalk);
    border-bottom-color: var(--chalk);
}

.nav-dropdown__menu {
    position: absolute;
    top: calc(100% + 0.8rem);
    left: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    min-width: 11rem;
    padding: 0.4rem;
    background: var(--felt-deep);
    border: 1px solid rgba(246, 241, 228, 0.2);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(14, 46, 38, 0.45);
}

.nav-dropdown__menu a {
    padding: 0.55rem 0.7rem;
    border-bottom: none;
    border-radius: var(--radius);
}

.nav-dropdown__menu a:hover { background: rgba(246, 241, 228, 0.1); }

main {
    max-width: 68rem;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

.site-footer {
    background: var(--felt-deep);
    color: var(--ivory-dim);
    margin-top: 3rem;
}

.site-footer__bar {
    max-width: 68rem;
    margin: 0 auto;
    padding: 1.6rem 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}

.site-footer p { margin: 0; max-width: none; }

/* -- Signature: diamond rail divider ---------------------------------------
   Echoes the diamond sight marks inlaid along a cushion rail — used as the
   one recurring structural device, nowhere else in the page.
   -------------------------------------------------------------------------- */

.rail-divider {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2.4rem;
    margin: 0;
    padding: 0.6rem 0;
}

.rail-divider li {
    width: 7px;
    height: 7px;
    background: var(--walnut-dim);
    transform: rotate(45deg);
    opacity: 0.75;
}

.site-header .rail-divider { border-top: 1px solid rgba(246, 241, 228, 0.15); }
.site-header .rail-divider li { background: var(--chalk); opacity: 0.9; }

.rail-divider--section li { background: var(--walnut-dim); }

/* -- Usurpation d'identité ---------------------------------------------------
   Fond walnut : couleur d'avertissement pas déjà prise par .badge--warn
   (ball-entrainement) ni par .erreur (ball-tournoi), pour que ce bandeau se
   distingue visuellement de tout le reste — il doit rester visible en
   permanence tant que l'admin navigue sous l'identité d'un autre compte. */

.impersonation-banner {
    background: var(--walnut);
    color: var(--ivory);
    font-family: var(--font-body);
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    text-align: center;
}

.impersonation-banner .nav-form button {
    background: transparent;
    border: 2px solid var(--ivory);
    color: var(--ivory);
    padding: 0.35rem 0.8rem;
}

.impersonation-banner .nav-form button:hover {
    background: var(--ivory);
    color: var(--walnut);
}

/* -- Mode maintenance ---------------------------------------------------------
   Fond ball-tournoi (même rouge que .erreur/.badge--danger) : contrairement
   à .impersonation-banner (walnut, un simple rappel passif), cette pop-up
   bloque la page tant qu'elle n'a pas été accusée réception — le rouge, plus
   sévère que l'orange, doit refléter que c'est plus qu'un avertissement
   informatif : une coupure de service est imminente. */

.maintenance-dialog {
    background: var(--ball-tournoi);
    color: #fff;
    font-family: var(--font-body);
    border: none;
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 24rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.maintenance-dialog::backdrop {
    background: rgba(27, 33, 30, 0.6);
}

.maintenance-dialog p {
    margin: 0 0 1.2rem;
    font-weight: 600;
}

.maintenance-dialog button {
    background: transparent;
    border: 2px solid #fff;
    color: #fff;
}

.maintenance-dialog button:hover {
    background: #fff;
    color: var(--ball-tournoi);
}

.maintenance-page {
    max-width: var(--measure);
    margin: 4rem auto;
    padding: 0 1.5rem;
    text-align: center;
}

/* -- Flash / status messages ------------------------------------------------ */

.flash, .succes, .erreur {
    font-family: var(--font-body);
    max-width: var(--measure);
    padding: 0.85rem 1.1rem;
    margin: 0 0 1.4rem;
    background: var(--ivory-dim);
    border-left: 4px solid var(--chalk);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.erreur, .flash--erreur {
    border-left-color: var(--ball-tournoi);
    color: #7a1f22;
}

.succes, .flash--succes {
    border-left-color: var(--chalk);
    color: var(--felt-deep);
}

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

.btn, button, input[type="submit"] {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.65rem 1.2rem;
    border-radius: var(--radius);
    border: 2px solid var(--felt);
    background: var(--felt);
    color: var(--ivory);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:hover, button:hover, input[type="submit"]:hover {
    background: var(--felt-deep);
    border-color: var(--felt-deep);
    color: var(--ivory);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn--ghost, .nav-form button {
    background: transparent;
    border-color: var(--walnut-dim);
    color: var(--felt-deep);
}

.btn--ghost:hover { background: var(--ivory-dim); border-color: var(--walnut); }

.site-header .nav-form button {
    background: transparent;
    border: none;
    color: var(--ivory);
    padding: 0.3rem 0;
}

.site-header .nav-form button:hover { background: none; box-shadow: none; transform: none; }

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

form { max-width: 32rem; }

form p { margin-bottom: 1.1rem; }

label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--walnut);
    margin-bottom: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="file"],
input[type="search"],
select,
textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--walnut-dim);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
}

/* Safari/Chrome give type="search" its own rounded pill chrome by default,
   which clashes with the site's square inputs — strip it back to the shared
   look above. */
input[type="search"] {
    -webkit-appearance: none;
    appearance: none;
}

input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

input:disabled { background: var(--ivory-dim); color: var(--ink-soft); }

textarea { resize: vertical; }

fieldset {
    margin: 0 0 1.1rem;
    padding: 1.4rem 1.2rem 0.3rem;
    border: 1px solid var(--walnut-dim);
    border-radius: var(--radius);
}

legend {
    padding: 0 0.5rem;
    margin-left: -0.5rem;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--walnut);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    color: var(--ink);
    margin-bottom: 0;
}

.checkbox-row input { width: auto; }

.champ-erreur, span.erreur {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--ball-tournoi);
    margin-top: 0.3rem;
}

/* -- Cards / event listing ----------------------------------------------------- */

.events-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.2rem;
    grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
}

/* Bento weighting: the next event earns the eye first — give it room. */
@media (min-width: 60rem) {
    .events-list--bento .event-card:first-child {
        grid-column: span 2;
        padding: 1.8rem 2rem 1.6rem;
    }

    .events-list--bento .event-card:first-child h2 { font-size: 1.75rem; }
}

/* Past events recede — present, but visually done. */
.events-list--past .event-card { opacity: 0.72; filter: saturate(0.8); }
.events-list--past .event-card:hover,
.events-list--past .event-card:focus-within { opacity: 1; filter: none; }

.event-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--ivory-dim);
    border-top: 4px solid var(--type-color, var(--chalk));
    border-radius: var(--radius);
    padding: 1.4rem 1.4rem 1.2rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, opacity 0.3s ease, filter 0.3s ease;
}

.event-card:hover, .event-card:focus-within {
    transform: translateY(-6px);
    box-shadow: 0 18px 34px rgba(14, 46, 38, 0.22);
}

.event-card__type {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--type-color, var(--chalk-deep));
}

.event-card h2, .event-card h3 {
    font-size: 1.4rem;
    margin: 0.1rem 0 0.4rem;
}

.event-card p { margin: 0 0 0.25rem; font-size: 0.96rem; }

.event-card__places {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--felt-deep);
    margin: 0.4rem 0 0.2rem;
}

.event-card__places span {
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-left: 0.4em;
}

.event-card__cta {
    margin-top: auto;
    padding-top: 0.6rem;
}

.event-card__cta a { font-family: var(--font-mono); font-weight: 700; text-transform: uppercase; font-size: 0.82rem; }

/* -- Detail page stat row ------------------------------------------------------- */

.stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin: 1.4rem 0 1.8rem;
    padding: 1.1rem 0;
    border-top: 1px solid var(--ivory-dim);
    border-bottom: 1px solid var(--ivory-dim);
}

.stat {
    position: relative;
    font-family: var(--font-mono);
}

/* Diamond tick between stats — the rail-divider motif, reused at mini scale. */
.stat + .stat { padding-left: 2.1rem; }

.stat + .stat::before {
    content: '';
    position: absolute;
    left: 0.9rem;
    top: 50%;
    width: 6px;
    height: 6px;
    background: var(--walnut-dim);
    transform: translateY(-50%) rotate(45deg);
    opacity: 0.65;
}

.stat .stat__value {
    display: block;
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--felt-deep);
}

.stat .stat__label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

/* Dates/names read as long strings, not scoreboard numbers — de-emphasise
   next to a genuine stat like "places restantes" in the same row. */
.stat--text .stat__value {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--ink);
}

/* -- Tables (admin) --------------------------------------------------------------- */

/* overflow-x: auto alone would still make this a scroll container on the Y
   axis too (CSS overflow spec: one axis non-visible forces the other from
   visible to auto), which breaks thead's sticky positioning below — it'd
   stick relative to .table-wrap's own (page-scrolled-past) top edge instead
   of the viewport, landing mid-table. Giving it a real bounded height with
   overflow-y: auto makes that implicit scroll container explicit and
   correct: the table becomes its own scrollable panel and thead's
   `top: 0` sticks to *this* panel's top edge as intended. */
/* Panneau de filtres à facettes (/evenements) + tableau de résultats — même
   disposition qu'un e-shop : filtres à gauche, résultats à droite. Empilé en
   une colonne sous 40rem (voir la section Responsive plus bas). */
.events-layout {
    display: grid;
    grid-template-columns: 16rem 1fr;
    align-items: start;
    gap: 2rem;
}

.events-filtres { margin-top: 4rem; } /* aligne "Mode de jeu" sur le h2 "À venir" (margin-top: 4rem, règle globale h2/h3) */
.events-filtres fieldset { margin-bottom: 1rem; }
/* Resserré par rapport au .checkbox-row par défaut (margin-bottom: 0) —
   sans les <p> qui enveloppaient chaque case avant, il faut un espacement
   explicite mais volontairement plus discret que l'ancien rythme hérité de
   la marge par défaut d'un <p>. */
.events-filtres .checkbox-row { margin-bottom: 0.35rem; }
.events-filtres .checkbox-row:last-child { margin-bottom: 0; }
/* Filtrage dynamique (voir public/js/motion.js) : plus de bouton visible,
   seul le <noscript> de secours en affiche un si JavaScript est désactivé. */
.events-filtres form button { width: 100%; }

.table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 75vh;
    margin: 1rem 0 2rem;
}

/* "À venir" sur /evenements (public) : la section la plus consultée, avec
   souvent le plus de lignes — deux fois la hauteur par défaut avant que son
   propre défilement interne ne prenne le relais. Scopé à cette seule section
   (pas "Terminés", pas les listes admin qui partagent .table-wrap) via une
   classe dédiée plutôt que de changer la valeur par défaut pour tout le site. */
.table-wrap--tall { max-height: 150vh; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.94rem;
    background: #fff;
    box-shadow: var(--shadow);
}

thead th {
    background: var(--felt);
    color: var(--ivory);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
    padding: 0.75rem 0.9rem;
    /* Sticks to the top of .table-wrap's own scroll panel (see its comment
       above) as the table scrolls internally. */
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Overrides the global `a { color: var(--chalk-deep) }` — too dark for
   contrast against thead th's --felt background. */
.sort-link {
    color: inherit;
    text-decoration: none;
}

.sort-link:hover,
.sort-link:focus-visible {
    text-decoration: underline;
}

.sort-indicator { font-size: 0.7em; }

.table-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}

.table-controls .filtres { margin-bottom: 0; }

tbody td {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--ivory-dim);
    vertical-align: middle;
}

tbody tr:nth-child(even) { background: var(--ivory); }

tbody tr:hover { background: #fffaf0; }

.table-row-link { cursor: pointer; }
.table-row-link td a { color: inherit; text-decoration: none; }

.nowrap { white-space: nowrap; }

/* Truncates to the width of its column with an ellipsis; the full value is
   still available via the title attribute (native browser tooltip). 100%
   (not a fixed ch count) so it tracks whatever width the column actually
   ends up with, e.g. under .table--utilisateurs's fixed layout. */
.truncate {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* Liste des utilisateurs : 10 colonnes hétérogènes (id, nom, licence,
   badges, email, rôles, dates, actions) — sans largeurs explicites la somme
   du contenu naturel dépasse la largeur de la page et force le scroll
   horizontal de .table-wrap. Layout fixe + largeurs en % pour que le
   texte long (nom, rôles, email) s'enroule sur plusieurs lignes plutôt que
   d'élargir la colonne. */
.table--utilisateurs {
    table-layout: fixed;
}

.table--utilisateurs th,
.table--utilisateurs td {
    box-sizing: border-box;
    overflow-wrap: break-word;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
}

.table--utilisateurs th:nth-child(1)  { width: 6%; }  /* N° */
.table--utilisateurs th:nth-child(2)  { width: 13%; } /* Nom */
.table--utilisateurs th:nth-child(3)  { width: 9%; }  /* Licence */
.table--utilisateurs th:nth-child(4)  { width: 7%; }  /* Validité */
.table--utilisateurs th:nth-child(5)  { width: 17%; } /* Email */
.table--utilisateurs th:nth-child(6)  { width: 8%; }  /* Email rejeté */
.table--utilisateurs th:nth-child(7)  { width: 12%; } /* Rôles */
.table--utilisateurs th:nth-child(8)  { width: 11%; } /* Statut */
.table--utilisateurs th:nth-child(9)  { width: 11%; } /* Dernière connexion */
.table--utilisateurs th:nth-child(10) { width: 6%; }  /* Actions */

/* Row actions: free to wrap at any width. No border-divider between items —
   a border wrapped mid-row strands as a floating stub attached to neither
   line, so items are told apart by spacing alone, which stays coherent
   whether they end up on one line or several. */
.table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.9rem;
}

/* Annuler / (Dés)activer are POST forms for safety (see AuditLog / no
   side-effecting GET), but should read the same as the Modifier / Voir
   links next to them — same font, color and underline, no button chrome. */
td form.nav-form button {
    display: inline;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: normal;
    text-transform: none;
    text-decoration: underline;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    color: var(--chalk-deep);
}

td form.nav-form button:hover {
    background: none;
    color: var(--felt);
    transform: none;
    box-shadow: none;
}

/* Row action menu: collapses several links/forms behind one toggle so an
   actions column with many items never wraps or forces the table wider than
   its container. Opens in place (not absolutely positioned) because
   .table-wrap scrolls horizontally — an overlay menu would get clipped by
   that same overflow. */
.row-menu { position: relative; }

.row-menu > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    list-style: none;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    color: var(--felt-deep);
    background: var(--ivory-dim);
    border: 1px solid var(--walnut-dim);
    border-radius: var(--radius);
}

.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu > summary::marker { content: ''; }

.row-menu > summary:hover,
.row-menu[open] > summary {
    background: var(--ivory);
    border-color: var(--walnut);
}

.row-menu__items {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    margin-top: 0.5rem;
}

/* -- Filter bar & pagination (/admin/journal) -------------------------------------- */

.filtres {
    max-width: none;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem 1.2rem;
    margin-bottom: 1.6rem;
}

.filtres .champ {
    flex: 1 1 10rem;
    margin-bottom: 0;
}

/* /admin/evenements : les champs sont des <fieldset> de cases à cocher
   (facettes mode de jeu / catégorie), pas des inputs à hauteur unique — un
   flex-end les alignerait sur le bas du plus grand groupe. */
.filtres--evenements { align-items: flex-start; }
.filtres--evenements fieldset { margin-bottom: 0; }

/* /admin/utilisateurs : un seul champ recherche, pas de facettes — flex:1
   sur .champ (règle générale ci-dessus) l'étirerait sur toute la largeur de
   la ligne et repousserait le bouton loin à droite ; on le borne pour que le
   bouton reste juste à côté. */
.filtres--recherche .champ { flex: 0 1 22rem; }

.filtres .champ--actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.4rem;
    margin: 1.5rem 0 2rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.pagination__disabled { color: var(--ink-soft); opacity: 0.5; }

/* -- Status badges (admin tables) --------------------------------------------------- */

.badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius);
    background: var(--ivory-dim);
    color: var(--ink-soft);
}

.badge--on { background: var(--chalk); color: #fff; }
.badge--off { background: var(--ivory-dim); color: var(--ink-soft); }
.badge--warn { background: var(--ball-entrainement); color: var(--felt-deep); }
.badge--danger { background: var(--ball-tournoi); color: #fff; }
.badge--usurpation { background: var(--walnut); color: var(--ivory); }

.warning-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.warning-list .erreur { margin: 0; }

/* -- Page header pattern (admin + utility pages) ------------------------------------ */

.page-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.6rem;
}

.page-head .btn { white-space: nowrap; }

.back-link {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    margin-bottom: 1.2rem;
}

/* -- Admin utility density --------------------------------------------------------- */

.admin main, main.admin {
    max-width: 74rem;
}

/* -- Auth pages ---------------------------------------------------------------------- */

.auth-shell {
    max-width: 26rem;
    margin: 1rem auto 0;
}

.auth-shell form { max-width: none; }

.auth-links {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    margin-top: 1.4rem;
}

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

@media (max-width: 40rem) {
    .site-header__bar { padding: 0.8rem 1.1rem; }
    .brand { font-size: 1.05rem; white-space: normal; }
    main { padding: 1.8rem 1.1rem 3rem; }
    .stat-row { gap: 1.2rem; }
    .stat + .stat { padding-left: 0; }
    .stat + .stat::before { display: none; }
    .events-list { grid-template-columns: 1fr; }
    .events-layout { grid-template-columns: 1fr; }
    .hero__actions { flex-direction: column; align-items: stretch; }
    .hero--landing { margin-top: -1.8rem; }
    .hero-ball { display: none; }

    .nav-account {
        flex: 1 0 100%;
        padding-left: 0;
        border-left: none;
        margin-top: 0.2rem;
    }

    .nav-dropdown[open] {
        flex: 1 0 100%;
    }

    .nav-dropdown__menu {
        position: static;
        margin-top: 0.3rem;
        padding: 0 0 0 0.8rem;
        background: none;
        border: none;
        box-shadow: none;
    }
}

@media (max-width: 26rem) {
    .site-header__bar { flex-direction: column; align-items: flex-start; }
}
