/* ==========================================================================
   APE Gestion · design system
   Polices système (aucun appel externe, RGPD), palette indigo + neutres chauds.
   ========================================================================== */

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;
    --primary-ink: #3730a3;

    --bg: #f7f7fb;
    --surface: #ffffff;
    --surface-muted: #f3f4f8;
    --border: #e6e7ef;
    --border-strong: #d4d6e2;

    --text: #1f2133;
    --text-muted: #6b6f85;
    --text-faint: #9a9db0;

    --success: #15803d;
    --success-soft: #e8f7ee;
    --warning: #b45309;
    --warning-soft: #fdf3e2;
    --danger: #c0262d;
    --danger-soft: #fdecec;
    --info: #1d64c8;
    --info-soft: #e8f1fd;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(23, 25, 51, .05);
    --shadow: 0 1px 3px rgba(23, 25, 51, .06), 0 6px 16px -6px rgba(23, 25, 51, .08);
    --shadow-lg: 0 20px 40px -12px rgba(23, 25, 51, .18);

    --sidebar-w: 256px;
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::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;
}

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: -.01em; }
h1 { font-size: 1.6rem; }
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
   -------------------------------------------------------------------------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 40;
    transition: transform .2s ease;
}

.sidebar-header { padding: 1rem 1rem .75rem; border-bottom: 1px solid var(--border); }

.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--text); font-size: 1.02rem; }
.brand:hover { color: var(--text); }
/* 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: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; font-size: .95rem; font-weight: 800;
    box-shadow: 0 4px 10px -4px rgba(99, 102, 241, .6);
}

.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(--surface-muted); 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 var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.asso-switch-menu a { display: block; padding: .45rem .6rem; border-radius: var(--radius-sm); color: var(--text); font-size: .9rem; }
.asso-switch-menu a:hover { background: var(--surface-muted); }

.nav { flex: 1; overflow-y: auto; padding: .75rem .65rem 1rem; }
.nav-section { margin: 1rem .5rem .35rem; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.nav a {
    display: flex; align-items: center; gap: .65rem;
    padding: .5rem .65rem; margin-bottom: 1px;
    border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 500; font-size: .92rem;
}
.nav a:hover { background: var(--surface-muted); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary-ink); }
.nav a.active .icon { color: var(--primary); }

.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(255, 255, 255, .9); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.topbar .topbar-menu, .topbar .topbar-title { display: none; }
.topbar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

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

/* 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; }
.notif-count { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid var(--surface); box-sizing: content-box; }
.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: #f5f7ff; }
.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: 1180px; 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; }
.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%); box-shadow: var(--shadow-lg); }
    .app.nav-open .sidebar { transform: none; }
    .app.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 17, 35, .35); z-index: 35; }
    .main { margin-left: 0; }
    .topbar { padding: .5rem 1rem; }
    .topbar .topbar-menu { display: inline-flex; }
    .topbar .topbar-title { 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(79, 70, 229, .3); outline-offset: 1px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, .3); }
.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: #f1c4c6; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #116632; 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: 1rem; }
.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-size: 1.55rem; font-weight: 700; line-height: 1.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-faint); padding: .7rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.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: #fafafe; }
.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; }

.date-chip {
    display: grid; place-items: center; flex: none;
    width: 48px; padding: .3rem 0; border-radius: 10px;
    background: var(--primary-soft); color: var(--primary-ink); text-align: center; line-height: 1.1;
}
.date-chip .d { font-size: 1.15rem; font-weight: 750; }
.date-chip .m { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.date-chip.past { background: var(--surface-muted); color: var(--text-muted); }

/* 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(79, 70, 229, .15); }
.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: #f1c4c6; }
.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 { 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; }
.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(79, 70, 229, .3); outline-offset: 2px; }
.dropzone-title strong { color: var(--primary); font-weight: 650; }
.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); }
.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; }
.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 */
.flashes { position: fixed; top: 1rem; right: 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); border-left: 4px solid var(--info);
    box-shadow: var(--shadow-lg); font-size: .9rem;
    animation: flash-in .25s ease;
}
.flash p { flex: 1; margin: 0; }
.flash button { border: 0; background: none; color: var(--text-faint); cursor: pointer; padding: 0; font-size: 1.2rem; line-height: 1; }
.flash-success { border-left-color: var(--success); }
.flash-warning { border-left-color: var(--warning); }
.flash-danger { border-left-color: var(--danger); }
.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); }
.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; }
select[multiple] { padding: .35rem; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
/* 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; }

.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:
    radial-gradient(1200px 500px at 10% -10%, #e0e7ff 0, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #f3e8ff 0, transparent 55%), 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.35rem; 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); }
.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: #1f2133; color: #fff; 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; }

.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)); } }

.chart { margin: 0; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-baseline { stroke: var(--border-strong); }
.chart-tick, .chart-label { fill: var(--text-muted); font-size: 13px; }
.chart-value { fill: var(--text); font-size: 14px; font-weight: 700; }
.chart-bar { fill: var(--primary); }
.chart-hit { fill: transparent; }
.chart-col:hover .chart-hit { fill: var(--surface-muted); }
.chart-col:hover .chart-bar { fill: var(--primary-ink); }
.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 { border-left: 3px solid var(--primary); }
.support-screenshot { display: block; max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* « 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: 0 1.25rem 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 { 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; }
.comment-head .inline-form { margin-left: auto; }
.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-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:
    radial-gradient(1200px 600px at 0% -10%, #e0e7ff 0, transparent 60%),
    radial-gradient(900px 600px at 100% 0%, #f3e8ff 0, transparent 55%), 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; background: linear-gradient(135deg, #4f46e5, #9333ea); -webkit-background-clip: text; background-clip: text; color: transparent; }
.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); }

.public-hero { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; padding: 3rem 1.5rem 4rem; }
.public-hero .inner { max-width: 960px; margin: 0 auto; }
.public-hero h1 { font-size: 2rem; }
.public-hero p { opacity: .9; margin: 0; max-width: 680px; }
.public-hero a { color: #fff; 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%; }
    .list-item .meta { gap: .2rem .7rem; }

    .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 auto; }
    .toolbar .search { min-width: 0; max-width: none; flex-basis: 100%; }
    .tabs { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
    .tabs a { white-space: nowrap; }
    .dl { grid-template-columns: 1fr; gap: .1rem; }
    .dl dd { margin-bottom: .5rem; }
    .flashes { left: 1rem; right: 1rem; width: auto; }
}

.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); }
.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: 0 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 » */
.billing-banner { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; margin-bottom: 1.25rem; border-radius: var(--radius); background: var(--warning-soft); color: #7a3e06; border: 1px solid #f5d9a8; }
.billing-banner > .icon { flex: none; }
.billing-banner p { margin: 0; flex: 1; font-size: .92rem; }
.billing-banner.danger { background: var(--danger-soft); color: #8f1d22; border-color: #f1c4c6; }
@media (max-width: 640px) { .billing-banner { flex-wrap: wrap; } }
.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), 0 16px 32px -16px rgba(79, 70, 229, .45); }
.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; }
