/* ==========================================================================
   Apeeness · « Panneau d'affichage » (voir .impeccable/surfaces/ et DESIGN.md)
   Fond liège sable qui porte des feuilles blanches, rail bleu nuit (couleurs du logo), liseré de couleur par commission.
   Police Archivo (OFL) hébergée dans assets/fonts : aucun appel externe (RGPD).
   ========================================================================== */

@font-face {
    font-family: "Archivo";
    src: url("../fonts/archivo-Wa7z_Iw.woff2") format("woff2");
    font-weight: 100 900;
    font-stretch: 62% 125%;
    font-display: swap;
}

:root {
    /* Bleu marine du logo : boutons, liens, sélection */
    --primary: #1b2f66;
    --primary-hover: #142451;
    --primary-soft: #e4e9f5;
    --primary-ink: #13224b;

    /* Orange du logo : accents (élément actif du menu, mois du cartouche, pastilles) */
    --accent: #f47b20;
    --accent-ink: #c2560c;
    --accent-soft: #fdecdd;

    /* Rail de navigation : tableau d'école bleu nuit, écriture à la craie */
    --board: #15254d;
    --board-raised: #1f3364;
    --chalk: #f3efe2;
    --chalk-muted: rgba(243, 239, 226, .72);
    --chalk-faint: rgba(243, 239, 226, .64);
    --chalk-yellow: #fdb52c;

    /* Liège (fond) et feuilles (cartes) */
    --bg: #e9e1d3;
    --surface: #ffffff;
    --surface-muted: #f6f2ea;
    --border: #e4dccd;
    --border-strong: #cbbda5;

    --text: #1c2233;
    --text-muted: #565c69;
    --text-faint: #686c76;

    --success: #2a7546;
    --success-soft: #e2f1e6;
    --warning: #9a5408;
    --warning-soft: #fbefd8;
    --danger: #b52d29;
    --danger-soft: #fbe4e2;
    --info: #2457a6;
    --info-soft: #e3ebf8;

    /* Punaises : une couleur stable par commission (fonction Twig commission_pin) */
    --pin-red: #d9443a;
    --pin-yellow: #e8b124;
    --pin-blue: #2e6ad1;
    --pin-green: #3b9455;
    --pin-pink: #d2559a;
    --pin-orange: #e27530;
    --pin-violet: #7d58c4;

    --radius-sm: 6px;
    --radius: 9px;
    --radius-lg: 12px;
    /* Feuilles posées sur le liège : ombre courte, chaude, décalée vers le bas */
    --shadow-sm: 0 1px 1px rgba(74, 54, 22, .06), 0 2px 6px -2px rgba(74, 54, 22, .10);
    --shadow: 0 1px 2px rgba(74, 54, 22, .08), 0 8px 18px -8px rgba(74, 54, 22, .18);
    --shadow-lg: 0 2px 4px rgba(40, 30, 12, .08), 0 22px 44px -14px rgba(40, 30, 12, .30);

    --sidebar-w: 256px;
    --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    /* Titres façon affiche : Archivo étroit et très gras */
    --font-display: "Archivo", ui-sans-serif, system-ui, sans-serif;
    --display-stretch: 78%;
}

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

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
}

/* Surfaces du navigateur aux couleurs du panneau */
::selection { background: rgba(253, 181, 44, .55); color: var(--text); }
html { accent-color: var(--primary); caret-color: var(--primary); scrollbar-color: var(--border-strong) transparent; }
:focus-visible { outline: 3px solid rgba(27, 47, 102, .35); outline-offset: 2px; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; letter-spacing: -.005em; text-wrap: balance; }
/* Titres de page : lettrage d'affiche (étroit, très gras) */
h1 { font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 800; font-size: 2rem; line-height: 1.08; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1rem; }
small, .muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* --------------------------------------------------------------------------
   Coque applicative
   -------------------------------------------------------------------------- */

/* overflow-x: clip : un élément trop large ne doit jamais élargir la page (sur iPad, elle le restait après une rotation) */
.app { display: flex; min-height: 100vh; overflow-x: clip; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    background: var(--board);
    color: var(--chalk);
    z-index: 40;
    transition: transform .2s ease;
}

.sidebar-header { padding: 1rem 1rem .75rem; border-bottom: 1px solid rgba(243, 239, 226, .1); }

.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--text); font-size: 1.02rem; }
.brand:hover { color: var(--text); }
.sidebar .brand, .sidebar .brand:hover { color: var(--chalk); font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 800; font-size: 1.2rem; }
/* Logo Apeeness (mot dessiné, SVG) */
.brand-wordmark { display: block; height: 38px; width: auto; }
.sidebar .brand-wordmark { height: 34px; }
.auth-card > .brand .brand-wordmark { height: 42px; }
.brand-wordmark-dark { display: none; }
/* Logo de l'association à la place du « A » */
img.brand-logo { flex: none; object-fit: contain; background: #fff; box-shadow: none; border: 1px solid var(--border); padding: 2px; }
.brand-mark {
    display: grid; place-items: center;
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--chalk-yellow);
    color: var(--board); font-family: var(--font-display); font-stretch: var(--display-stretch); font-size: 1.15rem; font-weight: 900;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

.asso-switch { margin-top: .75rem; }
.asso-switch summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .55rem .7rem; border-radius: var(--radius);
    background: var(--board-raised); color: var(--chalk); font-weight: 600; font-size: .9rem;
}
.asso-switch summary::-webkit-details-marker { display: none; }
.asso-switch summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asso-switch-menu { margin-top: .35rem; padding: .35rem; border: 1px solid rgba(243, 239, 226, .12); border-radius: var(--radius); background: var(--board-raised); box-shadow: var(--shadow); }
.asso-switch-menu a { display: block; padding: .45rem .6rem; border-radius: var(--radius-sm); color: var(--chalk); font-size: .9rem; }
.asso-switch-menu a:hover { background: rgba(243, 239, 226, .08); color: var(--chalk); }

.nav { flex: 1; overflow-y: auto; padding: .75rem .65rem 1rem; }
/* Version de l'application, collée au bas du menu */
.sidebar-version { flex: none; margin: 0; padding: .6rem 1.3rem .8rem; border-top: 1px solid rgba(243, 239, 226, .1); color: var(--chalk-faint); font-size: .75rem; }
.nav-section { margin: 1.1rem .65rem .35rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--chalk-faint); }
.nav a {
    position: relative;
    display: flex; align-items: center; gap: .65rem;
    padding: .5rem .65rem; margin-bottom: 1px;
    border-radius: var(--radius-sm);
    color: var(--chalk-muted); font-weight: 500; font-size: .92rem;
}
.nav a:hover { background: rgba(243, 239, 226, .07); color: var(--chalk); }
/* Rubrique ouverte : surlignée en jaune craie */
.nav a.active { background: rgba(243, 239, 226, .10); color: #fee2a6; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav a.active .icon { color: var(--chalk-yellow); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); }

/* Barre du haut : bouton du menu et nom de l'association (téléphone), compte connecté à droite */
.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: .75rem;
    min-height: 58px; padding: .5rem 1.5rem;
    background: rgba(233, 225, 211, .92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-strong);
}
.topbar .topbar-menu, .topbar .topbar-title, .topbar .topbar-brand { display: none; }
.topbar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-brand { min-width: 0; }
.topbar-brand .brand-wordmark { height: 28px; }

.account-menu { position: relative; margin-left: auto; }

/* Année scolaire consultée : dans le menu, sous le choix de l'association, même menu déroulant */
.year-switch { margin-top: .5rem; }
.year-switch summary { justify-content: flex-start; }
.year-switch summary > .icon:first-child { color: var(--chalk-yellow); flex: none; }
.year-switch summary span { flex: 1; }
.asso-switch-menu button { display: block; width: 100%; padding: .45rem .6rem; border: 0; border-radius: var(--radius-sm); background: none; color: var(--chalk); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; }
.asso-switch-menu button:hover { background: rgba(243, 239, 226, .08); }
.asso-switch-menu button.active { color: var(--chalk-yellow); font-weight: 600; }
.year-banner form { margin: 0; }
/* Sur mobile, pour tous les bandeaux (année scolaire, fin d'essai, paiement en échec) :
   le texte au-dessus, le bouton en dessous sur toute la largeur */
@media (max-width: 640px) {
    .billing-banner { flex-wrap: wrap; }
    .billing-banner p { flex: 1 1 calc(100% - 2.5rem); }
    .billing-banner form, .billing-banner > .btn { flex-basis: 100%; }
    .billing-banner form .btn, .billing-banner > .btn { width: 100%; justify-content: center; }
}

