/* Back-office Dirigeo — charte « Le système visuel » (section 08).
   Palette : Nuit, Marine, Or, Ivoire. Typographie : Outfit (titres, wordmark,
   interface), Cormorant Garamond 300 italique (accroches), DM Mono (libellés
   techniques : dates, rôles, sources). */

:root {
    --nuit: #0D1B2A;
    --marine: #0E1F32;
    --or: #C9A84C;
    --ivoire: #F4F1EA;

    --or-fonce: #A8893A;
    --or-pale: #EFE5C8;
    --surface: #FFFFFF;
    --texte: #0D1B2A;
    --texte-doux: #55606E;
    --bordure: #E3DDCF;
    --danger: #B3261E;
    --danger-pale: #F8E3E1;
    --succes: #2E6B3F;
    --succes-pale: #E2F0E5;

    --font-titre: 'Outfit', system-ui, sans-serif;
    --font-accroche: 'Cormorant Garamond', Georgia, serif;
    --font-mono: 'DM Mono', ui-monospace, 'Cascadia Mono', monospace;

    --radius: 6px;
    --ombre: 0 1px 2px rgba(13, 27, 42, 0.06), 0 4px 16px rgba(13, 27, 42, 0.06);
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
    margin: 0;
    font-family: var(--font-titre);
    font-size: 15px;
    line-height: 1.55;
    color: var(--texte);
    background: var(--ivoire);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-titre); line-height: 1.2; margin: 0; }

a { color: var(--marine); }

:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }

/* L'attribut hidden doit toujours gagner, même sur un élément dont la classe
   fixe un display (boutons .btn en inline-flex, par exemple). */
[hidden] { display: none !important; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Wordmark ---------- */

.wordmark {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    letter-spacing: 0.22em;
    color: var(--ivoire);
    white-space: nowrap;
}

.wordmark-i { color: var(--or); }

/* ---------- Libellés ---------- */

.label-mono {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--or-fonce);
}

.tagline {
    font-family: var(--font-accroche);
    font-style: italic;
    font-weight: 300;
    font-size: 22px;
    line-height: 1.4;
    color: var(--texte-doux);
}

/* ---------- Barre du haut ---------- */

.topbar {
    background: var(--nuit);
    color: var(--ivoire);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 28px;
    padding: 12px 28px;
    border-bottom: 2px solid var(--or);
}

.topbar-brand {
    display: flex;
    align-items: baseline;
    gap: 12px;
    text-decoration: none;
}

.topbar-brand .wordmark { font-size: 20px; }

.topbar-subtitle {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(244, 241, 234, 0.6);
}

.topbar-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
}

.topbar-tab {
    font: 500 14px var(--font-titre);
    color: rgba(244, 241, 234, 0.8);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 12px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.topbar-tab:hover { color: var(--ivoire); }
.topbar-tab.active { color: var(--ivoire); border-bottom-color: var(--or); }

.topbar-caret {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
}

.topbar-menu { position: relative; }

.topbar-menu-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    box-shadow: var(--ombre);
    padding: 6px;
    z-index: 50;
}

.topbar-menu-panel.open { display: block; }

.topbar-menu-panel-right { left: auto; right: 0; }
.topbar-menu-name { font-family: var(--font-titre); font-size: 14px; color: var(--texte); }

.topbar-menu-header {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--texte-doux);
    padding: 8px 12px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--bordure);
    word-break: break-all;
}

.topbar-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    color: var(--texte);
    text-decoration: none;
    font: 400 14px var(--font-titre);
}

.topbar-menu-item:hover { background: var(--ivoire); }
.topbar-menu-item.active { background: var(--or-pale); font-weight: 600; }

.topbar-user .topbar-menu-toggle { gap: 10px; color: var(--ivoire); }
.topbar-user-name { font-size: 14px; font-weight: 500; }

/* ---------- Mise en page ---------- */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 28px 64px;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header h1 { font-weight: 800; font-size: 30px; margin-top: 6px; }
.page-header .tagline { margin: 4px 0 0; font-size: 19px; }

.card {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    box-shadow: var(--ombre);
}

/* ---------- Accueil ---------- */

.welcome {
    background: var(--nuit);
    color: var(--ivoire);
    border-radius: var(--radius);
    padding: 40px 40px 36px;
    border-left: 4px solid var(--or);
    margin-bottom: 28px;
}

