/* ==========================================================================
   EMJL — Formulaires (chargé après emjl-ui.css et emjl-site.css)
   Classes posées par emjl-forms.js : .emjl-f (envoi POST), .emjl-f-get (recherche),
   .is-invalid / .is-valid / .is-restored sur les champs, .is-loading sur le bouton envoyé.
   Les états (erreurs, attente, compteur…) valent partout ; la mise en page « .emjl » vaut
   pour l'espace de gestion et l'espace abonné.
   ========================================================================== */

:root {
    --f-border: #CBD5E1;
    --f-border-hover: #94A3B8;
    --f-bg: #FFFFFF;
    --f-focus: #2563EB;
    --f-ring: rgba(37, 99, 235, .18);
    --f-err: #DC2626;
    --f-err-text: #B91C1C;
    --f-err-bg: #FEF2F2;
    --f-ok: #16A34A;
    --f-warn-bg: #FFFBEB;
    --f-warn: #B45309;
    --f-h: 42px;
    --f-r: 9px;
}

/* ---------------------------------------------------------------- états communs (gestion + site public) */
.is-invalid, .emjl .form-control.is-invalid, .site .is-invalid {
    border-color: var(--f-err) !important;
    background-color: #FFFBFB !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .12) !important;
}
.emjl-field-error {
    display: flex; align-items: flex-start; gap: 6px;
    margin: 6px 0 0; color: var(--f-err-text); font-size: 13px; font-weight: 500; line-height: 1.45;
    animation: emjl-f-in .14s ease-out;
}
.emjl-field-error::before { content: "\f06a"; font-family: FontAwesome; font-size: 13px; line-height: 1.45; flex: none; }
.emjl .emjl-field-error::before { content: "\f06a"; margin: 0; }