/* Cloche des notifications (à gauche du compte) */
.notif-menu { position: relative; margin-left: auto; }
.notif-menu + .account-menu { margin-left: .35rem; }
.notif-menu summary { list-style: none; cursor: pointer; position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text-muted); }
.notif-menu summary::-webkit-details-marker { display: none; }
.notif-menu summary:hover, .notif-menu[open] summary { background: var(--surface-muted); color: var(--text); }
.notif-menu summary .icon { width: 20px; height: 20px; }
/* Pastille du nombre de notifications : petite, dans le coin haut droit, sans masquer la cloche */
.notif-count { position: absolute; top: 0; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700; line-height: 13px; text-align: center; border: 2px solid var(--surface); box-sizing: border-box; pointer-events: none; }
.notif-panel { position: absolute; right: -50px; top: calc(100% + 6px); z-index: 40; width: min(370px, calc(100vw - 1.5rem)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.link-button { border: 0; background: none; padding: 0; font: inherit; font-size: .82rem; font-weight: 600; color: var(--primary); cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.notif-list { max-height: min(420px, 60vh); overflow-y: auto; }
.notif-item { display: flex; gap: .7rem; padding: .7rem 1rem; color: var(--text); border-bottom: 1px solid var(--border); font-size: .88rem; line-height: 1.4; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-muted); color: var(--text); }
.notif-item.unread { background: var(--primary-soft); }
.notif-item.unread .notif-text > span::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: .4rem; border-radius: 50%; background: var(--primary); vertical-align: middle; }
.notif-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); flex: none; }
.notif-icon.blue { background: var(--info-soft); color: var(--info); }
.notif-icon.amber { background: var(--warning-soft); color: var(--warning); }
.notif-icon.red { background: var(--danger-soft); color: var(--danger); }
.notif-text { display: grid; gap: .1rem; min-width: 0; }
.notif-text small { color: var(--text-muted); font-size: .76rem; }
.notif-empty { display: flex; align-items: center; gap: .5rem; margin: 0; padding: 1.5rem 1rem; color: var(--text-muted); font-size: .88rem; }
.notif-all { display: block; padding: .65rem; text-align: center; font-size: .85rem; font-weight: 600; border-top: 1px solid var(--border); }
.notif-page { overflow: hidden; }
.notif-page .notif-item { padding: .9rem 1.25rem; font-size: .92rem; }
@media (max-width: 640px) { .notif-panel { position: fixed; top: 62px; left: .75rem; right: .75rem; width: auto; } }
.account-menu summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; gap: .6rem;
    padding: .3rem .5rem .3rem .3rem; border-radius: 999px; color: var(--text);
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary:hover, .account-menu[open] summary, .account-menu summary.active { background: var(--surface-muted); }
.account-menu .who { display: flex; flex-direction: column; min-width: 0; max-width: 220px; font-size: .85rem; line-height: 1.25; }
.account-menu .who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu .who .muted { font-size: .78rem; }
.account-menu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
    min-width: 230px; padding: .35rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.account-menu-head { display: flex; flex-direction: column; padding: .5rem .6rem .6rem; margin-bottom: .25rem; border-bottom: 1px solid var(--border); font-size: .88rem; overflow-wrap: anywhere; }
.account-menu-head .muted { font-size: .8rem; }
.account-menu-panel a { display: flex; align-items: center; gap: .55rem; padding: .5rem .6rem; border-radius: var(--radius-sm); color: var(--text); font-size: .9rem; }
.account-menu-panel a:hover { background: var(--surface-muted); color: var(--text); }
.account-menu-foot { margin-top: .25rem; padding-top: .25rem; border-top: 1px solid var(--border); }
.account-menu-panel .account-menu-foot a { padding: .35rem .6rem; font-size: .8rem; color: var(--text-muted); }

.content { max-width: 1600px; margin: 0 auto; padding: 2rem 2rem 4rem; }

.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { margin: 0; }
/* Accueil du tableau de bord : « Bonjour Camille » en grand, comme une affiche */
.page-header h1.hello { font-size: clamp(2.3rem, 4.6vw, 3.3rem); font-stretch: 72%; font-weight: 900; }
.page-header p { margin: .25rem 0 0; color: var(--text-muted); }
.page-header .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.breadcrumb { display: flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--text-muted); margin-bottom: .35rem; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }

.backdrop { display: none; }

@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); }
    .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    .app.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 22, 45, .4); z-index: 35; }
    .main { margin-left: 0; }
    .topbar { padding: .5rem 1rem; }
    .topbar .topbar-menu { display: inline-flex; }
    .topbar .topbar-title, .topbar .topbar-brand { display: block; }
    .account-menu .who, .account-menu summary > .icon { display: none; }
    .account-menu summary { padding: .2rem; }
    .content { padding: 1.25rem 1rem 3rem; }
}

/* --------------------------------------------------------------------------
   Composants
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .55rem 1rem;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    font: inherit; font-size: .9rem; font-weight: 600; line-height: 1.2;
    cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:focus-visible { outline: 3px solid rgba(27, 47, 102, .35); outline-offset: 1px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 1px rgba(15, 25, 60, .25), inset 0 -1px 0 rgba(0, 0, 0, .12); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-muted); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-muted); color: var(--text); }
.btn-danger { background: var(--surface); border-color: #efc2bf; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #1f5f37; color: #fff; }
.btn-sm { padding: .35rem .65rem; font-size: .82rem; }
.btn-icon { padding: .45rem; }
.btn-block { width: 100%; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-body { padding: 1.25rem 1.35rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.35rem; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { margin: 0; font-size: 1.02rem; font-weight: 750; font-stretch: 92%; }
.card-header a { font-size: .85rem; font-weight: 600; }
.card + .card { margin-top: 1.25rem; }

.grid { display: grid; gap: 1.25rem; }
.grid + .grid, .grid + .card, .card + .grid { margin-top: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.grid > .card + .card { margin-top: 0; }
.stack > * + * { margin-top: 1.25rem; }
@media (max-width: 1180px) { .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 960px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.stat { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; color: var(--text); }
a.stat:hover { color: var(--text); border-color: var(--border-strong); }
.stat-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); flex: none; }
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning); }
.stat-icon.blue { background: var(--info-soft); color: var(--info); }
.stat-value { font-family: var(--font-display); font-stretch: var(--display-stretch); font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .82rem; color: var(--text-muted); }

.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .15rem .55rem; border-radius: 999px;
    font-size: .75rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
    background: var(--surface-muted); color: var(--text-muted);
}
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-primary { background: var(--primary-soft); color: var(--primary-ink); }

.avatar {
    display: inline-grid; place-items: center; flex: none;
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary-ink);
    font-size: .78rem; font-weight: 700;
}
.avatar-sm { width: 26px; height: 26px; font-size: .68rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-xl { width: 88px; height: 88px; font-size: 1.6rem; }
.avatar { overflow: hidden; }
/* Pastille verte « ✓ » en bas à droite de l'avatar (bénévole qui a un compte) */
.avatar-wrap { position: relative; display: inline-flex; flex: none; }
.avatar-check {
    position: absolute; right: -4px; bottom: -4px;
    display: grid; place-items: center; width: 12px; height: 12px; border-radius: 50%;
    background: var(--success); border: 1.5px solid var(--surface); box-sizing: content-box;
}
.avatar-check svg { width: 8px; height: 8px; fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: .7rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
/* Colonnes triables (table_sort_controller.js) */
.th-sort { display: inline-flex; align-items: center; gap: .35rem; padding: 0; line-height: 1; vertical-align: middle; border: 0; background: none; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.th-sort:hover { color: var(--text); }
.th-sort-icon { display: block; flex: none; width: 8px; height: 11px; transform: translateY(-1.5px); background: currentColor; opacity: .45; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M2 5l3-3 3 3M2 9l3 3 3-3' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M2 5l3-3 3 3M2 9l3 3 3-3' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
th[aria-sort] .th-sort { color: var(--text); }
th[aria-sort] .th-sort-icon { opacity: 1; }
th[aria-sort='ascending'] .th-sort-icon { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M5 12V2M2 5l3-3 3 3' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M5 12V2M2 5l3-3 3 3' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
th[aria-sort='descending'] .th-sort-icon { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M5 2v10M2 9l3 3 3-3' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M5 2v10M2 9l3 3 3-3' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
th.text-right .th-sort { flex-direction: row-reverse; }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-muted); }
.table .actions { text-align: right; white-space: nowrap; }
.cell-main { display: flex; align-items: center; gap: .75rem; }
.cell-main strong, .cell-main a { display: block; font-weight: 600; }
.cell-main strong { color: var(--text); }
.cell-main small { display: block; }

/* Listes */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: .85rem; padding: .85rem 1.35rem; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; }
a.title:hover { color: var(--primary); }
.list-item .meta { font-size: .82rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: .25rem .9rem; align-items: center; }
.list-item .meta span { display: inline-flex; align-items: center; gap: .3rem; }
.list-item .meta .meta-group { gap: .9rem; }
/* Sur ordinateur (souris), le rendu d'Archivo place les chiffres un peu au-dessus du milieu de la ligne :
   on remonte les petites icônes pour les centrer sur le texte. Sur mobile (tactile), elles sont déjà centrées. */
@media (hover: hover) and (pointer: fine) { .list-item .meta .icon { position: relative; top: -.1em; } }
/* Tâche prioritaire : point d'exclamation blanc sur pastille rouge, en SVG (net en petite taille), de la taille des icônes .icon-sm */
.priority-mark { display: inline-block; width: 15px; height: 15px; max-width: none; margin-right: .4rem; fill: var(--danger); vertical-align: -.15em; }
.list-item-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.list-item .calendar-btn { flex: none; color: var(--text-muted); }
.task-side { display: flex; align-items: center; gap: .6rem; flex: none; }

/* Date : petite page de calendrier ; la couleur de la commission en liseré du haut */
.date-chip {
    position: relative;
    display: grid; place-items: center; flex: none;
    width: 50px; padding: .55rem 0 .35rem; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm);
    color: var(--text); text-align: center; line-height: 1; overflow: hidden;
}
.date-chip .d { font-family: var(--font-display); font-stretch: var(--display-stretch); font-size: 1.45rem; font-weight: 800; }
.date-chip .m { margin-top: .15rem; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-ink); }
.date-chip.past { background: var(--surface-muted); color: var(--text-muted); box-shadow: none; }
.date-chip.past .m { color: var(--text-muted); }
.date-chip-band { position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--pin-c, var(--pin-red)); }