.welcome .label-mono { color: var(--or); }
.welcome h1 { font-weight: 800; font-size: 36px; margin: 10px 0 8px; }
.welcome .tagline { color: rgba(244, 241, 234, 0.75); margin: 0; }

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.info-card { padding: 22px 24px; }
.info-card .value { font-size: 18px; font-weight: 600; margin-top: 8px; word-break: break-word; }
.info-card .value.mono { font-family: var(--font-mono); font-size: 15px; font-weight: 400; }
.info-card .hint { color: var(--texte-doux); font-size: 14px; margin: 6px 0 0; }
.info-card .counts { display: flex; gap: 24px; margin: 10px 0 14px; }
.info-card .count { font-size: 28px; font-weight: 800; line-height: 1; }
.info-card .count-label { font-size: 13px; color: var(--texte-doux); }

/* ---------- Boutons ---------- */

.btn {
    font: 600 14px var(--font-titre);
    border-radius: var(--radius);
    border: 1px solid transparent;
    padding: 9px 18px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--or); color: var(--nuit); }
.btn-primary:hover:not(:disabled) { background: var(--or-fonce); color: var(--ivoire); }

.btn-ghost { background: transparent; color: var(--texte); border-color: var(--bordure); }
.btn-ghost:hover:not(:disabled) { border-color: var(--texte-doux); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8E1E18; }

.btn-sm { padding: 5px 11px; font-size: 13px; font-weight: 500; }

.btn-icon { padding: 6px 8px; }
.btn-icon svg { display: block; }
.btn-icon-danger:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }
a.btn.is-disabled { opacity: 0.45; pointer-events: none; }

.btn-link {
    background: none;
    border: none;
    padding: 0;
    font: 500 13px var(--font-titre);
    color: var(--marine);
    text-decoration: underline;
    cursor: pointer;
}

/* ---------- Tableau ---------- */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--bordure);
}

.toolbar input[type="search"] { max-width: 320px; }
.toolbar .count-hint { margin-left: auto; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--texte-doux);
    padding: 12px 18px;
    border-bottom: 1px solid var(--bordure);
    background: #FAF8F3;
    white-space: nowrap;
}

td {
    padding: 13px 18px;
    border-bottom: 1px solid var(--bordure);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FCFBF8; }

td.mono { font-family: var(--font-mono); font-size: 13px; color: var(--texte-doux); white-space: nowrap; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }

.table-state { text-align: center; color: var(--texte-doux); padding: 36px 18px; }
.table-state.error { color: var(--danger); }

.user-name { font-weight: 600; }
.you-tag { font-family: var(--font-mono); font-size: 11px; color: var(--or-fonce); margin-left: 6px; }

/* ---------- Prospects ---------- */

.container-wide { max-width: 1360px; }

.prospects-toolbar { margin-bottom: 20px; }
.prospects-toolbar .toolbar { border-bottom: none; }

.prospect-group { margin-bottom: 20px; }

.prospect-group-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 20px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--bordure);
    border-left: 3px solid var(--or);
}

.prospect-group-head h2 { font-size: 18px; font-weight: 800; }
.prospect-group-meta { font-size: 13px; color: var(--texte-doux); display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.prospect-group-actions { display: flex; align-items: center; gap: 14px; }

.prospect-sub { display: block; font-size: 13px; color: var(--texte-doux); }
.prospect-contact a, .prospect-contact span { display: block; font-size: 14px; }
.prospect-tel { color: var(--texte-doux); font-family: var(--font-mono); font-size: 13px !important; }

.prospect-table th, .prospect-table td { padding-left: 14px; padding-right: 14px; }
.prospect-time { display: block; font-size: 12px; opacity: 0.75; }

.prospect-notes {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--texte-doux);
    font-size: 14px;
}

.status-badge.status-capture { background: var(--or-pale); color: var(--marine); }
.status-badge.status-affecte { background: var(--succes-pale); color: var(--succes); }

/* ---------- Formation ---------- */

.status-badge.status-publiee { background: var(--succes-pale); color: var(--succes); }
.status-badge.status-brouillon { background: #ECE8DE; color: var(--texte-doux); }

.order-cell { white-space: nowrap; }
.order-cell .btn + .btn { margin-left: 4px; }
.capsule-link { font-weight: 600; color: var(--texte); text-decoration: none; }
.formation-table td:nth-child(2) { min-width: 200px; }
.formation-table td.capsule-meta { line-height: 1.7; white-space: normal; }
.formation-table td.capsule-meta span { white-space: nowrap; }
.langage-sujet { display: block; margin-top: 2px; }
.langage-table td.langage-texte { white-space: pre-line; font-size: 14px; color: var(--texte-doux); max-width: 520px; }
.capsule-link:hover { text-decoration: underline; }

.back-link { font-size: 14px; color: var(--marine); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.capsule-head-meta { margin: 8px 0 0; }

.editor-card { margin-bottom: 20px; }

.editor-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bordure);
}