.is-restored { background-color: var(--f-warn-bg) !important; border-color: #F59E0B !important; transition: background-color 1.2s ease; }

/* résumé des erreurs en haut du formulaire */
.emjl-form-alert {
    margin: 0 0 16px; padding: 12px 16px; border-radius: var(--f-r);
    background: var(--f-err-bg); border: 1px solid #FECACA; border-inline-start: 4px solid var(--f-err);
    color: #7F1D1D; animation: emjl-f-in .16s ease-out;
}
.emjl-form-alert:focus { outline: none; }
.emjl-form-alert p { margin: 0; font-weight: 600; }
.emjl-form-alert ul { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.emjl-form-alert li { margin: 0; }
.emjl-form-alert li a { display: inline-block; padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, .7); border: 1px solid #FECACA; text-decoration: none !important; font-size: 13px; font-weight: 500; }
.emjl-form-alert li a:hover { background: #fff; border-color: var(--f-err); }
.emjl .box > form > .emjl-form-alert, .emjl .box > form > .emjl-form-note { margin: 16px 18px 4px; }
.emjl-form-alert a { color: #991B1B !important; text-decoration: underline !important; text-underline-offset: 2px; }

/* informations : saisies remises, envoi lent, hors connexion */
.emjl-form-note {
    display: flex; align-items: flex-start; gap: 10px;
    margin: 0 0 16px; padding: 11px 14px; border-radius: var(--f-r); font-size: 14px; line-height: 1.5;
    background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E3A8A; animation: emjl-f-in .16s ease-out;
}
.emjl-form-note::before { font-family: FontAwesome; content: "\f05a"; font-size: 16px; line-height: 1.35; flex: none; }
.emjl-form-note[data-kind="restored"] { background: var(--f-warn-bg); border-color: #FDE68A; color: #78350F; }
.emjl-form-note[data-kind="restored"]::before { content: "\f0e2"; }
.emjl-form-note[data-kind="error"] { background: var(--f-err-bg); border-color: #FECACA; color: #7F1D1D; }
.emjl-form-note[data-kind="error"]::before { content: "\f1eb"; }

/* bouton en cours d'envoi */
.is-locked { pointer-events: none; }
.is-loading { cursor: progress !important; opacity: .88; }
.emjl-spin {
    display: inline-block; width: 14px; height: 14px; vertical-align: -2px;
    border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%;
    animation: emjl-f-spin .7s linear infinite;
}

/* compteur de caractères */
.emjl-counter { display: block; margin-top: 4px; font-size: 12px; color: #64748B; text-align: end; font-variant-numeric: tabular-nums; }
.emjl-counter.is-low { color: var(--f-warn); font-weight: 600; }
.emjl-counter[hidden] { display: none; }

/* mot de passe : bouton afficher / masquer */
.emjl-pw { position: relative; display: block; }
.emjl-pw > input { padding-inline-end: 44px !important; width: 100%; }
.emjl-pw-toggle {
    position: absolute; inset-block: 0; inset-inline-end: 2px; width: 40px; margin: 0; padding: 0;
    display: grid; place-items: center; border: 0 !important; background: transparent !important; color: #64748B !important;
    border-radius: var(--f-r); cursor: pointer;
}
.emjl-pw-toggle:hover { color: var(--f-focus) !important; }
.emjl-pw-toggle:focus-visible { outline: 2px solid var(--f-focus); outline-offset: -4px; }

/* modifications non enregistrées */
.emjl-dirty {
    display: inline-flex; align-items: center; gap: 10px; margin-inline-start: 12px; align-self: center;
    font-size: 13px; color: var(--f-warn); font-weight: 600;
}
.emjl-dirty[hidden] { display: none; }
.emjl-dirty > span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #F59E0B; margin-inline-end: 7px; vertical-align: 1px; box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); }
.emjl-dirty-undo, .emjl .content .emjl-dirty-undo {
    border: 0 !important; background: none !important; padding: 2px 4px !important; margin: 0;
    color: #475569 !important; font-weight: 500 !important; font-size: 13px !important; text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.emjl-dirty-undo:hover { color: var(--f-err-text) !important; }

/* référence d'erreur copiable (messages et journal) */
.emjl-ref, .emjl .content .emjl-ref, .emjl-log-ref, .emjl .content .emjl-log-ref {
    display: inline-flex; align-items: center; gap: 5px; margin: 0 2px; padding: 1px 8px !important;
    border: 1px solid currentColor !important; border-radius: 6px !important; background: rgba(255, 255, 255, .55) !important;
    color: inherit !important; font: 600 12.5px/1.6 ui-monospace, "SFMono-Regular", Consolas, monospace !important; direction: ltr; unicode-bidi: isolate; cursor: copy;
}
.emjl-ref.is-copied, .emjl-log-ref.is-copied { color: var(--f-ok) !important; }
.emjl-ref.is-copied .fa::before, .emjl-log-ref.is-copied .fa::before { content: "\f00c"; }

@keyframes emjl-f-spin { to { transform: rotate(360deg); } }
@keyframes emjl-f-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- espace de gestion : nouvelle mise en forme */
.emjl .emjl-f .form-control,
.emjl .emjl-f .form-control.input-lg,
.emjl .emjl-f-get .form-control {
    height: var(--f-h); padding: 9px 13px; border: 1px solid var(--f-border); border-radius: var(--f-r);
    background-color: var(--f-bg); font-size: 15px; line-height: 1.45;
    transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.emjl .emjl-f .form-control.input-sm, .emjl .emjl-f-get .form-control.input-sm { height: 36px; padding: 6px 11px; font-size: 14px; }
.emjl .emjl-f textarea.form-control { height: auto; min-height: 84px; resize: vertical; }
.emjl .emjl-f .form-control:hover, .emjl .emjl-f-get .form-control:hover { border-color: var(--f-border-hover); }
.emjl .emjl-f .form-control:focus, .emjl .emjl-f-get .form-control:focus { border-color: var(--f-focus); box-shadow: 0 0 0 3px var(--f-ring); outline: none; }
.emjl .emjl-f .form-control[readonly], .emjl .emjl-f .form-control[disabled] { background-color: var(--paper, #F5F7FB); border-style: dashed; color: var(--text-2, #475569); }

/* listes déroulantes : flèche dessinée, du bon côté en arabe */
.emjl .emjl-f select.form-control:not([multiple]):not([size]),
.emjl .emjl-f-get select.form-control:not([multiple]):not([size]) {
    -webkit-appearance: none; appearance: none; padding-inline-end: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2364748B' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 13px center; background-size: 12px 8px;
}
.emjl-rtl .emjl-f select.form-control:not([multiple]):not([size]),
.emjl-rtl .emjl-f-get select.form-control:not([multiple]):not([size]),
[dir="rtl"] .emjl .emjl-f select.form-control:not([multiple]):not([size]) { background-position: left 13px center; }

/* champ validé : coche discrète (pas sur les listes, qui ont déjà leur flèche) */
.emjl .emjl-f input.form-control.is-valid:not([type="date"]):not(.emjl-date) {
    padding-inline-end: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M2.5 7.5l3 3 6-7' fill='none' stroke='%2316A34A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 14px;
}
.emjl-rtl .emjl-f input.form-control.is-valid:not([type="date"]):not(.emjl-date) { background-position: left 12px center; }

/* libellés : le champ actif se repère à son libellé */
.emjl .emjl-f .emjl-label, .emjl .emjl-f .form-group > label { font-size: 13px; font-weight: 600; color: var(--text-2, #475569); margin-bottom: 6px; transition: color .12s ease; }
.emjl .emjl-f [class*="col-"]:focus-within > .emjl-label,
.emjl .emjl-f .form-group:focus-within > label { color: var(--f-focus); }
.emjl .emjl-f [class*="col-"]:has(> .is-invalid) > .emjl-label { color: var(--f-err-text); }
.emjl .emjl-f .emjl-req { color: var(--f-err); font-weight: 700; }

/* cases à cocher et boutons radio */
.emjl .emjl-f input[type="checkbox"], .emjl .emjl-f input[type="radio"] { width: 18px; height: 18px; accent-color: var(--f-focus); cursor: pointer; vertical-align: -4px; }
.emjl .emjl-f label:has(> input[type="checkbox"]), .emjl .emjl-f label:has(> input[type="radio"]) { cursor: pointer; }

/* sections des longs formulaires : feuillets séparés, une couleur par section */
.emjl .emjl-f fieldset, .emjl .emjl-f fieldset.loc {
    margin: 0 0 18px; padding: 6px 18px 4px; min-width: 0;
    border: 1px solid var(--rule, #E3E8F0) !important; border-radius: 12px; background: var(--surface, #fff);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04); font-family: inherit;
}
.emjl .emjl-f fieldset > legend, .emjl .emjl-f fieldset legend {
    float: none; width: auto; margin: 0 0 10px; padding: 12px 0 10px; border: 0; border-bottom: 1px solid var(--rule-soft, #EDF1F7);
    display: block; width: 100%; font-size: 15px; font-weight: 700; color: var(--ink, #0F172A); letter-spacing: 0;
}
.emjl .emjl-f fieldset legend::before {
    content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 10px; vertical-align: 0;
    background: var(--c1, #2563EB);
}
.emjl .emjl-f fieldset:nth-of-type(5n+2) legend::before { background: var(--c2, #059669); }
.emjl .emjl-f fieldset:nth-of-type(5n+3) legend::before { background: var(--c3, #D97706); }
.emjl .emjl-f fieldset:nth-of-type(5n+4) legend::before { background: var(--c4, #7C3AED); }
.emjl .emjl-f fieldset:nth-of-type(5n+5) legend::before { background: var(--c5, #E11D48); }
.emjl .emjl-f fieldset legend a { font-size: 13px; font-weight: 500; margin-inline-start: 6px; }
.emjl .emjl-f fieldset:focus-within { border-color: #BFD3FB !important; box-shadow: 0 0 0 3px rgba(37, 99, 235, .06); }

/* pied du formulaire : actions séparées du contenu */
.emjl .emjl-f .emjl-actions {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--rule-soft, #EDF1F7);
}
.emjl .emjl-f .emjl-submit, .emjl .emjl-f-get .emjl-submit {
    min-height: var(--f-h); padding: 9px 20px; border-radius: var(--f-r); font-size: 15px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: background-color .12s ease, box-shadow .12s ease, transform .06s ease;
}
.emjl .emjl-f .btn-primary.emjl-submit, .emjl .emjl-f .btn-success.emjl-submit, .emjl .emjl-f .btn-info.emjl-submit {
    background: var(--blue, #2563EB); border-color: var(--blue, #2563EB); color: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.emjl .emjl-f .btn-primary.emjl-submit:hover, .emjl .emjl-f .btn-success.emjl-submit:hover, .emjl .emjl-f .btn-info.emjl-submit:hover { background: var(--blue-hover, #1D4ED8); border-color: var(--blue-hover, #1D4ED8); }
.emjl .emjl-f .emjl-submit:active { transform: translateY(1px); }
.emjl .emjl-f .emjl-submit:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--f-ring); }
.emjl .emjl-f .btn-danger.emjl-submit { background: #fff; color: var(--f-err-text); border-color: #FCA5A5; }
.emjl .emjl-f .btn-danger.emjl-submit:hover { background: var(--f-err-bg); }
.emjl .emjl-savebar { align-items: center; }
.emjl .emjl-savebar .emjl-dirty { order: -1; margin-inline: 0 auto; }

/* recherche : bandeau compact */
.emjl form.emjl-form-search.emjl-f, .emjl form.emjl-form-search.emjl-f-get { border-radius: 12px; }

/* fichiers : zone de dépôt plus nette */
.emjl .emjl-f .emjl-file { min-height: 64px; border-radius: 12px; }
.emjl .emjl-f .emjl-file:has(.is-invalid) { border-color: var(--f-err); background: var(--f-err-bg); color: var(--f-err-text); }

/* ---------------------------------------------------------------- site public */
.site .emjl-f input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):hover,
.site .emjl-f textarea:hover, .site .emjl-f select:hover { border-color: var(--f-border-hover); }
.site .emjl-f [class*="form-field"]:focus-within > span { color: var(--f-focus); }
.site .emjl-f .site-btn.is-loading { opacity: .9; }

/* ---------------------------------------------------------------- Administration > Journal des erreurs */
.emjl-log-intro { max-width: 70ch; margin: 0 0 16px; color: var(--text-2, #475569); }
.emjl-stat.is-alert .emjl-stat-value { color: var(--f-err-text); }
.emjl-log-when { font-size: 20px !important; }
.emjl-log-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.emjl-log-toolbar .emjl-tr-filters { margin-inline-end: 0; }
.emjl-log-toolbar .emjl-tr-q { width: 260px; flex: 0 1 260px; }
@media (max-width: 767px) { .emjl-log-toolbar .emjl-tr-q { flex: 1 1 100%; width: auto; } }
.emjl-log-period { display: inline-flex; border: 1px solid var(--rule, #E3E8F0); border-radius: 9px; overflow: hidden; margin-inline-end: auto; }
.emjl-log-period a { padding: 5px 12px; font-size: 13px; color: var(--text-2, #475569) !important; text-decoration: none !important; }
.emjl-log-period a + a { border-inline-start: 1px solid var(--rule, #E3E8F0); }
.emjl-log-period a[aria-current] { background: var(--ink, #0F172A); color: #fff !important; }
.emjl-log-count { margin: 6px 0 10px; font-size: 13px; color: var(--muted, #64748B); }
.emjl-log-empty { padding: 28px 12px; text-align: center; color: var(--muted, #64748B); }
.emjl-log-empty .fa { color: var(--f-ok); margin-inline-end: 6px; }
.emjl-log-list { list-style: none; margin: 0; padding: 0; }
.emjl-log-item { position: relative; padding: 12px 14px 12px 18px; border-top: 1px solid var(--rule-soft, #EDF1F7); }
.emjl-log-item::before { content: ""; position: absolute; inset-block: 12px; inset-inline-start: 0; width: 3px; border-radius: 3px; background: #CBD5E1; }
.emjl-log-item.is-error::before { background: var(--f-err); }
.emjl-log-item.is-warning::before { background: #F59E0B; }
.emjl-log-item.is-js::before { background: var(--c4, #7C3AED); }
.emjl-rtl .emjl-log-item { padding: 12px 18px 12px 14px; }
.emjl-log-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.emjl-log-head time { font-size: 13px; color: var(--muted, #64748B); font-variant-numeric: tabular-nums; }
.emjl-log-msg { margin: 6px 0 4px; font-weight: 600; color: var(--text, #1E293B); overflow-wrap: anywhere; }
.emjl-log-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; font-size: 12.5px; color: var(--muted, #64748B); }
.emjl-log-meta span { overflow-wrap: anywhere; }
.emjl-log-meta .fa { margin-inline-end: 4px; }
.emjl-log-ref { color: var(--text-2, #475569) !important; }
.emjl-log-details { margin-top: 6px; }
.emjl-log-details summary { cursor: pointer; font-size: 13px; color: var(--blue, #2563EB); width: max-content; }
.emjl-log-details pre {
    margin: 8px 0 0; max-height: 320px; overflow: auto; padding: 12px 14px; border-radius: 9px; border: 0;
    background: #0F172A; color: #E2E8F0; font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; text-align: left;
}

/* ---------------------------------------------------------------- mode sombre */
@media screen {
    html.emjl-dark {
        --f-border: #334155; --f-border-hover: #475569; --f-bg: #0F172A; --f-ring: rgba(59, 130, 246, .3);
        --f-err-bg: rgba(220, 38, 38, .12); --f-err-text: #FCA5A5; --f-warn-bg: rgba(245, 158, 11, .12); --f-warn: #FBBF24;
    }
    html.emjl-dark .is-invalid { background-color: rgba(220, 38, 38, .08) !important; }
    html.emjl-dark .emjl-form-alert { border-color: rgba(248, 113, 113, .35); color: #FECACA; }
    html.emjl-dark .emjl-form-alert a { color: #FECACA !important; }
    html.emjl-dark .emjl-form-alert li a { background: rgba(15, 23, 42, .35); border-color: rgba(248, 113, 113, .35); }
    html.emjl-dark .emjl-form-note { background: rgba(59, 130, 246, .12); border-color: rgba(96, 165, 250, .3); color: #BFDBFE; }
    html.emjl-dark .emjl-form-note[data-kind="restored"] { background: rgba(245, 158, 11, .12); border-color: rgba(251, 191, 36, .3); color: #FDE68A; }
    html.emjl-dark .emjl-form-note[data-kind="error"] { background: rgba(220, 38, 38, .12); border-color: rgba(248, 113, 113, .3); color: #FECACA; }
    html.emjl-dark .emjl .emjl-f select.form-control:not([multiple]):not([size]),
    html.emjl-dark .emjl .emjl-f-get select.form-control:not([multiple]):not([size]) {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2394A3B8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    }
    html.emjl-dark .emjl .emjl-f fieldset, html.emjl-dark .emjl .emjl-f fieldset.loc { background: var(--surface); box-shadow: none; }
    html.emjl-dark .emjl .emjl-f fieldset:focus-within { border-color: #1E40AF !important; }
    html.emjl-dark .emjl-dirty-undo { color: #CBD5E1 !important; }
    html.emjl-dark .emjl-ref { background: rgba(15, 23, 42, .4) !important; }
    html.emjl-dark .emjl-log-period a[aria-current] { background: #E2E8F0; color: #0F172A !important; }
    html.emjl-dark .emjl-log-details pre { background: #020617; }
}

@media (max-width: 767px) {
    .emjl .emjl-f .emjl-actions { flex-direction: column; align-items: stretch; }
    .emjl-dirty { margin: 4px 0 0; justify-content: space-between; }
    .emjl-log-period { margin-inline-end: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .emjl-field-error, .emjl-form-alert, .emjl-form-note { animation: none; }
    .emjl-spin { animation-duration: 1.6s; }
}

@media print {
    .emjl-form-alert, .emjl-form-note, .emjl-dirty, .emjl-counter, .emjl-pw-toggle { display: none !important; }
}

/* ---------------------------------------------------------------- grille régulière et barre d'actions (gestion) */
@media (min-width: 768px) {
    .emjl .emjl-fgrid { display: grid !important; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 20px; row-gap: 2px; align-items: start; }
    .emjl .emjl-fgrid::before, .emjl .emjl-fgrid::after { display: none !important; }
    .emjl .emjl-fgrid { float: none !important; width: 100% !important; clear: both; }
    .emjl .emjl-fgrid > .emjl-fcell { float: none !important; width: auto !important; padding: 0 !important; grid-column: span var(--span, 12); min-width: 0; }
    .emjl .emjl-fgrid > .emjl-fwide { grid-column: 1 / -1; float: none !important; width: auto !important; }
    .emjl .emjl-fgrid > br { display: none; }
}
.emjl .emjl-fgrid > .emjl-fcell { margin-bottom: 16px; }

.emjl form.emjl-f-card .emjl-f-foot {
    display: flex !important; flex-wrap: wrap; align-items: center; gap: 10px 12px;
    float: none !important; width: auto !important; clear: both;
    margin: 12px 0 0 !important; padding: 14px 16px !important;
    background: var(--head, #F8FAFC); border: 1px solid var(--rule-soft, #EDF1F7); border-radius: 12px;
}
.emjl form.emjl-f-card .emjl-f-foot .emjl-submit { margin: 0 !important; }
.emjl .emjl-req-note { margin: 0 0 0 auto; font-size: 12.5px; color: var(--muted, #64748B); }
.emjl-rtl .emjl-req-note { margin: 0 auto 0 0; }
.emjl .emjl-f-foot .emjl-dirty { margin-inline-start: 4px; }
.emjl .emjl-savebar-origin.emjl-f-foot { display: none !important; }
@media (max-width: 767px) {
    .emjl form.emjl-f-card .emjl-f-foot { flex-direction: column; align-items: stretch; }
    .emjl .emjl-req-note { margin: 0; text-align: center; }
}
html.emjl-dark .emjl form.emjl-f-card .emjl-f-foot { background: var(--head); border-color: var(--rule); }
.emjl .emjl-fcell > br, .emjl .emjl-fgrid > .emjl-fcell > br { display: none; }

/* ==========================================================================
   Administration > Modules : registre des fonctions du site
   ========================================================================== */
.emjl-mods-head { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; align-items: start; margin-bottom: 8px; }
.emjl-mods-intro { margin: 0; max-width: 68ch; font-size: 15px; line-height: 1.65; color: var(--text-2, #475569); }
.emjl-mods-tally { padding: 16px 18px; border: 1px solid var(--rule, #E3E8F0); border-radius: 12px; background: var(--surface, #fff); }
.emjl-mods-count { margin: 0; display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.emjl-mods-count strong { font-size: 34px; line-height: 1; font-weight: 700; color: var(--ink, #0F172A); }
.emjl-mods-count span { font-size: 17px; color: var(--muted, #64748B); }
.emjl-mods-count-label { margin: 4px 0 10px; font-size: 13px; color: var(--muted, #64748B); }
.emjl-mods-tally .emjl-meter { margin-bottom: 12px; }
.emjl-mods-tally form { margin: 0; }
.emjl-mods-core { margin: 4px 0 22px; font-size: 13px; color: var(--muted, #64748B); }
.emjl-mods-core .fa { margin-inline-end: 6px; }

.emjl-mods-group { margin: 0 0 26px; }
.emjl-mods-group > h2 {
    display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 16px; font-weight: 700; color: var(--ink, #0F172A);
}
.emjl-mods-group > h2::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--g); }
.emjl-mods-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule, #E3E8F0); border-radius: 12px; background: var(--surface, #fff); overflow: hidden; }
.emjl-mod { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 16px 18px; scroll-margin-top: 80px; }
.emjl-mod + .emjl-mod { border-top: 1px solid var(--rule-soft, #EDF1F7); }
.emjl-mod:target { box-shadow: inset 3px 0 0 var(--g); background: var(--head, #F8FAFC); }
.emjl-rtl .emjl-mod:target { box-shadow: inset -3px 0 0 var(--g); }
.emjl-mod-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 17px;
    color: var(--g); background: color-mix(in srgb, var(--g) 12%, transparent); }
.emjl-mod-text h3 { margin: 1px 0 3px; font-size: 15px; font-weight: 600; color: var(--ink, #0F172A); }
.emjl-mod-text p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-2, #475569); }
.emjl-mod-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px !important; font-size: 12.5px !important; color: var(--muted, #64748B) !important; }
.emjl-mod-meta .fa { margin-inline-end: 4px; }
.emjl-mod-note { margin-top: 8px !important; padding: 6px 10px; border-radius: 8px; background: var(--paper, #F5F7FB); font-size: 12.5px !important; width: fit-content; }
.emjl-mod.is-off .emjl-mod-icon { color: var(--muted, #94A3B8); background: var(--paper, #F1F5F9); }
.emjl-mod.is-off h3 { color: var(--text-2, #475569); }
.emjl-mod-form { margin: 0; align-self: center; }

/* interrupteur : un vrai bouton, l'état écrit à côté */
.emjl .content .emjl-switch, .emjl-switch {
    display: inline-flex; align-items: center; gap: 10px; min-height: 36px; padding: 4px 6px !important; margin: 0;
    border: 0 !important; background: transparent !important; color: var(--text-2, #475569) !important; cursor: pointer; border-radius: 10px !important; box-shadow: none !important;
}
.emjl-switch:focus-visible { outline: 2px solid var(--f-focus); outline-offset: 2px; }
.emjl-switch-track { position: relative; width: 42px; height: 24px; border-radius: 999px; background: #CBD5E1; transition: background-color .15s ease; flex: none; }
.emjl-switch-thumb { position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .25); transition: inset-inline-start .15s ease; }
.emjl-switch[aria-checked="true"] .emjl-switch-track { background: var(--c2, #059669); }
.emjl-switch[aria-checked="true"] .emjl-switch-thumb { inset-inline-start: 21px; }
.emjl-switch-label { min-width: 64px; font-size: 13px; font-weight: 600; text-align: start; }
.emjl-switch[aria-checked="true"] .emjl-switch-label { color: var(--c2, #059669); }
.emjl-switch.is-loading .emjl-switch-track { opacity: .6; }

/* lien de menu d'un module désactivé (visible des administrateurs seulement) */
.emjl .main-sidebar a.emjl-mod-off { opacity: .8; } .emjl .main-sidebar a.emjl-mod-off span { text-decoration: line-through; text-decoration-thickness: 1px; }
.emjl .main-sidebar a.emjl-mod-off::after { content: "\f070"; font-family: FontAwesome; margin-inline-start: 6px; font-size: 11px; opacity: .8; }

/* bandeau : page d'un module désactivé consultée par un administrateur */
.emjl-mod-banner {
    position: fixed; z-index: 1040; inset-inline: 0; bottom: 16px; margin-inline: auto; width: max-content; max-width: calc(100vw - 32px);
    display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 12px;
    background: #1E293B; color: #E2E8F0; font-size: 13.5px; box-shadow: 0 8px 24px rgba(15, 23, 42, .25);
}
.emjl-mod-banner a { color: #93C5FD !important; font-weight: 600; white-space: nowrap; }

@media (max-width: 767px) {
    .emjl-mods-head { grid-template-columns: 1fr; }
    .emjl-mod { grid-template-columns: 36px minmax(0, 1fr); }
    .emjl-mod-form { grid-column: 2; }
    .emjl-mod-banner { bottom: 76px; flex-wrap: wrap; }
}
html.emjl-dark .emjl-switch-track { background: #475569; }
html.emjl-dark .emjl-mod-note { background: rgba(148, 163, 184, .1); }
html.emjl-dark .emjl-mod:target { background: rgba(148, 163, 184, .06); }

/* ==========================================================================
   Formulaires en plusieurs étapes
   ========================================================================== */
.emjl-step-off, .emjl .emjl-f .emjl-step-off, .emjl .emjl-fgrid.emjl-step-off { display: none !important; }
.emjl-steps { grid-column: 1 / -1; position: relative; margin: 4px 0 20px; padding-bottom: 14px; border-bottom: 1px solid var(--rule-soft, #EDF1F7); }
.emjl-steps ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; counter-reset: none; overflow-x: auto; scrollbar-width: thin; }
.emjl-steps li { flex: 1 1 0; min-width: 120px; position: relative; }
/* trait de liaison entre les étapes : la progression se lit de gauche à droite (de droite à gauche en arabe) */
.emjl-steps li + li::before {
    content: ""; position: absolute; top: 15px; inset-inline-start: -6px; width: 6px; height: 2px; background: var(--rule, #E3E8F0);
}
.emjl .content .emjl-step, .emjl-step {
    width: 100%; display: flex; align-items: center; gap: 10px; margin: 0; padding: 0 8px 0 0 !important;
    border: 0 !important; background: transparent !important; box-shadow: none !important; text-align: start; cursor: pointer;
    color: var(--muted, #64748B) !important; font-size: 13.5px; font-weight: 500; line-height: 1.3; border-radius: 8px !important;
}
.emjl-rtl .emjl-step { padding: 0 0 0 8px !important; }
.emjl-rtl .emjl-steps-all { margin: 10px auto 0 0; }
.emjl-step-n {
    flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
    border: 2px solid var(--rule, #E3E8F0); background: var(--surface, #fff); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.emjl-step-t { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.emjl-step:hover .emjl-step-n { border-color: var(--f-border-hover); }
.emjl-step:focus-visible { outline: 2px solid var(--f-focus); outline-offset: 2px; }
.emjl-step[aria-current="step"] { color: var(--ink, #0F172A) !important; font-weight: 600; }
.emjl-step[aria-current="step"] .emjl-step-n { background: var(--f-focus); border-color: var(--f-focus); color: #fff; box-shadow: 0 0 0 4px var(--f-ring); }
.emjl-step.is-done { color: var(--text-2, #475569) !important; }
.emjl-step.is-done .emjl-step-n { border-color: var(--c2, #059669); color: var(--c2, #059669); font-size: 0; }
.emjl-step.is-done .emjl-step-n::before { content: "\f00c"; font-family: FontAwesome; font-size: 13px; }
.emjl-step.has-error .emjl-step-n { border-color: var(--f-err); color: var(--f-err); font-size: 0; }
.emjl-step.has-error .emjl-step-n::before { content: "!"; font-size: 15px; font-weight: 800; font-family: inherit; }
.emjl-step.has-error[aria-current="step"] .emjl-step-n { background: var(--f-err); color: #fff; box-shadow: 0 0 0 4px rgba(220, 38, 38, .15); }
.emjl-steps-compact { display: none; margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--ink, #0F172A); }
.emjl-steps-bar { display: none; height: 4px; border-radius: 4px; background: var(--rule-soft, #EDF1F7); overflow: hidden; }
.emjl-steps-bar span { display: block; height: 100%; background: var(--f-focus); transition: width .2s ease; }
.emjl .content .emjl-steps-all, .emjl-steps-all {
    display: block; margin: 10px 0 0 auto; padding: 2px 4px !important; border: 0 !important; background: none !important;
    color: var(--blue, #2563EB) !important; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; box-shadow: none !important;
}
.emjl-steps.is-all .emjl-step { opacity: .55; }
form.emjl-stepped .emjl-f-foot .emjl-step-prev { order: -2; }
form.emjl-stepped .emjl-f-foot .emjl-step-next { order: -1; }
.emjl .emjl-f .emjl-step-prev { min-height: var(--f-h); border-radius: var(--f-r); padding: 9px 16px; }
.emjl .emjl-f .emjl-step-next .fa, .emjl .emjl-f .emjl-step-prev .fa { font-size: 16px; }
/* la première section d'une étape n'a pas besoin de la marge du haut */
form.emjl-stepped fieldset:not(.emjl-step-off) { margin-top: 0; }

@media (max-width: 767px) {
    .emjl-steps ol { display: none; }
    .emjl-steps-compact, .emjl-steps-bar { display: block; }
    .emjl-steps-all { margin-top: 8px; }
}
html.emjl-dark .emjl-step-n { background: var(--surface); border-color: #334155; }
@media print {
    .emjl-step-off { display: block !important; }
    .emjl-steps, .emjl-step-prev, .emjl-step-next { display: none !important; }
}
.emjl-step-prev[hidden], .emjl-step-next[hidden], .emjl .emjl-f .emjl-step-prev[hidden], .emjl .emjl-f .emjl-step-next[hidden] { display: none !important; }

/* ==========================================================================
   Journal des modifications et corbeille
   ========================================================================== */
.emjl-audit-filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 10px 12px; align-items: end; margin-bottom: 10px; }
.emjl-audit-filters label { margin: 0; display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-2, #475569); }
.emjl-audit-filter-actions { display: flex; gap: 8px; }
.emjl-audit-list, .emjl-trash-list { list-style: none; margin: 0; padding: 0; }
.emjl-audit-item { padding: 12px 4px; border-top: 1px solid var(--rule-soft, #EDF1F7); }
.emjl-audit-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.emjl-audit-head strong { color: var(--ink, #0F172A); font-weight: 600; }
.emjl-audit-dossier { font-size: 13px; }
.emjl-audit-meta { margin-inline-start: auto; display: inline-flex; gap: 10px; font-size: 12.5px; color: var(--muted, #64748B); }
.emjl-audit-details { margin-top: 8px; }
.emjl-audit-details summary { cursor: pointer; font-size: 13px; color: var(--blue, #2563EB); width: max-content; }
.emjl-audit-diff { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.emjl-audit-diff th, .emjl-audit-diff td { padding: 6px 10px; border: 1px solid var(--rule-soft, #EDF1F7); text-align: start; vertical-align: top; overflow-wrap: anywhere; }
.emjl-audit-diff thead th { background: var(--head, #F8FAFC); font-weight: 600; color: var(--text-2, #475569); }
.emjl-audit-diff tbody th { width: 22%; font-weight: 500; color: var(--muted, #64748B); font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.emjl-audit-diff td.is-old { background: #FEF2F2; color: #7F1D1D; text-decoration: line-through; text-decoration-color: rgba(185, 28, 28, .35); }
.emjl-audit-diff td.is-new { background: #F0FDF4; color: #14532D; }
.emjl-badge.is-wait { background: #FEF3C7; color: #92400E; }
.emjl-trash-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.emjl-trash-bar form { margin: 0; }
.emjl .content .emjl-danger-link { color: var(--f-err-text) !important; }
.emjl-trash-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 14px 4px; border-top: 1px solid var(--rule-soft, #EDF1F7); }
.emjl-trash-kind { margin: 0; font-size: 12.5px; color: var(--muted, #64748B); }
.emjl-trash-text h3 { margin: 2px 0 4px; font-size: 15px; font-weight: 600; color: var(--ink, #0F172A); overflow-wrap: anywhere; }
.emjl-trash-meta { margin: 0; font-size: 12.5px; color: var(--muted, #64748B); }
.emjl-trash-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.emjl-trash-actions form { margin: 0; }
@media (max-width: 991px) { .emjl-audit-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .emjl-audit-meta { margin-inline-start: 0; width: 100%; } }
@media (max-width: 767px) { .emjl-trash-item { grid-template-columns: 1fr; } .emjl-trash-actions { flex-direction: row; align-items: center; } }
html.emjl-dark .emjl-audit-diff td.is-old { background: rgba(220, 38, 38, .12); color: #FECACA; }
html.emjl-dark .emjl-audit-diff td.is-new { background: rgba(22, 163, 74, .12); color: #BBF7D0; }
html.emjl-dark .emjl-badge.is-wait { background: rgba(245, 158, 11, .15); color: #FCD34D; }

/* ==========================================================================
   Permissions par rôle
   ========================================================================== */
.emjl-perms-legend { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--text-2, #475569); }
.emjl-perms-legend li::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 8px; vertical-align: 0; }
[data-level="write"] { --lv: var(--c2, #059669); --lv-bg: rgba(5, 150, 105, .08); }
[data-level="read"] { --lv: var(--c3, #D97706); --lv-bg: rgba(217, 119, 6, .09); }
[data-level="none"] { --lv: #94A3B8; --lv-bg: rgba(148, 163, 184, .14); }
.emjl-perms-legend li::before { background: var(--lv); }
.emjl-perms-scroll { overflow-x: auto; }
.emjl-perms-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; min-width: 760px; }
.emjl-perms-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface, #fff); padding: 10px 8px; border-bottom: 2px solid var(--rule, #E3E8F0); font-weight: 600; text-align: center; color: var(--ink, #0F172A); }
.emjl-perms-table thead th:first-child { text-align: start; }
.emjl-perms-table tbody th { padding: 8px; text-align: start; font-weight: 500; color: var(--ink, #0F172A); white-space: nowrap; }
.emjl-perms-table tbody th .fa { width: 18px; color: var(--g); margin-inline-end: 6px; }
.emjl-perms-table td { padding: 5px 6px; text-align: center; border-bottom: 1px solid var(--rule-soft, #EDF1F7); }
.emjl-perms-table tbody tr:not(.emjl-perms-group):hover { background: var(--head, #F8FAFC); }
.emjl-perms-group th { padding: 18px 8px 6px !important; font-size: 13px !important; font-weight: 700 !important; color: color-mix(in srgb, var(--g) 78%, #000) !important; border-bottom: 1px solid var(--rule, #E3E8F0); }
.emjl .content .emjl-perm-select, .emjl-perm-select {
    width: 100%; min-width: 112px; height: 34px; padding: 4px 26px 4px 10px; border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--lv) 45%, transparent); background-color: var(--lv-bg); color: var(--ink, #0F172A);
    font-size: 13px; font-weight: 600; cursor: pointer;
}
.emjl-perm-select:focus { outline: none; box-shadow: 0 0 0 3px var(--f-ring); border-color: var(--f-focus); }
.emjl-perms-actions { margin-top: 16px; }
.emjl-mod-banner.is-readonly { background: #78350F; }
form.is-readonly .form-control[disabled] { background-color: var(--paper, #F5F7FB); cursor: not-allowed; }
html.emjl-dark .emjl-perms-table thead th { background: var(--surface); }
.emjl-ro-hide, .emjl .emjl-f .emjl-ro-hide, form.is-readonly .emjl-f-foot, form.is-readonly .emjl-savebar, form.is-readonly .emjl-dirty { display: none !important; }

/* ==========================================================================
   Sécurité du compte (double authentification)
   ========================================================================== */
.emjl-user-link a { display: flex; align-items: center; gap: 8px; padding: 10px 16px; color: var(--text, #1E293B) !important; }
.emjl-user-link a:hover { background: var(--head, #F8FAFC); }
.emjl-sec-status { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.emjl-sec-status h2 { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--ink, #0F172A); }
.emjl-sec-status p { margin: 0 0 4px; color: var(--text-2, #475569); max-width: 62ch; }
.emjl-sec-shield { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; }
.emjl-sec-status.is-on .emjl-sec-shield { background: rgba(5, 150, 105, .12); color: var(--c2, #059669); }
.emjl-sec-status.is-off .emjl-sec-shield { background: rgba(217, 119, 6, .12); color: var(--c3, #D97706); }
.emjl-sec-status form { margin: 0; }
.emjl-sec-required { color: var(--f-warn) !important; font-weight: 600; }
/* les trois étapes sont une vraie séquence : numérotées */
.emjl-sec-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.emjl-sec-steps > li { counter-increment: step; position: relative; padding: 4px 0 22px; padding-inline-start: 52px; }
.emjl-sec-steps > li::before { content: counter(step); position: absolute; inset-inline-start: 0; top: 0; width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 700; background: var(--f-focus); color: #fff; }
.emjl-sec-steps > li:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: 16px; top: 38px; bottom: 4px; width: 2px; background: var(--rule, #E3E8F0); }
.emjl-sec-steps h3 { margin: 5px 0 6px; font-size: 15.5px; font-weight: 600; color: var(--ink, #0F172A); }
.emjl-sec-steps p { margin: 0 0 8px; color: var(--text-2, #475569); }
.emjl-sec-qr { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; align-items: center; }
.emjl-sec-qrbox { width: 180px; height: 180px; padding: 8px; background: #fff; border: 1px solid var(--rule, #E3E8F0); border-radius: 12px; }
.emjl-sec-qrbox svg { width: 100%; height: 100%; display: block; }
.emjl-sec-secret code { font-size: 15px; letter-spacing: .06em; padding: 6px 10px; border-radius: 8px; background: var(--paper, #F5F7FB); color: var(--ink, #0F172A); }
.emjl-sec-confirm { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0; }
.emjl .content .emjl-2fa-code, .emjl-2fa-code { max-width: 180px; height: 46px !important; font-size: 22px !important; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.emjl-sec-h { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.emjl-sec-codes { border-inline-start: 4px solid var(--c3, #D97706); }
.emjl-sec-codes h2 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.emjl-sec-codelist { columns: 2; list-style: none; margin: 12px 0; padding: 0; max-width: 360px; }
.emjl-sec-codelist code { display: inline-block; margin: 3px 0; font-size: 15px; padding: 4px 10px; border-radius: 6px; background: var(--paper, #F5F7FB); color: var(--ink, #0F172A); }
.emjl-sec-codes-actions { display: flex; gap: 8px; }
.emjl-sec-required-form { margin: 0 0 6px; }
.emjl-sec-required-form .emjl-switch-label { min-width: 0; }
.emjl-sec-users { list-style: none; margin: 0; padding: 0; }
.emjl-sec-users li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--rule-soft, #EDF1F7); }
.emjl-sec-users form { margin: 0; }
.emjl-sec-users .fa-shield { color: var(--c2, #059669); margin-inline-end: 6px; }
.emjl-2fa-card { text-align: center; }
.emjl-2fa-icon { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center; font-size: 30px; background: rgba(37, 99, 235, .1); color: var(--f-focus); }
.emjl-2fa-card .emjl-2fa-code { margin: 0 auto; max-width: 220px; }
.emjl-2fa-label { display: block; margin-bottom: 8px; }
.emjl-2fa-recovery { margin-top: 16px; text-align: start; font-size: 14px; }
.emjl-2fa-recovery summary { cursor: pointer; color: var(--blue, #2563EB); }
@media (max-width: 767px) {
    .emjl-sec-status { grid-template-columns: 48px minmax(0, 1fr); }
    .emjl-sec-status form { grid-column: 1 / -1; }
    .emjl-sec-qr { grid-template-columns: 1fr; }
}
@media print {
    body.emjl:has(.emjl-sec-codes) * { visibility: hidden; }
    .emjl-sec-codes, .emjl-sec-codes * { visibility: visible; }
    .emjl-sec-codes { position: absolute; inset: 0; }
    .emjl-sec-codes-actions { display: none; }
}

/* Notifications e-mail */
.emjl-notif-events { display: grid; gap: 10px; }
.emjl-notif-events .btn { justify-self: start; margin-top: 6px; }
.emjl-check { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 500; cursor: pointer; }
.emjl-check input { width: 18px; height: 18px; accent-color: var(--f-focus); margin: 0; }
.emjl-notif-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.emjl-notif-actions form { margin: 0; }
.emjl-notif-actions p { width: 100%; margin: 10px 0 4px; }
.emjl-cron { width: 100%; margin: 0; padding: 10px 12px; border-radius: 8px; border: 0; background: #0F172A; color: #E2E8F0; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; }
.emjl-notif-list { list-style: none; margin: 0; padding: 0; }
.emjl-notif-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 9px 0; border-top: 1px solid var(--rule-soft, #EDF1F7); font-size: 13px; }
.emjl-notif-to { font-weight: 600; color: var(--ink, #0F172A); }
.emjl-notif-list time { margin-inline-start: auto; }
.emjl-notif-pref .emjl-switch-label { min-width: 0; font-weight: 500; }

/* --- Rendez-vous en ligne (bureau et espace abonné) ---------------------- */
.emjl .rdv-form { display: grid; gap: 16px; }
.emjl .rdv-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.emjl .rdv-form .form-field { display: grid; gap: 5px; margin: 0; }
.emjl .rdv-form .form-field > span, .emjl .rdv-slots legend { font-weight: 600; font-size: 14px; color: var(--text); border: 0; margin: 0 0 4px; padding: 0; width: auto; }
.emjl .rdv-form em { font-style: normal; font-weight: 400; color: var(--text-3, #64748B); font-size: 12.5px; }
.emjl .rdv-form input:not([type="radio"]), .emjl .rdv-form textarea { width: 100%; padding: 8px 11px; border: 1px solid var(--line, #CBD5E1); border-radius: 8px; background: var(--surface, #fff); color: var(--text); font: inherit; }
.emjl .rdv-form .form-hint { color: var(--text-3, #64748B); font-size: 12.5px; }
.emjl .rdv-form .form-error { color: #B91C1C; font-size: 13px; }
.emjl .rdv-slots { border: 0; margin: 0; padding: 0; min-width: 0; }
.emjl .rdv-slot { display: inline-flex; align-items: center; gap: 7px; margin-inline-end: 6px; padding: 7px 12px; border: 1px solid var(--line, #CBD5E1); border-radius: 8px; cursor: pointer; font-weight: 500; }
.emjl .rdv-slot:has(input:checked) { border-color: var(--c1, #2563EB); background: rgba(37, 99, 235, .08); }
.emjl .rdv-mine { list-style: none; margin: 0; padding: 0; }
.emjl .rdv-mine li { padding: 12px 0; border-bottom: 1px solid var(--line, #E3E8F0); display: grid; gap: 4px; justify-items: start; }
.emjl .rdv-mine li:last-child { border-bottom: 0; }
.emjl .rdv-mine p { margin: 0; color: var(--text-2, #475569); }
.emjl .rdv-reply { margin: 6px 0 0; padding: 8px 12px; border-inline-start: 3px solid var(--c1, #2563EB); background: var(--hover, #F5F7FB); border-radius: 0 6px 6px 0; }
.emjl .rdv-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.emjl .rdv-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line, #E3E8F0); color: var(--text-2, #475569); text-decoration: none; font-weight: 600; }
.emjl .rdv-tabs a.is-current { background: var(--c1, #2563EB); border-color: var(--c1, #2563EB); color: #fff; }
.emjl .rdv-count { font-variant-numeric: tabular-nums; opacity: .8; }
.emjl .rdv-list { display: grid; gap: 14px; }
.emjl .rdv-item { margin: 0; }
.emjl .rdv-item-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; }
.emjl .rdv-name { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.emjl .rdv-contact { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; color: var(--text-2, #475569); }
.emjl .rdv-when { display: grid; justify-items: end; gap: 2px; text-align: end; }
.emjl .rdv-when strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.emjl .rdv-motif { margin: 12px 0 4px; white-space: normal; }
.emjl .rdv-meta { font-size: 12.5px; margin: 0; }
.emjl .rdv-answer { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line, #E3E8F0); display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: end; }
.emjl .rdv-answer-when { display: flex; gap: 10px; }
.emjl .rdv-answer label { display: grid; gap: 4px; margin: 0; font-size: 13px; font-weight: 600; }
.emjl .rdv-answer input, .emjl .rdv-answer textarea { padding: 6px 9px; border: 1px solid var(--line, #CBD5E1); border-radius: 7px; background: var(--surface, #fff); color: var(--text); font: inherit; font-weight: 400; }
.emjl .rdv-answer-text textarea { width: 100%; resize: vertical; }
.emjl .rdv-answer-btns { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.emjl .rdv-del { margin-top: 6px; text-align: end; }
@media (max-width: 720px) { .emjl .rdv-form .form-row, .emjl .rdv-answer { grid-template-columns: 1fr; } .emjl .rdv-when { justify-items: start; text-align: start; } }

/* --- Exports et rapport financier ------------------------------------------ */
.emjl .emjl-page-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 10px 15px 0; }
.emjl .emjl-export-sets { border: 0; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.emjl .emjl-export-sets legend, .emjl .emjl-export-formats legend { font-size: 14px; font-weight: 600; border: 0; margin: 0 0 8px; color: var(--text); grid-column: 1 / -1; }
.emjl .emjl-export-set { display: grid; grid-template-columns: auto auto 1fr; align-items: start; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid var(--line, #E3E8F0); border-radius: 10px; cursor: pointer; font-weight: 400; }
.emjl .emjl-export-set:has(input:checked) { border-color: var(--c1, #2563EB); background: rgba(37, 99, 235, .06); }
.emjl .emjl-export-set .fa { font-size: 18px; color: var(--c1, #2563EB); margin-top: 1px; }
.emjl .emjl-export-set span { display: grid; gap: 2px; }
.emjl .emjl-export-set small { color: var(--text-3, #64748B); }
.emjl .emjl-export-filters, .emjl .emjl-report-form .box-body { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.emjl .emjl-export-filters label, .emjl .emjl-report-form label { display: grid; gap: 4px; margin: 0; font-size: 13px; font-weight: 600; }
.emjl .emjl-export-filters select, .emjl .emjl-report-form select { min-width: 260px; }
.emjl .emjl-export-filters select, .emjl .emjl-export-filters input, .emjl .emjl-report-form select, .emjl .emjl-report-form input { padding: 6px 9px; border: 1px solid var(--line, #CBD5E1); border-radius: 7px; background: var(--surface, #fff); color: var(--text); font: inherit; font-weight: 400; height: 36px; }
.emjl .emjl-export-formats { border: 0; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.emjl .emjl-export-formats legend { width: 100%; }
.emjl .emjl-export-formats label { font-weight: 500; margin: 0; }
.emjl .emjl-export .box-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.emjl .emjl-report-actions { display: inline-flex; gap: 8px; margin-inline-start: auto; }
.emjl .emjl-report-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.emjl .emjl-report-sum > div { background: var(--surface, #fff); border: 1px solid var(--line, #E3E8F0); border-radius: 12px; padding: 14px 16px; }
.emjl .emjl-report-sum dt { font-size: 12.5px; font-weight: 600; color: var(--text-3, #64748B); }
.emjl .emjl-report-sum dd { margin: 4px 0 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.emjl .emjl-report-sum .is-in dd { color: #15803D; }
.emjl .emjl-report-sum .is-out dd { color: #B91C1C; }
.emjl .emjl-report-sum .is-total { border-color: var(--text, #0F172A); border-width: 2px; }
.emjl .emjl-report-sum .is-total.is-neg dd, .emjl .emjl-report-table .is-neg { color: #B91C1C; }
.emjl .emjl-report-table .n { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.emjl .emjl-report-table .nowrap { white-space: nowrap; }
.emjl .emjl-report-table tfoot th, .emjl .emjl-report-table tfoot td { border-top: 2px solid var(--line, #CBD5E1); font-weight: 700; }
.emjl .emjl-report-bars-col { width: 22%; }
.emjl .emjl-report-bars { vertical-align: middle; }
.emjl .emjl-report-bars span { display: block; height: 6px; border-radius: 3px; min-width: 1px; }
.emjl .emjl-report-bars span + span { margin-top: 3px; }
.emjl .emjl-report-bars .is-in { background: #22C55E; }
.emjl .emjl-report-bars .is-out { background: #EF4444; }
.emjl-report-print-head { display: none; }
@media (max-width: 900px) { .emjl .emjl-report-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } .emjl .emjl-report-actions { margin-inline-start: 0; } }
@media print {
    .emjl:has(.emjl-report) .main-sidebar, .emjl:has(.emjl-report) .main-header, .emjl:has(.emjl-report) .main-footer,
    .emjl-report .content-header, .emjl-report .emjl-report-form, .emjl-report .emjl-report-bars-col, .emjl-report .emjl-report-bars { display: none !important; }
    .emjl:has(.emjl-report) .content-wrapper { margin: 0 !important; padding: 0 !important; min-height: 0 !important; background: #fff !important; }
    .emjl-report-print-head { display: flex; flex-direction: column; gap: 2px; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 14px; }
    .emjl-report .box { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
    .emjl-report .col-md-7, .emjl-report .col-md-5 { width: 100% !important; float: none !important; }
}
.emjl-readonly .rdv-answer, .emjl-readonly .rdv-del { display: none; }

/* --- Missions ------------------------------------------------------------------ */
.emjl .emjl-inline-form { display: inline; margin: 0; }
.emjl .mis-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.emjl .mis-head h1 { margin: 0; }
.emjl .mis-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.emjl .mis-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line, #E3E8F0); color: var(--text-2, #475569); text-decoration: none; font-weight: 600; background: var(--surface, #fff); }
.emjl .mis-tabs a.is-current { background: var(--c1, #2563EB); border-color: var(--c1, #2563EB); color: #fff; }
.emjl .mis-tabs a.is-alert:not(.is-current) .mis-count { background: #FEE2E2; color: #B91C1C; }
.emjl .mis-count { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 999px; background: rgba(100, 116, 139, .14); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.emjl .mis-tabs a.is-current .mis-count { background: rgba(255, 255, 255, .22); }
.emjl .mis-filters { padding: 0; }
.emjl .mis-filters > summary { cursor: pointer; padding: 11px 16px; font-weight: 600; list-style: none; }
.emjl .mis-filters > summary::-webkit-details-marker { display: none; }
.emjl .mis-filter-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding: 0 16px 14px; }
.emjl .mis-filter-form label { display: grid; gap: 4px; margin: 0; font-size: 12.5px; font-weight: 600; color: var(--text-2, #475569); }
.emjl .mis-filter-form input, .emjl .mis-filter-form select { height: 34px; padding: 5px 9px; border: 1px solid var(--line, #CBD5E1); border-radius: 7px; background: var(--surface, #fff); color: var(--text); font: inherit; font-weight: 400; min-width: 150px; }
.emjl .mis-filter-form input[type="search"] { min-width: 230px; }
.emjl .mis-filter-btns { display: flex; gap: 6px; }
.emjl .mis-table { margin: 0; }
.emjl .mis-table th { font-size: 12.5px; color: var(--text-3, #64748B); font-weight: 600; white-space: nowrap; }
.emjl .mis-table td { vertical-align: middle !important; padding: 12px 14px !important; }
.emjl .mis-row td:first-child { border-inline-start: 4px solid transparent; }
.emjl .mis-row.prio-haute td:first-child { border-inline-start-color: #F59E0B; }
.emjl .mis-row.prio-urgente td:first-child { border-inline-start-color: #DC2626; }
.emjl .mis-row.is-done .mis-title { color: var(--text-3, #64748B); }
.emjl .mis-title { font-weight: 600; font-size: 15px; color: var(--text, #0F172A); }
.emjl .mis-title:hover { color: var(--c1, #2563EB); }
.emjl .mis-sub { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 12.5px; color: var(--text-3, #64748B); }
.emjl .mis-prio { font-weight: 700; color: #B45309; }
.emjl .prio-urgente .mis-prio { color: #B91C1C; }
.emjl .mis-due { white-space: nowrap; }
.emjl .mis-due-rel { display: block; font-size: 12px; color: var(--text-3, #64748B); }
.emjl .mis-facts .mis-due-rel { display: inline; }
.emjl .mis-due-rel.is-late { color: #B91C1C; font-weight: 600; }
.emjl .mis-due-rel.is-today, .emjl .mis-due-rel.is-soon { color: #B45309; font-weight: 600; }
.emjl .mis-thread { color: var(--text-2, #475569); white-space: nowrap; }
.emjl .mis-unread { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #DC2626; color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.emjl .mis-card { border-top: 3px solid var(--line, #E3E8F0); }
.emjl .mis-card.prio-haute { border-top-color: #F59E0B; }
.emjl .mis-card.prio-urgente { border-top-color: #DC2626; }
.emjl .mis-card-state { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.emjl .mis-desc { font-size: 15px; line-height: 1.7; white-space: normal; }
.emjl .mis-thread-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.emjl .mis-msg { padding: 12px 14px; border-radius: 12px; background: var(--hover, #F5F7FB); max-width: 88%; }
.emjl .mis-msg.is-mine { margin-inline-start: auto; background: rgba(37, 99, 235, .08); }
.emjl .mis-msg-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 4px; font-size: 13px; }
.emjl .mis-msg-head time { color: var(--text-3, #64748B); font-size: 12px; }
.emjl .mis-msg-kind { font-size: 11.5px; font-weight: 600; color: var(--text-3, #64748B); border: 1px solid var(--line, #E3E8F0); border-radius: 999px; padding: 0 8px; }
.emjl .mis-msg-subject { font-weight: 600; margin: 0 0 2px; }
.emjl .mis-msg-text { line-height: 1.6; }
.emjl .mis-reply { display: grid; gap: 8px; border-top: 1px solid var(--line, #E3E8F0); padding-top: 14px; }
.emjl .mis-reply textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--line, #CBD5E1); border-radius: 9px; background: var(--surface, #fff); color: var(--text); font: inherit; resize: vertical; }
.emjl .mis-reply-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.emjl .mis-facts { margin: 0; display: grid; gap: 12px; }
.emjl .mis-facts dt { font-size: 12px; font-weight: 600; color: var(--text-3, #64748B); }
.emjl .mis-facts dd { margin: 2px 0 0; font-size: 14.5px; }
.emjl .mis-actions { display: grid; gap: 8px; }
.emjl .mis-actions form { margin: 0; }
.emjl .mis-delete { color: #B91C1C; }
.emjl-readonly .mis-reply, .emjl-readonly .mis-actions form, .emjl-readonly .mis-head .btn { display: none; }
@media (max-width: 720px) { .emjl .mis-msg { max-width: 100%; } .emjl .mis-filter-form label, .emjl .mis-filter-form input, .emjl .mis-filter-form select { width: 100%; min-width: 0; } }

/* ==========================================================================
   Refonte visuelle des formulaires (2026-11)
   Fiche administrative : champs teintés et compacts, sections ouvertes séparées
   par un filet, rail d'étapes vertical sur grand écran, barre d'actions collante.
   ========================================================================== */
:root {
    --f-h: 40px;
    --f-r: 8px;
    --f-bg: #F8FAFC;
    --f-border: #D5DDE8;
    --f-border-hover: #A9B6C8;
    --f-label: #334155;
    --f-muted: #7B8798;
}
html.emjl-dark { --f-bg: #0F1A2E; --f-border: #2B3A52; --f-border-hover: #475569; --f-label: #CBD5E1; --f-muted: #8A97AB; }

/* champs */
.emjl .emjl-f .form-control,
.emjl .emjl-f .form-control.input-lg,
.emjl .emjl-f-get .form-control {
    height: var(--f-h); padding: 8px 12px; font-size: 14.5px; color: var(--ink, #0F172A);
    background-color: var(--f-bg); border-color: var(--f-border); box-shadow: none;
}
.emjl .emjl-f .form-control:focus, .emjl .emjl-f-get .form-control:focus { background-color: var(--surface, #fff); }
.emjl .emjl-f textarea.form-control { min-height: 96px; line-height: 1.55; padding-top: 10px; }
.emjl .emjl-f .form-control::placeholder, .emjl .emjl-f-get .form-control::placeholder { color: var(--f-muted); opacity: 1; }
/* liste déroulante encore sur son option vide : texte grisé comme un indice */
.emjl .emjl-f select.form-control:has(option:checked[value=""]),
.emjl .emjl-f select.form-control:has(option:checked:disabled),
.emjl .emjl-f-get select.form-control:has(option:checked[value=""]) { color: var(--f-muted); }
.emjl .emjl-f select.form-control option { color: var(--ink, #0F172A); }
.emjl .emjl-f .form-control[readonly], .emjl .emjl-f .form-control[disabled] { border-style: solid; background-color: transparent; color: var(--text-2, #475569); }

/* libellés */
.emjl .emjl-f .emjl-label, .emjl .emjl-f .form-group > label { font-size: 13px; font-weight: 600; color: var(--f-label); margin-bottom: 5px; line-height: 1.35; }
.emjl .emjl-f .emjl-req { margin-inline-start: 2px; }
.emjl .emjl-fgrid > .emjl-fcell { margin-bottom: 14px; }
@media (min-width: 768px) { .emjl .emjl-fgrid { column-gap: 18px !important; } }

/* sections : plus de cadre dans le cadre, un titre suivi d'un filet */
.emjl .emjl-f fieldset, .emjl .emjl-f fieldset.loc {
    margin: 8px 0 22px; padding: 0 !important; border: 0 !important; border-radius: 0; background: none; box-shadow: none;
}
.emjl .emjl-f fieldset:focus-within { box-shadow: none; }
.emjl .emjl-f fieldset > legend, .emjl .emjl-f fieldset legend {
    display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 6px 0 0; border: 0;
    font-size: 15.5px; font-weight: 700; color: var(--ink, #0F172A);
}
.emjl .emjl-f fieldset legend::before { display: none; }
.emjl .emjl-f fieldset legend { width: 100%; }
.emjl .emjl-f fieldset legend::after { content: ""; flex: 1 1 auto; min-width: 24px; height: 1px; background: var(--rule, #E3E8F0); }
@media (min-width: 768px) { .emjl .emjl-f fieldset [class*="col-"]:has(> legend) { float: none; width: auto; padding-left: 0; padding-right: 0; } }
.emjl .emjl-f fieldset fieldset > legend { font-size: 14px; color: var(--text-2, #475569); }
.emjl .emjl-f fieldset:focus-within > legend { color: var(--f-focus); }
/* intertitres écrits en texte simple dans les sections (ex. « Données du défunt : ») */
.emjl .emjl-f fieldset > p:not([class]), .emjl .emjl-f fieldset h4, .emjl .emjl-f fieldset h5,
.emjl .emjl-f fieldset .emjl-fwide > p:only-child:not([class]) {
    margin: 10px 0 12px; font-size: 13.5px; font-weight: 700; color: var(--text-2, #475569);
}

/* tableaux de saisie (associés, héritiers…) */
.emjl .emjl-f table .form-control { height: 36px; padding: 6px 10px; font-size: 14px; }
.emjl .emjl-f table.table > thead > tr > th { font-size: 12.5px; font-weight: 600; color: var(--muted, #64748B); background: var(--head, #F8FAFC); }
.emjl .emjl-f table.table > tbody > tr > td { padding: 6px 8px; vertical-align: middle; }

/* barre d'actions : collée en bas de l'écran tant que le formulaire est visible */
.emjl form.emjl-f-card .emjl-f-foot {
    position: sticky; bottom: 0; z-index: 20;
    margin: 18px 0 0 !important; padding: 12px 16px !important;
    background: rgba(255, 255, 255, .96); border: 1px solid var(--rule, #E3E8F0); border-radius: 12px;
    box-shadow: 0 -8px 24px -12px rgba(15, 23, 42, .18);
    -webkit-backdrop-filter: saturate(1.4) blur(6px); backdrop-filter: saturate(1.4) blur(6px);
}
html.emjl-dark .emjl form.emjl-f-card .emjl-f-foot { background: rgba(15, 23, 42, .94); }
.emjl form.emjl-f-card .emjl-f-foot .emjl-req-note { order: 10; }
.emjl .emjl-f .emjl-submit, .emjl .emjl-f .emjl-step-prev { min-height: 40px; padding: 8px 18px; font-size: 14.5px; }
@media print { .emjl form.emjl-f-card .emjl-f-foot, .emjl form.emjl-f-card > .emjl-savebar { display: none !important; } }

/* étapes : pastilles numérotées, libellés entiers sur deux lignes */
.emjl-steps { margin: 0 0 18px; padding-bottom: 12px; }
.emjl-step-t { -webkit-line-clamp: 2; line-height: 1.3; font-size: 13.5px; }
.emjl-steps li { min-width: 132px; }

/* grand écran : rail d'étapes vertical à gauche, formulaire à droite */
@media (min-width: 1280px) {
    .emjl form.emjl-stepped-rail { display: grid; grid-template-columns: 232px minmax(0, 1fr); column-gap: 28px; align-items: start; }
    .emjl form.emjl-stepped-rail > * { grid-column: 2; }
    .emjl form.emjl-stepped-rail > .emjl-steps {
        grid-column: 1; grid-row: 1 / span 20; position: sticky; top: 16px;
        margin: 16px 0 16px 16px; padding: 0; border: 0;
    }
    .emjl-rtl .emjl form.emjl-stepped-rail > .emjl-steps, [dir="rtl"] .emjl form.emjl-stepped-rail > .emjl-steps { margin: 16px 16px 16px 0; }
    .emjl form.emjl-stepped-rail > .emjl-steps ol { display: flex; flex-direction: column; gap: 0; overflow: visible; }
    .emjl form.emjl-stepped-rail > .emjl-steps li { min-width: 0; flex: none; }
    .emjl form.emjl-stepped-rail > .emjl-steps li + li::before {
        content: ""; position: absolute; top: -10px; inset-inline-start: 15px; width: 2px; height: 20px; left: auto; right: auto;
        background: var(--rule, #E3E8F0); border: 0;
    }
    .emjl form.emjl-stepped-rail .emjl-step {
        display: flex !important; align-items: center; gap: 12px; width: 100%; padding: 8px 10px 8px 0 !important; margin: 0 0 4px;
        border-radius: 10px; text-align: start;
    }
    .emjl form.emjl-stepped-rail .emjl-step-t { -webkit-line-clamp: 3; font-size: 14px; }
    .emjl form.emjl-stepped-rail .emjl-step[aria-current="step"] { background: linear-gradient(90deg, var(--f-ring), transparent) !important; }
    [dir="rtl"] .emjl form.emjl-stepped-rail .emjl-step[aria-current="step"] { background: linear-gradient(270deg, var(--f-ring), transparent) !important; }
    .emjl form.emjl-stepped-rail .emjl-steps-bar { display: block; margin-top: 14px; }
    .emjl form.emjl-stepped-rail .emjl-steps-all { margin: 10px 0 0; }
    .emjl form.emjl-stepped-rail > .box-body { padding-inline-start: 0; }
}

/* anciens boutons des vues (Ajouter une ligne, Vivant/Décédé…) au style des boutons secondaires */
.emjl .content .button_insert, .emjl .content .bouton_insert, .emjl .content .bouton_serech {
    display: inline-flex; align-items: center; gap: 6px; min-height: 34px; margin: 6px 0 10px; padding: 6px 14px;
    border: 1px dashed var(--f-border-hover); border-radius: var(--f-r); background: var(--surface, #fff);
    color: var(--blue, #2563EB); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
}
.emjl .content .button_insert::before, .emjl .content .bouton_insert::before { content: "\f067"; font-family: FontAwesome; font-size: 11px; font-weight: normal; }
.emjl .content .button_insert:hover, .emjl .content .bouton_insert:hover, .emjl .content .bouton_serech:hover { border-style: solid; border-color: var(--blue, #2563EB); background: var(--f-ring); }
.emjl .content .button_insert:focus-visible, .emjl .content .bouton_insert:focus-visible { outline: 2px solid var(--f-focus); outline-offset: 2px; }
@media (min-width: 768px) { .emjl .emjl-f fieldset [class*="col-"]:has(> h5:only-child), .emjl .emjl-f fieldset [class*="col-"]:has(> h4:only-child) { float: none; width: auto; padding-left: 0; padding-right: 0; clear: both; } }

/* petit et moyen écran : le rail d'étapes, sorti du corps du cadre, garde les marges du formulaire */
@media (max-width: 1279px) { .emjl form.emjl-stepped-rail > .emjl-steps { margin: 12px 15px 16px; } }
/* long formulaire : la barre collante (savebar) remplace le pied d'origine, jamais les deux */
.emjl form.emjl-f-card .emjl-f-foot.emjl-savebar-origin { display: none !important; }
.emjl form.emjl-f-card > .emjl-savebar { border: 1px solid var(--rule, #E3E8F0); border-radius: 12px; margin: 18px 0 0; box-shadow: 0 -8px 24px -12px rgba(15, 23, 42, .18); }

/* mois réglés d'un reçu : cases en pastilles, six par ligne */
.emjl .emjl-f fieldset.emjl-months { margin: 4px 0 8px; }
.emjl .emjl-f fieldset.emjl-months > legend { font-size: 13px; font-weight: 600; color: var(--f-label); margin: 0 0 8px; padding: 0; }
.emjl .emjl-f fieldset.emjl-months > legend::after { display: none; }
.emjl-months-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.emjl .content .emjl-months-list label.mois {
    display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; min-height: 40px;
    border: 1px solid var(--f-border); border-radius: var(--f-r); background: var(--f-bg); font-weight: 500; font-size: 14px; cursor: pointer;
}
.emjl .content .emjl-months-list label.mois:has(input:checked) { border-color: var(--blue, #2563EB); background: var(--f-ring); color: var(--blue, #2563EB); font-weight: 600; }
.emjl .content .emjl-months-list label.mois:has(input:focus-visible) { outline: 2px solid var(--f-focus); outline-offset: 2px; }
.emjl-months-list input { accent-color: var(--blue, #2563EB); width: 16px; height: 16px; margin: 0; }

/* bouton Vivant / Décédé : bascule, pas un ajout */
.emjl .content .bouton_insert[onclick*="mort_div"]::before, .emjl .content .button_insert[onclick*="mort_div"]::before { content: "\f0ec"; }

/* permissions par rôle : grille compacte, colonne des modules fixe au défilement horizontal */
.emjl-perms-table { font-size: 13px; }
.emjl-perms-table thead th { font-size: 12.5px; padding: 10px 4px; white-space: nowrap; }
.emjl-perms-table td { padding: 4px 3px; }
.emjl-perms-table tbody th, .emjl-perms-table thead th:first-child {
    position: sticky; inset-inline-start: 0; z-index: 2; background: var(--surface, #fff); box-shadow: inset -1px 0 0 var(--rule-soft, #EDF1F7);
}
[dir="rtl"] .emjl-perms-table tbody th, [dir="rtl"] .emjl-perms-table thead th:first-child { box-shadow: inset 1px 0 0 var(--rule-soft, #EDF1F7); }
.emjl-perms-table thead th:first-child { z-index: 3; }
.emjl-perms-table tbody tr:not(.emjl-perms-group):hover th { background: var(--head, #F8FAFC); }
.emjl-perms-group th { position: static !important; box-shadow: none !important; }
.emjl .content .emjl-perm-select, .emjl-perm-select {
    min-width: 112px; height: 30px; padding: 2px 20px 2px 24px; font-size: 12.5px; font-weight: 600; border-radius: 999px;
    border-color: var(--rule, #E3E8F0); background-color: var(--surface, #fff);
    background-image: radial-gradient(circle, var(--lv) 0 4px, transparent 4.5px);
    background-repeat: no-repeat; background-size: 10px 10px; background-position: 9px 50%;
}
[dir="rtl"] .emjl .content .emjl-perm-select, [dir="rtl"] .emjl-perm-select { padding: 2px 24px 2px 20px; background-position: calc(100% - 9px) 50%; }
.emjl-perms-table td[data-level="none"] .emjl-perm-select { color: var(--muted, #64748B); font-weight: 500; }
html.emjl-dark .emjl-perms-table tbody th, html.emjl-dark .emjl-perms-table thead th:first-child { background: var(--surface); }