/* Couleur stable par commission (commission_pin) : liseré du cartouche de date */
.pin-1 { --pin-c: var(--pin-red); }
.pin-2 { --pin-c: var(--pin-yellow); }
.pin-3 { --pin-c: var(--pin-blue); }
.pin-4 { --pin-c: var(--pin-green); }
.pin-5 { --pin-c: var(--pin-pink); }
.pin-6 { --pin-c: var(--pin-orange); }
.pin-7 { --pin-c: var(--pin-violet); }
.pinned-title, .list-item .title.pinned-title { display: flex; align-items: center; gap: .55rem; }
span.pinned-title, a.pinned-title { display: inline-flex; }

/* Case à cocher ronde des tâches */
.check-btn {
    display: grid; place-items: center; flex: none;
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid var(--border-strong); background: var(--surface);
    color: transparent; cursor: pointer; padding: 0;
}
.check-btn:hover { border-color: var(--success); color: var(--success); }
.check-btn.done { background: var(--success); border-color: var(--success); color: #fff; }
.check-btn .icon { width: 13px; height: 13px; stroke-width: 3; }
.check-btn.is-readonly { cursor: default; border-style: dashed; }
.check-btn.is-readonly:hover { border-color: var(--border-strong); color: transparent; }
.check-btn.is-readonly.done { opacity: .55; border-style: solid; }
.check-btn.is-readonly.done:hover { border-color: var(--success); color: #fff; }

/* Jaune : action secondaire bien visible (ex. « Me retirer » d'un créneau) */
.btn-warning { background: #facc15; color: #422006; box-shadow: 0 1px 2px rgba(161, 98, 7, .3); }
.btn-warning:hover { background: #eab308; color: #422006; }
/* Boutons d'inscription aux créneaux : même largeur quel que soit le libellé (pas de décalage) */
.btn-shift { min-width: 8.5rem; }

/* Éditeur de texte enrichi (Trix) */
/* Règles que Trix n'injecte qu'une fois son JavaScript chargé : reprises ici pour un affichage correct dès le chargement */
trix-toolbar, trix-editor { display: block; }
trix-toolbar [data-trix-dialog] { display: none; }
trix-toolbar [data-trix-dialog][data-trix-active] { display: block; }
/* Boutons à la ligne plutôt que barre défilante (Trix : overflow-x auto), pour que la palette de couleurs ne soit pas coupée */
.rich-text trix-toolbar .trix-button-row { flex-wrap: wrap; gap: .35rem; overflow: visible; }
.rich-text trix-toolbar .trix-button-group { margin-bottom: 0; border-color: var(--border-strong); border-radius: var(--radius-sm); }
.rich-text trix-toolbar .trix-button { border-bottom-color: var(--border); }
.rich-text trix-toolbar .trix-button.trix-active { background: var(--primary-soft); }
.rich-text trix-toolbar .trix-dialog { border-radius: var(--radius); box-shadow: var(--shadow); }
.rich-text-editor {
    min-height: 240px; margin-top: .35rem; padding: .7rem .85rem;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
}
.rich-text-editor:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27, 47, 102, .18); }
.has-error .rich-text-editor { border-color: var(--danger); }
.rich-text-editor img { max-width: 100%; height: auto; }
/* Boutons ajoutés (couleur, image) : même gabarit que les icônes Trix */
.rich-text trix-toolbar .rich-text-tool { display: inline-flex; align-items: center; justify-content: center; width: 2.6em; height: 1.6em; padding: 0; font-size: inherit; cursor: pointer; }
.rich-text trix-toolbar .rich-text-tool svg { width: 1.15em; height: 1.15em; color: rgba(0, 0, 0, .7); }
.rich-text trix-toolbar .trix-button-group--insert-tools .rich-text-tool + .rich-text-tool,
.rich-text trix-toolbar .trix-button-group--insert-tools .rich-text-color + .rich-text-tool { border-left: 1px solid var(--border); }
.rich-text-color { position: relative; display: inline-flex; }
.rich-text-palette {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 10;
    display: grid; grid-template-columns: repeat(4, 1.75rem); gap: .4rem; padding: .55rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.rich-text-palette[hidden] { display: none; }
.rich-text-swatch {
    width: 1.75rem; height: 1.75rem; padding: 0; cursor: pointer;
    border: 2px solid var(--surface); border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--border-strong);
}
.rich-text-swatch:hover { box-shadow: 0 0 0 2px var(--primary); }
/* Couleur par défaut : pastille barrée */
.rich-text-swatch--default { background: linear-gradient(135deg, var(--surface) 45%, var(--danger) 45%, var(--danger) 55%, var(--surface) 55%); }
/* Taille de l'image sélectionnée */
.rich-text trix-toolbar .rich-text-image-size[hidden] { display: none; }
.rich-text trix-toolbar .rich-text-size { padding: 0 .7em; height: 1.6em; font-size: .8em; font-weight: 600; cursor: pointer; }
.rich-text trix-toolbar .rich-text-size + .rich-text-size { border-left: 1px solid var(--border); }
.rich-text-editor figure.attachment { margin: .5rem 0; }
.rich-text-error { margin: .4rem 0 0; color: var(--danger); font-size: .875rem; }
.rich-text-error[hidden] { display: none; }

/* Contenu mis en forme (aperçu des emails) */
.rich-content { line-height: 1.6; overflow-wrap: anywhere; }
.rich-content h1 { font-size: 1.2rem; margin: .8rem 0 .4rem; }
.rich-content ul, .rich-content ol { padding-left: 1.4rem; margin: .4rem 0; }
.rich-content blockquote { margin: .6rem 0; padding: .2rem .9rem; border-left: 3px solid var(--border-strong); color: var(--text-muted); }
.rich-content pre { background: var(--surface-muted); padding: .6rem .8rem; border-radius: var(--radius-sm); white-space: pre-wrap; }
.rich-content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

/* Historique des envois */
.sent-email-frame { display: block; width: 100%; height: 70vh; min-height: 420px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.recipient-list { max-height: 70vh; overflow-y: auto; font-size: .87rem; }
.recipient-list li { padding: .3rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.pager { display: flex; align-items: center; justify-content: center; gap: .8rem; margin-top: 1rem; }

.btn-danger-solid { background: var(--danger); color: #fff; box-shadow: 0 1px 2px rgba(192, 38, 45, .3); }
.btn-danger-solid:hover { background: #a11d23; color: #fff; }


/* Zone de suppression du compte (page « Mon profil ») */
/* « Mon profil » : changement d'adresse email */
.email-card details > summary { list-style: none; }
.email-card details > summary::-webkit-details-marker { display: none; }
.email-card details[open] > summary { display: none; }
.email-card .alert { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }

.danger-zone { margin-top: 1.25rem; border-color: #efc2bf; }
.danger-zone > summary { list-style: none; cursor: pointer; border-bottom: 0; }
.danger-zone > summary::-webkit-details-marker { display: none; }
.danger-zone > summary h2 { color: var(--danger); }
.danger-zone[open] > summary { border-bottom: 1px solid var(--border); }
.danger-zone[open] > summary .icon { transform: rotate(180deg); }
.danger-list { font-size: .88rem; padding-left: 1.1rem; margin: 0 0 1rem; }

/* Fenêtre de confirmation (assets/confirm_dialog.js) */
.modal {
    width: min(440px, calc(100vw - 2rem)); padding: 0; border: 0;
    border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
    box-shadow: 0 24px 60px -12px rgba(15, 17, 35, .35);
}
.modal::backdrop { background: rgba(15, 17, 35, .45); backdrop-filter: blur(2px); }
.modal[open] { animation: modal-in .18s ease-out; }
.modal[open]::backdrop { animation: backdrop-in .18s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.modal-panel { display: grid; grid-template-columns: auto 1fr; gap: 1rem 1rem; padding: 1.5rem 1.5rem 1.25rem; }
.modal-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.modal-icon .icon { width: 22px; height: 22px; }
.modal .icon-danger, .modal .icon-success { display: none; }
.modal[data-variant=success] .modal-icon { background: var(--success-soft); color: var(--success); }
.modal[data-variant=success] .icon-success { display: block; stroke-width: 2.6; }
.modal[data-variant=success] .icon-primary { display: none; }
.modal[data-variant=danger] .modal-icon { background: var(--danger-soft); color: var(--danger); }
.modal[data-variant=danger] .icon-danger { display: block; }
.modal[data-variant=danger] .icon-primary { display: none; }
.modal-body h2 { margin: .35rem 0 .35rem; font-size: 1.08rem; }
.modal-body p { margin: 0; color: var(--text-muted); font-size: .92rem; overflow-wrap: anywhere; }
.modal-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; }
@media (max-width: 480px) { .modal-actions { flex-direction: column-reverse; } .modal-actions .btn { width: 100%; } }

/* Documents : pastille du type de fichier */
.file-icon {
    display: grid; place-items: center; flex: none;
    width: 40px; height: 40px; border-radius: 8px;
    font-size: .62rem; font-weight: 800; letter-spacing: .02em;
    background: var(--surface-muted); color: var(--text-muted);
}
.file-pdf { background: #fdecec; color: #b91c1c; }
.file-text { background: #e8f1fd; color: #1d4ed8; }
.file-sheet { background: #e8f7ee; color: #15803d; }
.file-slides { background: #fdf3e2; color: #c2410c; }
.file-image { background: #f3e8ff; color: #7e22ce; }
.file-link { background: #e6f6f8; color: #0e7490; }
.file-drive { background: var(--surface); border: 1px solid var(--border); }
.file-drive .drive-logo { width: 22px; height: auto; }
.link-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border); }
.link-form summary { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; font-weight: 600; color: var(--primary); }
.link-form[open] summary { margin-bottom: .75rem; }
.upload-form { display: grid; gap: .75rem; justify-items: start; }
.upload-form .field { width: 100%; margin-bottom: 0; }

/* Zone de dépôt de fichiers (remplace l'input natif, voir dropzone_controller.js) */
.dropzone-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.dropzone-area {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
    padding: 1.25rem 1rem; text-align: center; cursor: pointer;
    border: 2px dashed var(--border-strong); border-radius: var(--radius);
    background: var(--surface-muted); color: var(--text-muted); font-size: .9rem;
    transition: border-color .15s, background .15s, color .15s;
}
.dropzone-area:hover, .dropzone.is-dragover .dropzone-area { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }
.dropzone-input:focus-visible + .dropzone-area { outline: 3px solid rgba(27, 47, 102, .35); outline-offset: 2px; }
.dropzone-title strong { color: var(--primary); font-weight: 650; }
/* L'attribut hidden doit l'emporter sur le display des boutons (ex. bouton « Déposer » masqué par l'envoi automatique) */
.btn[hidden] { display: none; }
/* Envoi automatique en cours (data-autosubmit) : la zone patiente le temps du rechargement */
.dropzone.is-uploading { pointer-events: none; opacity: .6; cursor: progress; }
.dropzone-icon { width: 26px; height: 26px; color: var(--primary); }
.dropzone.has-files .dropzone-area { padding: .7rem 1rem; flex-direction: row; }
.dropzone.has-files .dropzone-icon { width: 18px; height: 18px; }
.has-error .dropzone-area { border-color: var(--danger); }
.dropzone-files { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .4rem; }
.dropzone-files:empty { display: none; }
.dropzone-file {
    display: flex; align-items: center; gap: .7rem;
    padding: .45rem .5rem .45rem .55rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.dropzone-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; flex: none; }
.dropzone-file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.dropzone-file-name { font-size: .88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* État vide */
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--text-muted); }
/* Grande icône de l'état vide uniquement (pas celle du bouton, qui garde la taille et la couleur du texte) */
.empty > .icon { width: 40px; height: 40px; color: var(--text-faint); stroke-width: 1.5; margin-bottom: .75rem; }
.empty h3 { color: var(--text); }
.empty p { max-width: 440px; margin: 0 auto 1.25rem; }
.start-choices .field-help { margin-top: .5rem; }
.start-choices .auth-divider { max-width: 440px; margin: 1.75rem auto; }
.empty-sm { padding: 1.5rem 1.35rem; text-align: left; font-size: .9rem; color: var(--text-muted); }

/* Barre de progression */
.progress { height: 6px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; min-width: 80px; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.progress.full > span { background: var(--success); }

/* Filtres */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.toolbar .search { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.toolbar .search .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.toolbar .search input { padding-left: 2.2rem; }
.toolbar select { width: auto; }
.tabs { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .25rem; background: #ebecf3; border-radius: var(--radius); }
.tabs a { padding: .35rem .8rem; border-radius: var(--radius-sm); font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Définitions */
.dl { display: grid; grid-template-columns: minmax(80px, max-content) minmax(0, 1fr); gap: .55rem 1rem; margin: 0; font-size: .9rem; }
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }

.prose { white-space: pre-line; line-height: 1.65; overflow-wrap: anywhere; }

.day-title { display: flex; align-items: baseline; gap: .6rem; margin: 1.75rem 0 .75rem; font-size: 1rem; text-transform: capitalize; }
.day-title:first-child { margin-top: 0; }

/* Messages flash */
/* En bas à gauche : sur téléphone, le menu en haut reste accessible pendant l'affichage d'un message */
.flashes { position: fixed; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); left: 1rem; z-index: 60; display: grid; gap: .5rem; width: min(400px, calc(100vw - 2rem)); }
.flash {
    display: flex; align-items: flex-start; gap: .65rem;
    padding: .8rem 1rem; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border-strong); position: relative;
    box-shadow: var(--shadow-lg); font-size: .9rem;
    animation: flash-in .25s ease;
}
.flash p { flex: 1; margin: 0; }
.flash-icon { margin-top: 1px; stroke-width: 2.6; }
.flash-success .flash-icon { color: var(--success); }
.flash-warning .flash-icon { color: var(--warning); }
.flash-danger .flash-icon { color: var(--danger); }
.flash button { border: 0; background: none; color: var(--text-faint); cursor: pointer; padding: .25rem .4rem; margin: -.3rem -.45rem -.3rem 0; font-size: 1.35rem; line-height: 1; }
.flash.hide { opacity: 0; transform: translateY(6px); transition: all .3s ease; }
@keyframes flash-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.alert { padding: .8rem 1rem; border-radius: var(--radius); font-size: .9rem; margin-bottom: 1rem; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-success { background: var(--success-soft); color: var(--success); }

/* --------------------------------------------------------------------------
   Formulaires
   -------------------------------------------------------------------------- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; }
.form-grid > .field-wide { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

.field { margin-bottom: 1.1rem; }
.field > label, .field legend { display: block; margin-bottom: .35rem; font-size: .87rem; font-weight: 600; color: var(--text); }
.field .required::after { content: " *"; color: var(--danger); }
.label-hint { font-weight: 400; color: var(--text-muted); }
.field-help { margin-top: .3rem; font-size: .8rem; color: var(--text-muted); }
.field-errors { list-style: none; margin: .35rem 0 0; padding: 0; color: var(--danger); font-size: .82rem; }
.form-errors { list-style: none; margin: 0 0 1rem; padding: .8rem 1rem; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-size: .9rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=number],
input[type=date], input[type=datetime-local], input[type=time], input[type=search], select, textarea {
    width: 100%;
    padding: .58rem .75rem;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font: inherit; font-size: .92rem;
    transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
/* Safari iOS donne aux champs date/heure une largeur minimale propre qui dépasse de l'écran : on la retire. */
input[type=date], input[type=datetime-local], input[type=time] { display: block; min-width: 0; max-width: 100%; }
@supports (-webkit-touch-callout: none) {
    input[type=date], input[type=datetime-local], input[type=time] { -webkit-appearance: none; appearance: none; min-height: 2.6rem; }
    input[type=date]::-webkit-date-and-time-value, input[type=datetime-local]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; }
}
select[multiple] { padding: .35rem; }
/* Ligne de formulaire masquée selon un autre choix (dependent_fields_controller.js) */
.field[hidden] { display: none; }
/* Listes déroulantes : flèche dessinée, décollée du bord droit */
select:not([multiple]) {
    appearance: none; -webkit-appearance: none;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6f85' stroke-width='2.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 .85rem center; background-size: 16px;
}
[data-color-scheme="dark"] select:not([multiple]) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0a6b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27, 47, 102, .18); }
/* Champs non modifiables : fond grisé, texte atténué, curseur interdit */
input:disabled, select:disabled, textarea:disabled, input[readonly], textarea[readonly] {
    background: var(--surface-muted); color: var(--text-muted); border-color: var(--border); border-style: dashed;
    cursor: not-allowed; box-shadow: none; -webkit-text-fill-color: var(--text-muted); opacity: 1;
}
.check:has(input:disabled) { color: var(--text-faint); cursor: not-allowed; }
.field:has(> :is(input, select, textarea):disabled) > label { color: var(--text-muted); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
input[type=file] { font-size: .9rem; }

.check { display: flex; align-items: flex-start; gap: .55rem; font-size: .9rem; cursor: pointer; font-weight: 500; }
.check input { margin: .2rem 0 0; width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
/* Case à cocher seule dans un champ : ne pas hériter du style des libellés de champ (display: block) */
.field > label.check { display: flex; margin-bottom: 0; font-size: .9rem; font-weight: 500; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .45rem 1rem; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-muted); max-height: 260px; overflow-y: auto; }
.choices:empty::before { content: "Aucun élément disponible pour le moment."; color: var(--text-faint); font-size: .85rem; }
/* « Mon profil › Apparence » : trois choix côte à côte */
.theme-choice .choices { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: none; }
@media (max-width: 560px) { .theme-choice .choices { grid-template-columns: 1fr; } }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding-top: 1.25rem; margin-top: .5rem; border-top: 1px solid var(--border); }
.form-actions .spacer { flex: 1; }

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

/* --------------------------------------------------------------------------
   Pages hors application (connexion, accueil, page publique)
   -------------------------------------------------------------------------- */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: var(--bg); }
/* dvh : hauteur réellement visible sur téléphone (100vh y inclut la barre d'adresse et décale la boîte vers le bas) */
@supports (min-height: 100dvh) { .auth { min-height: 100dvh; } }
@media (max-width: 640px) { .auth { place-items: start center; padding: 1.5rem 1rem 2rem; } }
.auth-card { width: 100%; max-width: 440px; }
.auth-card.wide { max-width: 680px; }
.auth-card > .brand { justify-content: center; margin-bottom: 1.5rem; font-size: 1.15rem; }
.auth-card .card-body { padding: 2rem; }
.auth-card h1 { font-size: 1.75rem; text-align: center; }
.auth-card .lead { text-align: center; color: var(--text-muted); margin-bottom: 1.5rem; }
.auth-foot { text-align: center; margin-top: 1.25rem; font-size: .9rem; color: var(--text-muted); }
.auth-foot.auth-back { margin-top: .5rem; }
.auth-back a { color: var(--text-muted); }
/* Connexion sur téléphone : tout tient dans la hauteur de l'écran, sans défilement */
@media (max-width: 640px) {
    /* Contenu centré verticalement dans l'écran */
    .auth:has(.auth-card.login) { place-items: center; padding: 1rem; }
    .auth-card.login > .brand { margin: .5rem 0 1.25rem; }
    .auth-card.login .card-body { padding: 1.1rem 1.25rem; }
    .auth-card.login h1 { font-size: 1.4rem; margin-bottom: .25rem; }
    .auth-card.login .lead { margin-bottom: .8rem; font-size: .875rem; }
    .auth-card.login .field { margin-bottom: .75rem; }
    .auth-card.login .auth-divider { margin: .6rem 0; }
    .auth-card.login .auth-foot { margin: .7rem 0 0; }
    .auth-card.login .auth-foot.auth-back { margin-top: .4rem; }
    .auth-card.login .legal-links { margin-top: .6rem; }
}
.legal-links { text-align: center; margin: 1rem 0 0; font-size: .8rem; }
.legal-links a { color: var(--text-faint); }

/* Connexion / inscription avec Google */
.btn-google { gap: .6rem; background: #fff; color: #1f1f1f; border: 1px solid var(--border-strong); }
.btn-google:hover { background: #f7f8fa; color: #1f1f1f; }
.google-icon { width: 18px; height: 18px; flex: none; }
.auth-divider { display: flex; align-items: center; gap: .75rem; margin: 1rem 0; color: var(--text-faint); font-size: .8rem; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.text-center { text-align: center; }

/* Ligne de liste entièrement cliquable : le lien .title couvre toute la ligne */
.row-link { position: relative; cursor: pointer; }
.row-link:hover { background: var(--surface-muted); }
.row-link a.title::after { content: ''; position: absolute; inset: 0; }
.row-link a.title:focus-visible { outline: none; }
.row-link:has(a.title:focus-visible) { box-shadow: inset 0 0 0 2px var(--primary); }
img.asso-logo { object-fit: contain; background: #fff; border: 1px solid var(--border); padding: 3px; }

/* --------------------------------------------------------------------------
   Administration de la plateforme
   -------------------------------------------------------------------------- */
.admin-tag { margin-top: .75rem; padding: .4rem .7rem; border-radius: var(--radius); background: var(--chalk-yellow); color: var(--board); font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.nav a .nav-count { margin-left: auto; min-width: 1.4rem; padding: 0 .4rem; border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1.4rem; text-align: center; }
.nav a.active:has(.nav-count)::after { display: none; }
/* Numéro de ticket du support (« #000042 ») devant l'objet */
.ticket-ref { color: var(--text-muted); font-weight: 600; font-variant-numeric: tabular-nums; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi-grid > .card + .card { margin-top: 0; }
.kpi { display: flex; flex-direction: column; gap: .3rem; padding: 1.1rem 1.2rem; color: var(--text); }
a.kpi:hover { color: var(--text); box-shadow: var(--shadow); }
.kpi-label { display: flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.kpi-value { font-size: 1.9rem; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-value.muted { color: var(--text-faint); }
.kpi-trend { font-size: .8rem; color: var(--text-muted); }
.kpi-trend.up::before { content: '▲ '; color: var(--success); }
.kpi-trend.down::before { content: '▼ '; color: var(--danger); }
.kpi-grid-plain { margin-bottom: .75rem; }
.kpi-grid-plain .kpi { padding: 0; }
.revenue-card { margin-bottom: 1.25rem; }
.admin-charts { margin-bottom: 1.25rem; }
@media (max-width: 960px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Admin › Finances */
.kpi-grid.finance-kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.finance-statement { display: grid; grid-template-columns: 1fr auto; gap: .55rem 1.5rem; max-width: 520px; margin: 0 0 .9rem; font-variant-numeric: tabular-nums; }
.finance-statement dt { color: var(--text-muted); }
.finance-statement dd { margin: 0; text-align: right; font-weight: 600; }
.finance-statement .finance-total { padding-top: .6rem; border-top: 1px solid var(--border); font-weight: 800; font-size: 1.15rem; }
.finance-statement dt.finance-total { color: var(--text); font-size: 1rem; align-self: end; }
.finance-per-month { margin: 0 0 .5rem; font-weight: 600; }
.finance-subtitle { margin: 1.25rem 0 .5rem; font-size: .9rem; font-weight: 750; }
.finance-categories { list-style: none; margin: 0; padding: 0; max-width: 520px; font-variant-numeric: tabular-nums; }
.finance-categories li { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.finance-categories li:last-child { border-bottom: 0; }
.finance-note { color: var(--text-muted); font-size: .82rem; }
@media (max-width: 900px) { .kpi-grid.finance-kpis-3 { grid-template-columns: 1fr; } }

/* Graphiques en barres (templates/admin/_charts.html.twig) : HTML/CSS, textes à taille fixe */
.chart { margin: 0; --chart-h: 170px; }
.chart-daily { --chart-h: 210px; }
.chart-body { display: grid; grid-template-columns: auto 1fr; gap: .6rem; padding: 1.4rem 0 1.6rem; font-size: .75rem; font-variant-numeric: tabular-nums; }
.chart-axis { position: relative; height: var(--chart-h); min-width: 1.4rem; color: var(--text-faint); }
.chart-axis span { position: absolute; right: 0; transform: translateY(50%); line-height: 1; }
.chart-plot { position: relative; height: var(--chart-h); }
.chart-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); }
.chart-baseline { border-top: 1px solid var(--border-strong); }
.chart-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
.chart-col { position: relative; display: flex; align-items: flex-end; justify-content: center; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.chart-col:hover { background: var(--surface-muted); }
.chart-bar { position: relative; width: min(62%, 28px); min-height: 2px; border-radius: 4px 4px 1px 1px; background: var(--primary); opacity: .45; transition: opacity .15s; }
.chart-col.is-current .chart-bar, .chart-col:hover .chart-bar { opacity: 1; }
.chart-value { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: .3rem; font-size: .85rem; font-weight: 750; color: var(--text); white-space: nowrap; }
.chart-label { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: .45rem; color: var(--text-muted); white-space: nowrap; }
.chart-tip {
    position: absolute; z-index: 2; bottom: 100%; left: 50%; transform: translate(-50%, -.45rem);
    display: none; flex-direction: column; gap: .1rem; padding: .4rem .6rem;
    border-radius: var(--radius-sm); background: var(--text); color: var(--surface); box-shadow: var(--shadow);
    font-size: .78rem; line-height: 1.25; white-space: nowrap; pointer-events: none;
}
.chart-tip span { opacity: .8; }
.chart-tip strong { font-size: .9rem; }
.chart-col.tip-start .chart-tip { left: 0; transform: translate(0, -.45rem); }
.chart-col.tip-end .chart-tip { left: auto; right: 0; transform: translate(0, -.45rem); }
.chart-col:hover .chart-tip { display: flex; }
.chart-col:hover .chart-value { visibility: hidden; }
.chart-table { margin-top: .6rem; font-size: .85rem; }
.chart-table summary { cursor: pointer; color: var(--text-muted); }
.chart-table .table { margin-top: .5rem; }

.table-logo { width: 32px; height: 32px; object-fit: contain; border-radius: 8px; border: 1px solid var(--border); background: #fff; padding: 2px; flex: none; }
.support-reply { background: var(--primary-soft); border-color: transparent; }
.support-screenshot { display: block; max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: zoom-in; }

/* Image agrandie par-dessus la page (assets/controllers/lightbox_controller.js) */
.lightbox {
    max-width: calc(100vw - 2rem); max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem);
    padding: 0; border: 0; border-radius: var(--radius-lg); background: transparent; overflow: visible;
}
.lightbox::backdrop { background: rgba(15, 17, 35, .78); }
.lightbox[open] { animation: modal-in .18s ease-out; }
.lightbox img {
    display: block; max-width: calc(100vw - 2rem); max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem);
    border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .5);
}
.lightbox-close { position: absolute; top: .5rem; right: .5rem; z-index: 1; box-shadow: var(--shadow); }

/* « Se connecter en tant que » : bandeau visible sur toutes les pages, réservé à l'administrateur de la plateforme */
.impersonation-bar {
    position: relative; z-index: 70;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem 1rem;
    padding: .5rem 1rem; background: #b45309; color: #fff; font-size: .88rem; font-weight: 600; text-align: center;
}
.impersonation-bar .btn { background: #fff; color: #7c2d12; }
.impersonation-bar .btn:hover { background: #fef3c7; color: #7c2d12; }

/* FAQ (Aide) */
.faq-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.faq-toc { position: sticky; top: 76px; display: flex; flex-direction: column; padding: .5rem; }
.faq-toc a { padding: .45rem .65rem; border-radius: var(--radius-sm); color: var(--text-muted); font-size: .9rem; font-weight: 500; }
.faq-toc a:hover { background: var(--surface-muted); color: var(--text); }
.faq-section { scroll-margin-top: 76px; }
.faq-item { border-top: 1px solid var(--border); }
.faq-item summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.25rem; font-weight: 600; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { background: var(--surface-muted); }
.faq-item[open] summary .icon { transform: rotate(180deg); }
.faq-answer { padding: .6rem 1.25rem 1.1rem; color: var(--text-muted); line-height: 1.6; }
.faq-answer p { margin: 0 0 .5rem; }
.faq-answer ul { margin: 0 0 .5rem; padding-left: 1.2rem; }
@media (max-width: 960px) {
    .faq-layout { grid-template-columns: 1fr; }
    .faq-toc { position: static; flex-direction: row; flex-wrap: wrap; }
}

/* Commentaires des commissions */
.comment { position: relative; display: flex; gap: .7rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); }
.comment:last-of-type { border-bottom: 0; }
.comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; font-size: .88rem; }
.comment-head time { font-size: .8rem; }
/* Poubelle en haut à droite, hors du flux : elle ne passe plus seule à la ligne sur mobile */
.comment-head:has(.inline-form) { padding-right: 2.25rem; }
.comment-head .inline-form { position: absolute; top: .6rem; right: .75rem; }
.comment-body { margin-top: .2rem; font-size: .93rem; line-height: 1.55; overflow-wrap: anywhere; }
.mention { padding: 0 .2rem; border-radius: 4px; background: var(--primary-soft); color: var(--primary-ink); font-weight: 600; }
.mention-field { position: relative; margin-bottom: .5rem; }
.mention-list {
    position: absolute; left: 0; top: 100%; z-index: 20; margin: .25rem 0 0; padding: .3rem; list-style: none;
    min-width: 240px; max-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.mention-list[hidden] { display: none; }
.mention-list li { display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem; border-radius: var(--radius-sm); cursor: pointer; font-size: .9rem; }
.mention-list li.active, .mention-list li:hover { background: var(--primary-soft); }
.comment-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.comment-actions .field-help { margin: 0; }

/* Bandeau de consentement aux cookies */
.cookie-banner {
    position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 60;
    display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem;
    max-width: 920px; margin: 0 auto; padding: 1rem 1.25rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.cookie-banner[hidden] { display: none; }
.cookie-banner-text { flex: 1 1 420px; min-width: 0; }
.cookie-banner h2 { margin: 0 0 .25rem; font-size: 1rem; }
.cookie-banner p { margin: 0; font-size: .88rem; color: var(--text-muted); line-height: 1.5; }
.cookie-banner-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
@media (max-width: 640px) {
    .cookie-banner { left: .5rem; right: .5rem; bottom: .5rem; padding: .9rem 1rem; }
    .cookie-banner-actions { width: 100%; }
    .cookie-banner-actions .btn { flex: 1 1 0; }
}

/* Conditions générales d'utilisation */
.auth-card.legal { max-width: 860px; }
.legal-text h1 { font-size: 1.5rem; margin-bottom: .25rem; }
.legal-text h2 { font-size: 1.05rem; margin: 1.6rem 0 .5rem; }
.legal-text p, .legal-text li { line-height: 1.65; color: var(--text); }
.legal-text ul { padding-left: 1.2rem; }
.legal-text ul.legal-identity { list-style: none; padding-left: 0; }
.legal-toc { margin: 1rem 0 1.5rem; padding: .8rem 1rem; background: var(--surface-muted); border-radius: var(--radius-sm); font-size: .9rem; }
.legal-toc ol { margin: 0; padding-left: 1.2rem; columns: 2; column-gap: 1.5rem; }
@media (max-width: 640px) { .legal-toc ol { columns: 1; } }

.site { background: var(--bg); min-height: 100vh; }
.site-header { display: flex; align-items: center; justify-content: space-between; max-width: 1120px; margin: 0 auto; padding: 1.25rem 1.5rem; }
.site-header nav { display: flex; gap: .5rem; }
.hero { max-width: 1120px; margin: 0 auto; padding: 4rem 1.5rem 3rem; text-align: center; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); letter-spacing: -.03em; max-width: 820px; margin: 0 auto 1rem; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero p { font-size: 1.15rem; color: var(--text-muted); max-width: 640px; margin: 0 auto 2rem; }
.hero .btn { padding: .8rem 1.4rem; font-size: 1rem; }
.hero .flex { justify-content: center; }
.features { max-width: 1120px; margin: 0 auto; padding: 1rem 1.5rem 5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }
.feature { padding: 1.5rem; }
.feature .stat-icon { margin-bottom: 1rem; }
.feature h3 { font-size: 1.02rem; }
.feature p { color: var(--text-muted); font-size: .92rem; margin: 0; }
.site-footer { text-align: center; padding: 2rem 1rem; color: var(--text-faint); font-size: .85rem; border-top: 1px solid var(--border); }
.site-social { margin: 0 auto 1.5rem; }
.site-social-title { margin: 0 0 .75rem; font-weight: 800; font-size: 1.05rem; color: var(--primary); }
.site-social-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.site-social-links a { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.75rem; padding: .55rem 1.1rem; border-radius: 999px; background: var(--primary); color: #fff; font-weight: 700; font-size: .95rem; text-decoration: none; transition: background .15s, transform .15s; }
.site-social-links a:hover, .site-social-links a:focus-visible { background: var(--accent-ink); color: #fff; transform: translateY(-1px); }
.site-social-links .icon { width: 1.2rem; height: 1.2rem; }

.public-hero { background: var(--board); color: var(--chalk); padding: 3rem 1.5rem 4rem; }
.public-hero .inner { max-width: 960px; margin: 0 auto; }
.public-hero h1 { font-size: 2rem; }
.public-hero p { color: var(--chalk-muted); margin: 0; max-width: 680px; }
.public-hero a { color: var(--chalk); text-decoration: underline; }
.public-body { max-width: 960px; margin: -2rem auto 3rem; padding: 0 1.5rem; }

/* Emails : aperçu */
.mail-preview { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.mail-preview header { padding: .9rem 1.1rem; background: var(--surface-muted); border-bottom: 1px solid var(--border); font-size: .88rem; }
.mail-preview .body { padding: 1.25rem 1.1rem; }

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

/* Les cellules de grille et les blocs flexibles peuvent rétrécir sous la largeur de leur contenu
   (sinon un email long ou un bouton pousse la page au-delà de l'écran). */
.grid > *, .stack > *, .list-item > * { min-width: 0; }
img, svg, video { max-width: 100%; }
/* Les icônes gardent leur taille (sinon elles rétrécissent avec une cellule de tableau comprimée sur téléphone) */
svg.icon { max-width: none; }
.table td.actions { width: 1%; white-space: nowrap; }

@media (max-width: 640px) {
    /* Les lignes de liste passent à la ligne : le texte en premier, actions et badges en dessous. */
    .list-item { flex-wrap: wrap; padding: .8rem 1rem; gap: .6rem .75rem; }
    .list-item > .grow { flex: 1 1 60%; }
    /* Sur mobile, chaque info (heure, lieu…) sur sa propre ligne ; côte à côte sur ordinateur */
    .list-item .meta { gap: .2rem .7rem; flex-direction: column; align-items: flex-start; }
    /* Étiquettes (statut, publique, places) sous le texte, alignées sur le titre après la pastille de date */
    /* La pastille de date fait 50px ; marge négative pour garder le même écart qu'entre l'heure et le lieu */
    .list-item-tags { flex-basis: 100%; padding-left: calc(50px + .75rem); margin-top: -.4rem; }
    .list-item-tags small { font-size: .82rem; display: inline-flex; align-items: center; gap: .3rem; }
    .task-side { flex-direction: column; align-items: flex-end; gap: .35rem; }

    .card-header { padding: .9rem 1rem; flex-wrap: wrap; }
    .card-body { padding: 1rem; }
    .page-header { margin-bottom: 1.1rem; }
    .page-header h1 { font-size: 1.35rem; }
    .page-header .actions { width: 100%; }
    .page-header .actions .btn { flex: 1 1 0; }
    .toolbar .search { min-width: 0; max-width: none; flex-basis: 100%; }
    /* Onglets : passent à la ligne pour rester tous visibles (pas de défilement caché sur le côté) */
    .tabs { display: flex; max-width: 100%; flex-wrap: wrap; }
    .tabs a { white-space: nowrap; }
    .dl { grid-template-columns: 1fr; gap: .1rem; }
    .dl dd { margin-bottom: .5rem; }
    .flashes { left: .75rem; right: .75rem; bottom: calc(.75rem + env(safe-area-inset-bottom, 0px)); width: auto; }
    /* Formulaires : Enregistrer et Annuler côte à côte, Supprimer seul en dessous */
    .form-actions .btn { flex: 1 1 0; }
    .form-actions .spacer { flex-basis: 100%; height: 0; }
}

/* Listes Membres actifs, Logistique et Parents bénévoles : sur téléphone, chaque ligne devient
   une petite fiche (nom et crayon en haut, le reste dessous), sans défilement horizontal. */
@media (max-width: 640px) {
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody { display: block; }
    .table-cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .3rem .75rem; padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
    .table-cards tr:last-child { border-bottom: 0; }
    .table-cards td { display: block; padding: 0; border: 0; min-width: 0; text-align: left; overflow-wrap: anywhere; }
    .table-cards td.actions { grid-column: 2; grid-row: 1; align-self: start; width: auto; text-align: right; margin: -.3rem -.4rem 0 0; }
    .table-cards td.actions:empty { display: none; }
    .table-cards .cell-dash { display: none; }
    .table-cards td:has(> .cell-dash:only-child) { display: none; }
    .table-cards [data-label]::before { content: attr(data-label) " : "; color: var(--text-muted); }

    /* Membres actifs : avatar et nom, puis contact et écoles alignés sous le nom. Les compétences restent sur la fiche. */
    .volunteer-table td:first-child { grid-column: 1; grid-row: 1; }
    .volunteer-table .cell-contact, .volunteer-table .cell-schools { grid-column: 1 / -1; padding-left: calc(34px + .75rem); font-size: .86rem; }
    .volunteer-table .cell-skills { display: none; }

    /* Logistique : nom et crayon, famille et état, puis rangement et quantité */
    .equipment-table .cell-name { grid-column: 1; grid-row: 1; }
    .equipment-table .cell-name small { display: block; margin-top: .1rem; line-height: 1.35; }
    .equipment-table .cell-category { grid-column: 1; grid-row: 2; color: var(--text-muted); font-size: .86rem; }
    .equipment-table .cell-state { grid-column: 2; grid-row: 2; justify-self: end; }
    .equipment-table .cell-location { grid-column: 1; grid-row: 3; font-size: .86rem; }
    .equipment-table .cell-category, .equipment-table .cell-location { display: flex; align-items: center; gap: .35rem; }
    .equipment-table td .cell-icon { display: inline-block; flex: none; color: var(--text-muted); }
    .equipment-table .cell-quantity { grid-column: 2; grid-row: 3; text-align: right; font-size: .86rem; white-space: nowrap; }

    /* Emails : objet sur toute la largeur, puis destinataires, statut et date */
    .mailing-table td:first-child { grid-column: 1 / -1; }
    .mailing-table td:last-child { white-space: nowrap; }

    /* Parents bénévoles : email et crayon, nom et statut, puis école */
    .parent-table .cell-email { grid-column: 1; grid-row: 1; }
    .parent-table .cell-name { grid-column: 1; grid-row: 2; font-size: .86rem; }
    .parent-table .cell-status { grid-column: 2; grid-row: 2; justify-self: end; align-self: start; }
    .parent-table .cell-school { grid-column: 1 / -1; }
}

.select-compact { width: auto; padding: .3rem .5rem; font-size: .85rem; }

/* iPhone : Safari zoome sur les champs dont le texte fait moins de 16 px, ce qui élargit la page. */
@media (max-width: 960px) {
    input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=number],
    input[type=date], input[type=datetime-local], input[type=time], input[type=search], select, textarea,
    .select-compact { font-size: 16px; }
    /* Éditeur de texte enrichi (zone de saisie et adresse d'un lien) */
    .rich-text .rich-text-editor, .rich-text trix-toolbar .trix-input--dialog { font-size: 16px; }
}

/* Utilitaires */
.flex { display: flex; align-items: center; gap: .5rem; }
.flex-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; } .mt-1 { margin-top: 1rem; } .mb-1 { margin-bottom: 1rem; } .mt-2 { margin-top: 1.5rem; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.strike { text-decoration: line-through; color: var(--text-faint); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.equipment-table .cell-icon { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Tableau de bord : bilan financier des commissions (recettes / dépenses / résultat) */
.text-muted { color: var(--text-muted); font-weight: 500; }
.finance-card { margin-bottom: 1.25rem; }
.finance-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; padding: 1.25rem 1.25rem 1rem; }
.finance-total { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .1rem .45rem; padding: .75rem .9rem; border-radius: var(--radius); background: var(--surface-muted); }
.finance-total small { color: var(--text-muted); font-size: .8rem; }
.finance-total strong { grid-column: 1 / -1; font-size: 1.25rem; letter-spacing: -.01em; }
.finance-total.result { grid-template-columns: 1fr; background: var(--success-soft); color: var(--success); }
.finance-total.result small { color: inherit; }
.finance-total.result.negative { background: var(--danger-soft); color: var(--danger); }
.finance-dot { width: 10px; height: 10px; border-radius: 3px; }
.finance-dot.in, .finance-bar.in { background: #22a35a; }
.finance-dot.out, .finance-bar.out { background: #e5484d; }
.finance-chart { display: grid; gap: .8rem; padding: .25rem 1.25rem 1.25rem; }
.finance-row { display: grid; grid-template-columns: minmax(90px, 180px) 1fr 90px; align-items: center; gap: .9rem; }
.finance-label { font-weight: 600; font-size: .88rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finance-bars { display: grid; gap: 4px; padding-right: 64px; }
.finance-bar { position: relative; height: 14px; width: max(var(--w), 3px); border-radius: 0 4px 4px 0; transform-origin: left; animation: finance-grow .8s cubic-bezier(.2, .7, .2, 1) both; }
.finance-bar.out { animation-delay: .1s; }
.finance-bar span { position: absolute; left: calc(100% + 6px); top: 50%; transform: translateY(-50%); font-size: .72rem; color: var(--text-muted); white-space: nowrap; }
.finance-result { text-align: right; font-weight: 700; font-size: .9rem; color: var(--success); }
.finance-result.negative { color: var(--danger); }
@keyframes finance-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .finance-bar { animation: none; } }
@media (max-width: 640px) {
    .finance-totals { grid-template-columns: 1fr 1fr; }
    .finance-total.result { grid-column: 1 / -1; }
    .finance-row { grid-template-columns: 1fr auto; }
    .finance-bars { grid-column: 1 / -1; grid-row: 2; padding-right: 60px; }
}

/* Abonnement : bandeau de fin d'essai, page « Abonnement » */
/* Feuille blanche posée sur le liège, liseré orange du logo à gauche (l'orange reste un accent, pas une surface) */
.billing-banner { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; margin-bottom: 1.25rem; border-radius: var(--radius); background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-left: 5px solid var(--accent); box-shadow: var(--shadow-sm); }
.billing-banner > .icon { flex: none; color: var(--accent-ink); }
.billing-banner p { margin: 0; flex: 1; font-size: .92rem; }
.billing-banner strong { color: var(--accent-ink); }
.billing-banner.danger { border-left-color: var(--danger); }
.billing-banner.danger > .icon, .billing-banner.danger strong { color: var(--danger); }
/* Autre année que l'année en cours : bandeau tableau bleu nuit, bien visible sur le liège */
.billing-banner.year-banner { position: relative; background: var(--board); color: var(--chalk); border-color: var(--board); box-shadow: var(--shadow); }
.year-banner > .icon, .year-banner strong { color: var(--chalk-yellow); }
.year-banner .btn-primary { background: var(--chalk-yellow); color: var(--board); box-shadow: none; }
.year-banner .btn-primary:hover { background: #fec865; color: var(--board); }
.billing-status { margin-bottom: 1.25rem; }
.billing-status p { margin: .6rem 0 .9rem; }
.billing-plans { display: grid; grid-template-columns: repeat(2, minmax(0, 320px)); gap: 1.25rem; }
@media (max-width: 720px) { .billing-plans { grid-template-columns: 1fr; } }
/* Cartes de même hauteur (la règle .card + .card décalerait la seconde), bouton aligné en bas */
.billing-plans > .card + .card { margin-top: 0; }
.billing-plan { position: relative; display: flex; flex-direction: column; padding: 1.5rem; }
.billing-plan .billing-note { flex: 1; }
.billing-plan.featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow-lg); }
.billing-plan-badge { position: absolute; top: -12px; left: 1.5rem; padding: .2rem .7rem; border-radius: 999px; background: var(--primary); color: #fff; font-size: .75rem; font-weight: 700; }
.billing-price { margin: .4rem 0 .2rem; color: var(--text-muted); }
.billing-price strong { font-size: 2rem; color: var(--text); letter-spacing: -.02em; }
.billing-note { color: var(--text-muted); font-size: .88rem; min-height: 2.6em; }
.billing-secure { display: flex; align-items: center; gap: .4rem; margin-top: 1rem; color: var(--text-muted); font-size: .85rem; }
.billing-plan .inline-form { display: block; }
.billing-terms { margin: .5rem 0 0; color: var(--text-muted); font-size: .85rem; }

/* Membres actifs › Inviter : lien à partager, QR code, demandes à valider */
.invite-link { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.invite-link input { flex: 1 1 240px; min-width: 0; font-family: ui-monospace, monospace; font-size: .85rem; }
.invite-qr { width: 200px; max-width: 100%; margin-bottom: .75rem; padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.invite-qr svg { display: block; width: 100%; height: auto; }
.invite-request-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.invite-request-actions form { margin: 0; }

/* Commission : créneaux regroupés par stand, lien public d'inscription des bénévoles */
.shift-group-head { padding: .9rem 1.35rem .35rem; }
.shift-group-edit { float: right; margin: -.2rem -.5rem 0 .5rem; }
.shift-group-title { margin: 0 0 .15rem; font-size: 1rem; font-weight: 700; }
.shift-notes { font-size: .875rem; color: var(--text-muted); margin-top: .35rem; }
.shift-notes > :first-child { margin-top: 0; }
.shift-notes > :last-child { margin-bottom: 0; }
.list-item.shift-slot { padding-left: 2.1rem; }
.shift-people { margin-top: .35rem; }
.shift-people .badge { font-size: .68rem; padding: .05rem .4rem; }
.signup-qr { width: 160px; }
.shift-count { width: 110px; }
.shift-group-head .meta { font-size: .82rem; color: var(--text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .9rem; }
.shift-group-head .meta span { display: inline-flex; align-items: center; gap: .3rem; }
.shift-group-head .meta-lines { flex-direction: column; align-items: flex-start; gap: .2rem; }
.shift-group-head .meta-lines > * { display: inline-flex; align-items: center; gap: .3rem; }
/* Mobile : une ligne par tranche (heure, places, bouton), inscrits et consignes en dessous */
@media (max-width: 640px) {
    .shift-group-head { padding: .8rem 1rem .2rem; }
    .list-item.shift-slot { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .15rem .7rem; padding: .55rem 1rem .55rem 1.6rem; }
    .shift-slot > .grow { display: contents; }
    .shift-slot > .grow > * { grid-column: 1 / -1; }
    .shift-slot > .grow > .title { grid-row: 1; grid-column: 1; }
    .shift-slot > .shift-count { grid-row: 1; grid-column: 2; width: 3.2rem; }
    .shift-slot > .inline-form { grid-row: 1; grid-column: 3; }
    .shift-slot .shift-count-label { display: none; }
    .shift-slot .shift-count .flex { justify-content: flex-end; }
    .shift-slot .progress { min-width: 0; }
    .shift-slot .shift-people { margin-top: 0; font-size: .8rem; }
    .shift-slot .btn-shift { min-width: 6.4rem; padding: .3rem .7rem; font-size: .8rem; }
}


/* Menu « Exporter le planning » (Excel ou PDF calendrier) sur la page d'une commission */
.export-menu { position: relative; }
.export-menu > summary { list-style: none; }
.export-menu > summary::-webkit-details-marker { display: none; }
.export-menu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
    width: 270px; padding: .35rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.export-menu-panel a { display: flex; align-items: flex-start; gap: .6rem; padding: .55rem .6rem; border-radius: var(--radius-sm); color: var(--text); font-size: .9rem; }
.export-menu-panel a:hover { background: var(--surface-muted); color: var(--text); }
.export-menu-panel a > .icon { margin-top: .15rem; color: var(--primary); }
.export-menu-panel span { display: flex; flex-direction: column; }
.export-menu-panel small { color: var(--text-muted); font-size: .8rem; }
@media (max-width: 640px) { .export-menu-panel { left: 0; right: auto; } }

/* Guide « Par quoi commencer ? » du tableau de bord */
.guide { margin-bottom: 1.25rem; }
.guide .card-header { align-items: flex-start; gap: .75rem; }
.guide .card-header h2 { display: flex; align-items: center; gap: .5rem; }
.guide .card-header h2 .icon { color: var(--accent); }
.guide-heading { flex: 1; min-width: 0; }
.guide-lead { margin: .25rem 0 0; color: var(--text-muted); font-size: .9rem; }
.guide-head-actions { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; margin-left: auto; }
.guide-count { color: var(--text-muted); font-size: .85rem; white-space: nowrap; }
.guide-progress { margin: 0; height: 5px; border-radius: 0; }
.guide-progress > span { border-radius: 0; }
.guide-steps { list-style: none; margin: 0; padding: 0; }
.guide-steps li:last-child .list-item { border-bottom: 0; }
.guide-step { color: inherit; text-decoration: none; }
.guide-step:hover { background: var(--surface-muted); }
.guide-step .grow { display: grid; gap: .15rem; min-width: 0; }
.guide-step.is-done .title { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.guide-num { display: grid; place-items: center; flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--primary); color: var(--primary); font-size: .75rem; font-weight: 700; }
@media (max-width: 640px) {
    /* Titre et flèche de repli sur la première ligne, avancement et « Masquer » en dessous */
    .guide .card-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; }
    .guide-heading { grid-column: 1; grid-row: 1; }
    .guide-toggle { grid-column: 2; grid-row: 1; align-self: start; }
    .guide-head-actions { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; margin-left: 0; }
    .guide.is-collapsed .guide-toggle { align-self: center; }
}
.guide-toggle .icon { transition: transform .2s ease; }
.guide:not(.is-collapsed) .guide-toggle .icon { transform: rotate(180deg); }
.guide.is-collapsed .guide-lead { display: none; }
.guide.is-collapsed .card-header { align-items: center; border-bottom: 0; }

/* Logistique : lien vers la facture à côté du nom du matériel */
.invoice-link { display: inline-flex; align-items: center; gap: .3rem; margin-top: .2rem; font-size: .85rem; font-weight: 600; color: var(--primary); }
.invoice-link:hover { text-decoration: underline; }

/* Jauge de l'espace de stockage des documents */
.storage-quota { display: grid; gap: .35rem; margin: 1rem 0 .25rem; }
.storage-quota.is-warning .progress > span { background: var(--warning); }
.storage-quota.is-full .progress > span { background: var(--danger); }