.editor-card-head h2 { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.editor-card-body { padding: 20px; }

.editor-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; }

.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 10px 0; cursor: pointer; }
.check-line input { width: 18px; height: 18px; accent-color: var(--or-fonce); }

.editor-list { list-style: none; margin: 0; padding: 0; }

.editor-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--bordure);
}

.editor-item:last-child { border-bottom: none; }

.editor-index {
    font-family: var(--font-mono);
    color: var(--or-fonce);
    min-width: 22px;
}

.editor-main { flex: 1; min-width: 0; }
.editor-main strong { display: block; font-weight: 600; }
.editor-actions { display: flex; gap: 4px; flex-shrink: 0; }
.editor-empty { padding: 18px 20px; color: var(--texte-doux); font-size: 14px; }

.choix-recap { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--texte-doux); margin-top: 4px; }
.choix-recap .choix-ok { color: var(--succes); font-weight: 600; }

textarea { resize: vertical; line-height: 1.5; }

.modal.modal-wide { max-width: 1180px; }
.modal.modal-medium { max-width: 640px; }

.code-input {
    font-family: var(--font-mono) !important;
    font-size: 13px !important;
    line-height: 1.55;
    min-height: 340px;
}

/* Éditeur de texte riche (zlib/js/rich_editor.js). */
.rte {
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    background: var(--surface);
}

.rte:focus-within { border-color: var(--or); box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2); }

.rte-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--bordure);
    background: #FAF8F3;
    border-radius: var(--radius) var(--radius) 0 0;
}

.rte-block { width: auto; padding: 6px 8px; font-size: 14px; margin-right: 6px; }

.rte-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: none;
    color: var(--texte);
    cursor: pointer;
    font: 600 12px var(--font-mono);
}

.rte-btn:hover:not(:disabled) { background: var(--ivoire); border-color: var(--bordure); }
.rte-btn.is-active { background: var(--or-pale); border-color: var(--or); }
.rte-btn:disabled, .rte-block:disabled { opacity: 0.35; cursor: not-allowed; }
.rte-source-btn { margin-left: auto; }
.rte-sep { width: 1px; height: 20px; background: var(--bordure); margin: 0 6px; }

.rte-prompt {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--bordure);
    background: var(--or-pale);
}

.rte-prompt-label { font-size: 13px; font-weight: 600; }
.rte-prompt-input { flex: 1; min-width: 220px; padding: 7px 10px !important; }
.rte-prompt-error { width: 100%; font-size: 13px; color: var(--danger); }
.rte-prompt-error:empty { display: none; }
.rte-prompt-alt { flex-basis: 100%; padding: 7px 10px !important; }
.rte-or { font-size: 13px; color: var(--texte-doux); }

.rte-status {
    margin: 0;
    padding: 8px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--bordure);
    background: var(--succes-pale);
    color: var(--succes);
}

.rte-status.is-error { background: var(--danger-pale); color: var(--danger); }
.rte-area img { height: auto; }

.rte-area {
    min-height: 360px;
    max-height: 58vh;
    overflow-y: auto;
    padding: 18px 22px;
    outline: none;
}

.rte-area img { max-width: 100%; }
/* Les paragraphes d'une modale sont grisés (.modal p) : pas dans l'éditeur. */
.modal .rte-area, .modal .rte-area p { color: var(--texte); }
.rte-area a { color: var(--marine); }

.rte-source {
    display: block;
    width: 100%;
    border: none !important;
    border-radius: 0 0 var(--radius) var(--radius) !important;
    box-shadow: none !important;
    min-height: 360px;
    max-height: 58vh;
    padding: 16px 18px !important;
}

.choix-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.choix-row { display: flex; align-items: center; gap: 10px; }
.choix-row input[type="text"] { flex: 1; }
.choix-correct input { width: 20px; height: 20px; accent-color: var(--succes); cursor: pointer; }

/* Contenu d'une page de capsule (aperçu du back-office ; l'espace a son thème). */
.capsule-content { font-size: 16px; line-height: 1.65; }
.capsule-content > :first-child { margin-top: 0; }
.capsule-content h2 { font-size: 24px; font-weight: 800; margin: 26px 0 10px; }
.capsule-content h3 { font-size: 19px; font-weight: 600; margin: 22px 0 8px; }
.capsule-content h4 { font-size: 16px; font-weight: 600; margin: 18px 0 6px; }
.capsule-content p { margin: 0 0 14px; }
.capsule-content ul, .capsule-content ol { margin: 0 0 14px; padding-left: 22px; }
.capsule-content li { margin-bottom: 6px; }
.capsule-content blockquote {
    margin: 18px 0;
    padding: 6px 0 6px 18px;
    border-left: 3px solid var(--or);
    font-family: var(--font-accroche);
    font-style: italic;
    font-size: 21px;
}
/* Images en bloc : une page de formation montre une illustration entre deux
   paragraphes, pas une icône au fil du texte. */
.capsule-content img { display: block; max-width: 100%; height: auto; margin: 16px 0; border-radius: 4px; }
.capsule-content table { border-collapse: collapse; margin: 0 0 14px; }
.capsule-content th, .capsule-content td { border: 1px solid var(--bordure); padding: 6px 10px; }
.capsule-content code { font-family: var(--font-mono); font-size: 0.9em; }

/* La barre du haut garde une ligne avec ses six onglets : sous 1200 px, le
   sous-titre « Espace mandataire » et le nom de la personne s'effacent (son
   rôle et son menu restent ; le nom est rappelé en tête du menu), et les
   onglets se resserrent. */
@media (max-width: 1200px) {
    .topbar-subtitle { display: none; }
    .topbar-user-name { display: none; }
    .topbar { gap: 8px 18px; }
    .topbar-tab { padding: 8px 9px; }
}

@media (max-width: 900px) {
    .editor-grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ---------- MCP ---------- */

.mcp-endpoint { padding: 16px 20px; margin-bottom: 20px; }
.mcp-endpoint .label-mono { display: block; margin-bottom: 8px; }
.mcp-endpoint input { font-family: var(--font-mono) !important; font-size: 14px !important; }
.mcp-endpoint code, .mcp-warning code { font-family: var(--font-mono); font-size: 0.92em; }
.mcp-journal { margin-top: 20px; }
.mcp-perm-cell .status-badge { margin: 2px 2px 2px 0; }
.mono-sub { font-family: var(--font-mono); font-size: 12px !important; }
.status-badge.status-lecture { background: #E7EEF5; color: var(--marine); }
.status-badge.status-ecriture { background: var(--or-pale); color: #6B5418; }
.status-badge.status-erreur { background: var(--danger-pale); color: var(--danger); }

.mcp-perms { width: 100%; border: 1px solid var(--bordure); border-radius: var(--radius); }
.mcp-perms th, .mcp-perms td { padding: 8px 12px; text-align: center; }
.mcp-perms th:first-child, .mcp-perms td:first-child { text-align: left; }
.mcp-perms input { width: 18px; height: 18px; accent-color: var(--or-fonce); cursor: pointer; }

.mcp-warning { background: var(--or-pale); color: var(--texte) !important; padding: 10px 14px; border-radius: var(--radius); }
.mcp-token { min-height: 0 !important; font-size: 14px !important; }
.mcp-snippets { margin-top: 18px; }
.mcp-snippets pre {
    margin: 4px 0 14px;
    padding: 10px 12px;
    background: var(--nuit);
    color: var(--ivoire);
    border-radius: var(--radius);
    font: 12px/1.5 var(--font-mono);
    white-space: pre-wrap;
    word-break: break-all;
}

/* ---------- Badges ---------- */

.role-badge, .status-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 3px;
    white-space: nowrap;
}

.role-admin { background: var(--nuit); color: var(--or); }
.role-mandataire { background: var(--or-pale); color: var(--marine); }
.topbar .role-mandataire { background: rgba(201, 168, 76, 0.18); color: var(--or); }
.status-badge.locked { background: var(--danger-pale); color: var(--danger); margin-left: 6px; }

/* ---------- Formulaires ---------- */

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"], select, textarea {
    width: 100%;
    font: 400 15px var(--font-titre);
    color: var(--texte);
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    padding: 10px 12px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--or);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.25);
}

.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; min-width: 0; }

.field-hint { font-size: 12px; color: var(--texte-doux); margin: 6px 0 0; }

.form-message {
    display: none;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: var(--radius);
    margin: 4px 0 0;
}

.form-message.error { display: block; background: var(--danger-pale); color: var(--danger); }
.form-message.success { display: block; background: var(--succes-pale); color: var(--succes); }
.form-message.warning { display: block; background: var(--or-pale); color: #6B5418; }

/* ---------- Paramètres et simulateur Brevo ---------- */

.params-crm-test { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sim-info { margin-bottom: 20px; }
.sim-info-body { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 20px; }
.sim-info-body > div { flex: 1; min-width: 240px; }
.sim-info-body .label-mono { display: block; margin-bottom: 4px; }
.sim-info-body code { font-family: var(--font-mono); font-size: 13px; word-break: break-all; }
.sim-table .user-name, .sim-table .mono-sub { display: block; }
.sim-table .mono-sub { color: var(--texte-doux); }
.sim-request { white-space: normal !important; word-break: break-all; }
.sim-email-meta { font-size: 13px; }

/* ---------- Formation : groupes de capsules ---------- */

.formation-groupe .editor-card-head { align-items: flex-start; gap: 16px; }
.formation-groupe-title p { margin: 4px 0 0; }
.formation-groupe-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- Comptes : identifiants, blocage, connexion ---------- */

.credentials { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.credentials .label-mono { display: block; margin-bottom: 4px; }
.credentials code {
    font-family: var(--font-mono); font-size: 16px; background: var(--ivoire); padding: 6px 10px;
    border-radius: var(--radius); margin-right: 8px; word-break: break-all;
}
.users-table tr.is-blocked td { color: var(--texte-doux); }
.login-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -4px 0 6px; }
.login-options .check-line { padding: 4px 0; }
.login-options a { color: var(--marine); font-size: 14px; font-weight: 600; }
.login-intro { font-size: 14px; color: var(--texte-doux); margin: -6px 0 16px; }
.sim-email-frame { width: 100%; height: 420px; border: 1px solid var(--trait, #E2DDD1); background: #fff; }

/* ---------- Fenêtres modales ---------- */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(13, 27, 42, 0.55);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    border-top: 3px solid var(--or);
    box-shadow: 0 20px 60px rgba(13, 27, 42, 0.35);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 26px 28px 22px;
}

.modal-sm { max-width: 420px; }

.modal-title { font-size: 20px; font-weight: 800; margin-bottom: 20px; }
.modal p { margin: 0 0 10px; color: var(--texte-doux); }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* ---------- Connexion ---------- */

body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background:
        radial-gradient(ellipse at 80% 10%, rgba(201, 168, 76, 0.12), transparent 55%),
        var(--nuit);
}

.login-box { width: 100%; max-width: 400px; }

.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .wordmark { font-size: 40px; }
.login-brand .tagline { color: rgba(244, 241, 234, 0.7); margin: 10px 0 0; font-size: 21px; }

.login-card {
    background: var(--ivoire);
    border-radius: var(--radius);
    border-top: 3px solid var(--or);
    padding: 30px 30px 26px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.login-card .label-mono { display: block; margin-bottom: 18px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; margin-top: 8px; }

.login-box-wide { max-width: 460px; }

.login-switch {
    margin: 18px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--bordure);
    text-align: center;
    font-size: 14px;
    color: var(--texte-doux);
}

.login-switch a { color: var(--marine); font-weight: 600; }

/* Champ piège de l'inscription : hors écran, ni vu ni atteint au clavier. */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Petits écrans ---------- */

@media (max-width: 720px) {
    .topbar { padding: 12px 16px; }
    .topbar-tabs { order: 3; flex-basis: 100%; }
    .topbar-user-name { display: none; }
    .container { padding: 24px 16px 48px; }
    .welcome { padding: 28px 22px; }
    .welcome h1 { font-size: 28px; }
    .field-row { grid-template-columns: 1fr; }

    /* Le tableau devient une liste de fiches : les actions restent visibles
       sans défilement horizontal. */
    .table-wrap thead { display: none; }
    .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
    .table-wrap tr { padding: 14px 18px; border-bottom: 1px solid var(--bordure); }
    .table-wrap tbody tr:last-child { border-bottom: none; }
    .table-wrap td { padding: 2px 0; border: none; }
    .users-table td.mono::before { content: 'Dernière connexion : '; }
    .table-wrap .prospect-notes { max-width: none; white-space: normal; }
    .table-wrap td.actions { text-align: left; margin-top: 10px; }
    .table-wrap td.table-state { padding: 24px 0; }
}
