/* Adrouch Consulting — charte issue du logo : cyan #02A4D5, bleu #007BB8, indigo #232B80.
   Contrastes vérifiés WCAG AA : texte courant ≥ 7:1, boutons et liens ≥ 5:1. Aucune ressource externe (RGPD, CSP). */

:root {
    --navy: #232b80;
    --navy-deep: #161c5c;
    --brand: #006da8;
    --brand-hover: #005a8c;
    --logo-blue: #007bb8;
    --cyan: #02a4d5;
    --cyan-soft: #e3f5fb;
    --ink: #16213a;
    --muted: #4a5873;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --line: #d5dfec;
    --ok: #0b6b3a;
    --ok-bg: #dff5e7;
    --warn: #7a4e00;
    --warn-bg: #fff1cc;
    --bad: #a11d2b;
    --bad-bg: #fde4e7;
    --radius: 12px;
    --shadow: 0 1px 2px rgb(22 33 58 / 8%), 0 6px 20px rgb(22 33 58 / 6%);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 400 1rem/1.6 var(--font); color: var(--ink); background: var(--bg); }
img, svg { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-hover); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; color: var(--navy); letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); }
h2 { font-size: clamp(1.45rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--navy); color: #fff; padding: .75rem 1rem; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.container { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .55rem 1.2rem; border: 2px solid var(--brand); border-radius: 999px;
    background: var(--brand); color: #fff; font: 600 1rem/1.2 var(--font); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-outline { background: transparent; color: var(--brand); }
.btn-outline:hover { background: var(--cyan-soft); color: var(--brand-hover); }
.btn-light { background: #fff; border-color: #fff; color: var(--navy); }
.btn-light:hover { background: var(--cyan-soft); border-color: var(--cyan-soft); color: var(--navy); }
.btn-ghost-light { background: transparent; border-color: rgb(255 255 255 / 70%); color: #fff; }
.btn-ghost-light:hover { background: rgb(255 255 255 / 14%); border-color: #fff; color: #fff; }
.btn-danger { background: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: #82131f; border-color: #82131f; }
.btn-ok { background: var(--ok); border-color: var(--ok); }
.btn-ok:hover { background: #07522c; border-color: #07522c; }
.btn-sm { min-height: 36px; padding: .3rem .9rem; font-size: .9rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }

/* ---------- Site public : en-tête ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-header .container { display: flex; align-items: center; gap: 1rem; min-height: 68px; }
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--navy); font-weight: 700; font-size: 1.1rem; margin-right: auto; }
.brand img { width: 44px; height: 44px; border-radius: 10px; }
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.main-nav ul { list-style: none; display: flex; gap: .25rem; margin: 0; padding: 0; }
.main-nav a { display: block; padding: .6rem .8rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500; }
.main-nav a:hover { background: var(--cyan-soft); }
.main-nav a[aria-current="page"] { color: var(--brand); box-shadow: inset 0 -3px 0 var(--cyan); border-radius: 8px 8px 0 0; }
.lang { display: flex; gap: .15rem; font-size: .9rem; }
.lang a { padding: .35rem .6rem; border-radius: 6px; text-decoration: none; color: var(--muted); font-weight: 600; }
.lang a[aria-current="true"] { background: var(--navy); color: #fff; }
.menu-btn { display: none; min-height: 44px; min-width: 44px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font: inherit; cursor: pointer; color: var(--navy); }

@media (max-width: 900px) {
    .menu-btn { display: inline-block; }
    .js .main-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line); padding: .5rem 1rem 1rem; box-shadow: var(--shadow); }
    .js .main-nav.open { display: block; }
    .main-nav ul { flex-direction: column; }
    .site-header .container { flex-wrap: wrap; }
    .no-js .main-nav, .main-nav { width: 100%; order: 5; }
}

/* ---------- Héros, sections ---------- */
.hero { position: relative; overflow: hidden; color: #fff; background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 45%, var(--logo-blue) 100%); }
.hero .container { position: relative; display: grid; grid-template-columns: 1.3fr .7fr; gap: 2rem; align-items: center; padding-block: clamp(3rem, 8vw, 6rem); }
.hero h1 { color: #fff; }
.hero p.lead { font-size: 1.2rem; max-width: 40rem; color: #e6f3fb; }
.hero .eyebrow { color: #8fdcf4; }
.hero-art { display: flex; justify-content: center; }
.hero-art img { width: min(300px, 70%); opacity: .95; filter: drop-shadow(0 20px 30px rgb(0 0 0 / 30%)); }
@media (max-width: 800px) { .hero .container { grid-template-columns: 1fr; } .hero-art { display: none; } }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; font-size: .8rem; color: var(--brand); margin-bottom: .6rem; }
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section.alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-head { max-width: 46rem; margin-bottom: 2rem; }
.section-head p { color: var(--muted); font-size: 1.08rem; }
.page-head { background: linear-gradient(135deg, var(--navy) 0%, var(--logo-blue) 100%); color: #fff; padding-block: clamp(2rem, 5vw, 3.5rem); }
.page-head h1 { color: #fff; margin: 0 0 .4rem; }
.page-head p { color: #e6f3fb; margin: 0; max-width: 44rem; font-size: 1.1rem; }

.grid { display: grid; gap: 1.25rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.card .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--cyan-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 1rem; font-weight: 800; }
.card ul { padding-left: 1.2rem; margin: 0; color: var(--muted); }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; position: relative; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; margin-bottom: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .6rem; list-style: none; padding: 0; margin: 0; }
.chips li { background: var(--cyan-soft); color: var(--navy); border: 1px solid #b8e3f2; padding: .35rem .9rem; border-radius: 999px; font-weight: 600; font-size: .95rem; }
.cta-band { background: var(--navy); color: #fff; text-align: center; padding-block: 3rem; }
.cta-band h2 { color: #fff; }
.cta-band p { color: #d5e6f5; max-width: 40rem; margin-inline: auto; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: start; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }
.prose { max-width: 46rem; }
.prose h2 { margin-top: 2rem; font-size: 1.4rem; }

/* ---------- Pied de page ---------- */
.site-footer { background: var(--navy-deep); color: #cfdcec; padding-block: 2.5rem 1.5rem; font-size: .95rem; }
.site-footer a { color: #fff; }
.site-footer .cols { display: grid; gap: 2rem; grid-template-columns: 1.4fr 1fr 1fr; }
@media (max-width: 800px) { .site-footer .cols { grid-template-columns: 1fr; } }
.site-footer h2 { font-size: 1rem; color: #fff; text-transform: uppercase; letter-spacing: .08em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.site-footer .legal { border-top: 1px solid rgb(255 255 255 / 15%); margin-top: 2rem; padding-top: 1rem; font-size: .85rem; }
.footer-brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 700; font-size: 1.1rem; margin-bottom: .75rem; }
.footer-brand img { width: 40px; height: 40px; }

/* ---------- Formulaires ---------- */
.form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .35rem; }
.field label, .field .label { font-weight: 600; color: var(--ink); }
.field .req { color: var(--bad); }
.field .hint { font-size: .88rem; color: var(--muted); }
.field .error { font-size: .92rem; color: var(--bad); font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], input[type="search"], input[type="url"], select, textarea {
    width: 100%; min-height: 44px; padding: .6rem .8rem; border: 1.5px solid #8fa0b8; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
textarea { min-height: 9rem; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--brand); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--cyan); outline-offset: 0; border-color: var(--brand); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--bad); background: #fff8f8; }
.check { display: flex; gap: .6rem; align-items: flex-start; }
.check input { width: 22px; height: 22px; margin-top: .15rem; flex: none; accent-color: var(--brand); }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 0; }
legend { font-weight: 700; padding-inline: .4rem; color: var(--navy); }
.checklist { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* ---------- Messages ---------- */
.flash { display: flex; gap: .7rem; align-items: flex-start; padding: .9rem 1.1rem; border-radius: 10px; border: 1px solid; margin-bottom: 1rem; font-weight: 500; }
.flash.success { background: var(--ok-bg); color: var(--ok); border-color: #9fd9b6; }
.flash.error { background: var(--bad-bg); color: var(--bad); border-color: #f0a9b1; }
.flash.info { background: var(--cyan-soft); color: var(--navy); border-color: #b8e3f2; }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: #ecce82; }
.flash ul { margin: .3rem 0 0; padding-left: 1.2rem; font-weight: 400; }
.flash-zone { position: relative; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.badge.draft { background: #e8edf4; color: #3c4a63; }
.badge.submitted { background: var(--warn-bg); color: var(--warn); }
.badge.validated, .badge.active { background: var(--ok-bg); color: var(--ok); }
.badge.rejected, .badge.inactive { background: var(--bad-bg); color: var(--bad); }
.badge.admin { background: #e5e7ff; color: var(--navy); }

/* ---------- Espace connecté ---------- */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.app-side { background: var(--navy); color: #dbe6f5; padding: 1.25rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.app-side .brand { color: #fff; margin: 0 0 1.5rem; padding-inline: .5rem; }
.app-side .brand small { color: #9fb3d6; }
.app-side nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.app-side nav a { display: flex; gap: .6rem; align-items: center; padding: .65rem .8rem; border-radius: 8px; color: #dbe6f5; text-decoration: none; font-weight: 500; min-height: 44px; }
.app-side nav a:hover { background: rgb(255 255 255 / 10%); color: #fff; }
.app-side nav a[aria-current="page"] { background: #fff; color: var(--navy); font-weight: 700; }
.app-side .nav-title { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: #8ea5cc; padding: 1rem .8rem .3rem; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-top { background: var(--surface); border-bottom: 1px solid var(--line); padding: .6rem 1.5rem; display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; min-height: 60px; }
.app-top .who { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.app-content { padding: 1.5rem; max-width: 1200px; width: 100%; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: .75rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; }
.crumbs li + li::before { content: "›"; margin-right: .4rem; }
.page-title { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-title h1 { font-size: 1.7rem; margin: 0; }
.nav-toggle { display: none; }
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .app-side { position: static; height: auto; padding: .75rem 1rem; }
    .app-side .brand { margin-bottom: .5rem; }
    .app-side nav ul { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; padding-bottom: .4rem; }
    .app-side .nav-title { display: none; }
    .app-content { padding: 1rem; }
}

.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 1.5rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--cyan); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.stat.attention { border-left-color: #d99a00; }
.stat .n { font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .92rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.panel > h2 { font-size: 1.15rem; margin-bottom: .8rem; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin-bottom: 1rem; }
.filters .field { min-width: 150px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
caption { text-align: left; padding: .8rem 1rem; font-weight: 700; color: var(--navy); }
th, td { padding: .7rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #eef3f9; color: var(--navy); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
tbody tr:hover { background: #f8fbfe; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
    .stack-mobile thead { position: absolute; left: -9999px; }
    .stack-mobile tr { display: block; border-bottom: 1px solid var(--line); padding: .5rem 0; }
    .stack-mobile td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .3rem 1rem; text-align: right; }
    .stack-mobile td::before { content: attr(data-label); font-weight: 700; color: var(--navy); text-align: left; }
}
.pager { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-top: 1rem; }

/* ---------- CRA ---------- */
.cra-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.month-nav { display: flex; gap: .5rem; align-items: center; }
.month-nav h1 { margin: 0 .5rem; font-size: 1.5rem; text-transform: capitalize; }
.cra-grid { min-width: 100%; }
.cra-grid th, .cra-grid td { padding: .35rem .6rem; vertical-align: middle; }
.cra-grid thead th { position: sticky; top: 0; z-index: 2; white-space: normal; text-align: center; }
.cra-grid .day { white-space: nowrap; font-weight: 600; position: sticky; left: 0; background: var(--surface); }
.cra-grid tr.off td, .cra-grid tr.off th.day { background: #eef1f6; color: var(--muted); }
.cra-grid tr.holiday td, .cra-grid tr.holiday th.day { background: #f1ecf9; }
.cra-grid select { min-height: 38px; padding: .25rem .4rem; min-width: 5.2rem; text-align: center; }
.cra-grid select:disabled { background: transparent; border-color: transparent; appearance: none; color: var(--muted); }
.cra-grid td.total, .cra-grid tfoot td { font-weight: 700; text-align: center; background: #f5f9fd; }
.cra-grid tr.over td.total { color: var(--bad); }
.cra-grid tfoot td, .cra-grid tfoot th { border-top: 2px solid var(--navy); }
.cra-grid .tag { display: block; font-weight: 500; font-size: .78rem; color: var(--muted); text-transform: none; letter-spacing: 0; }
.cra-summary { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; margin: 1rem 0; }
.cra-summary progress { width: 220px; height: 14px; accent-color: var(--brand); }
.cra-bar { position: sticky; bottom: 0; background: rgb(255 255 255 / 96%); border-top: 1px solid var(--line); padding: .8rem 1rem; display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; justify-content: space-between; margin: 1rem -1.5rem -1.5rem; z-index: 3; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .88rem; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: .3rem; border: 1px solid var(--line); }
.legend .off { background: #eef1f6; }
.legend .hol { background: #f1ecf9; }

/* ---------- Connexion ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(135deg, var(--navy-deep), var(--navy) 50%, var(--logo-blue)); }
.auth .card { width: min(440px, 100%); padding: 2rem; }
.auth .brand { justify-content: center; margin: 0 0 1.5rem; }

@media print {
    .site-header, .site-footer, .app-side, .app-top, .cra-bar, .actions, .no-print, .skip, .flash-zone { display: none !important; }
    .app { display: block; }
    body { background: #fff; }
    .app-content { padding: 0; max-width: none; }
    .panel, .table-wrap { box-shadow: none; border-color: #999; }
    .cra-grid select { appearance: none; border: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Profil en lecture seule, bouton désactivé, sous-titres de panneau ---------- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.25rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; pointer-events: none; }
.panel h3 { font-size: 1.05rem; margin: 1.5rem 0 .75rem; }

/* ---------- Notification des messages ---------- */
.app-top .actions { margin-left: auto; justify-content: flex-end; }
.notif { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; color: var(--navy); background: var(--surface); }
.notif:hover { background: var(--cyan-soft); color: var(--navy); }
.notif-count { position: absolute; top: -4px; right: -6px; min-width: 22px; height: 22px; padding: 0 .35rem; border-radius: 999px; background: var(--bad); color: #fff;
    border: 2px solid var(--surface); font-size: .75rem; font-weight: 800; line-height: 18px; text-align: center; }
.pill { margin-left: auto; min-width: 22px; padding: 0 .45rem; border-radius: 999px; background: var(--cyan); color: var(--navy-deep); font-size: .75rem; font-weight: 800; line-height: 22px; text-align: center; }
.notif-count[hidden], .pill[hidden] { display: none; }

/* ---------- Boîte de réception ---------- */
.inbox { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.inbox li + li { border-top: 1px solid var(--line); }
.inbox a { display: grid; grid-template-columns: 1fr auto; gap: .15rem 1rem; padding: .8rem 1rem; color: var(--ink); text-decoration: none; border-left: 5px solid transparent; }
.inbox a:hover { background: var(--cyan-soft); color: var(--ink); }
.inbox li.unread a { border-left-color: var(--cyan); background: #f2fafd; }
.inbox li.unread .from { font-weight: 800; color: var(--navy); }
.inbox .date { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.inbox .about { grid-column: 1 / -1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.inbox .about strong { color: var(--ink); }
.inbox .tags { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; }
.inbox .tags:empty { display: none; }
.reply { border-top: 1px solid var(--line); padding: .6rem 0; }
.reply summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; min-height: 44px; }
.signature { border-top: 3px solid var(--cyan); padding-top: .6rem; color: var(--muted); }

/* ---------- Modèles de mail ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; gap: 0; } }
.vars { margin: 0; display: grid; gap: .15rem; }
.vars dd { margin: 0 0 .6rem; color: var(--muted); font-size: .9rem; }
.mail-preview { border: 1px solid var(--line); border-top: 6px solid var(--navy); border-radius: var(--radius); padding: 1.25rem; max-width: 660px; }
.mail-subject { font-weight: 800; color: var(--navy); }
.mail-signature { display: flex; gap: 1rem; align-items: flex-start; border-top: 3px solid var(--cyan); padding-top: 1rem; color: var(--muted); font-size: .92rem; }
.mail-signature img { width: 56px; height: 56px; border-radius: 10px; }

/* ---------- Paramètres et avertissement SMTP ---------- */
.smtp-warning { justify-content: space-between; align-items: center; flex-wrap: wrap; }
.smtp-warning > div { flex: 1 1 18rem; font-weight: 400; }
.panel > h2 .badge { vertical-align: middle; margin-left: .5rem; }
fieldset.form { min-width: 0; }
/* Côte à côte, deux champs restent alignés même si un seul porte une aide ou une erreur. */
.row > .field { align-content: start; }

/* ---------- Utilitaires ---------- */
.mt { margin-top: 1.5rem; }
.nomb { margin-bottom: 0; }
.h-card { font-size: 1.3rem; }
ul.plain { list-style: none; padding: 0; display: grid; gap: .5rem; }
.inline-form { display: inline; }
.w-full { width: 100%; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
code.small { font-size: .82rem; overflow-wrap: anywhere; }

/* Réglages : navigation entre les pages ; assistant d'écriture dans la réponse. */
.subnav { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.subnav a { padding: .45rem .95rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--navy); font-weight: 600; text-decoration: none; }
.subnav a:hover { background: var(--cyan-soft); }
.subnav a[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.ai-panel { display: grid; gap: .75rem; background: var(--cyan-soft); }
.ai-panel[hidden] { display: none; }
.ai-translate { display: inline-flex; gap: .4rem; align-items: center; }
.ai-translate select { min-height: 36px; }
.ai-status { margin: 0; min-height: 1.4em; }
.ai-status.failed { color: var(--bad); font-weight: 600; }
.btn[hidden] { display: none; }

/* Éditeur de texte mis en forme (Quill, public/lib/quill) */
.rich-field { border: 1.5px solid #8fa0b8; border-radius: 8px; background: #fff; overflow: visible; }
.rich-field:hover { border-color: var(--brand); }
.rich-field:focus-within { outline: 3px solid var(--cyan); border-color: var(--brand); }
.field.invalid .rich-field { border-color: var(--bad); }
.rich-field .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; background: var(--bg); padding: .35rem .5rem; font-family: var(--font); }
.rich-field .ql-container.ql-snow { border: 0; font: inherit; }
.rich-field .ql-editor { min-height: 14rem; max-height: 32rem; overflow-y: auto; padding: .7rem .8rem; color: var(--ink); font-size: 1rem; line-height: 1.55; }
.rich-field .ql-editor.ql-blank::before { color: var(--muted); font-style: normal; }
.rich-field .ql-snow .ql-stroke { stroke: var(--ink); }
.rich-field .ql-snow .ql-fill { fill: var(--ink); }
.rich-field .ql-snow.ql-toolbar button:hover .ql-stroke, .rich-field .ql-snow.ql-toolbar button.ql-active .ql-stroke,
.rich-field .ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke { stroke: var(--brand); }
.rich-field .ql-snow.ql-toolbar button:hover .ql-fill, .rich-field .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--brand); }
.rich-field .ql-snow.ql-toolbar button, .rich-field .ql-snow.ql-toolbar .ql-picker-label { border-radius: 4px; }
.rich-field .ql-snow.ql-toolbar button:focus-visible, .rich-field .ql-snow.ql-toolbar .ql-picker-label:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.rich-field .ql-snow .ql-picker { color: var(--ink); }
.rich-field .ql-snow .ql-tooltip { z-index: 5; color: var(--ink); border-color: var(--line); box-shadow: var(--shadow); white-space: normal; }
.rich-field .ql-snow .ql-tooltip input[type="text"] { min-height: 0; width: 12rem; padding: .2rem .4rem; border-width: 1px; }
/* Sans la classe ql-* (police et taille posées en styles en ligne) les libellés de la liste restent lisibles. */
.rich-field .ql-snow .ql-picker.ql-font .ql-picker-label::before, .rich-field .ql-snow .ql-picker.ql-font .ql-picker-item::before { content: attr(data-label); }
.rich-field .ql-snow .ql-picker.ql-size .ql-picker-label::before, .rich-field .ql-snow .ql-picker.ql-size .ql-picker-item::before { content: attr(data-label); }
.rich-field .ql-snow .ql-picker.ql-header .ql-picker-label::before, .rich-field .ql-snow .ql-picker.ql-header .ql-picker-item::before { content: attr(data-label); }
.rich-field .ql-snow .ql-picker.ql-font { width: 9rem; }
.rich-field .ql-snow .ql-picker.ql-size { width: 6.5rem; }
.rich-field .ql-snow .ql-picker.ql-header { width: 7rem; }
/* Textes du bulle de lien, fournis en anglais par Quill. */
html[lang="fr"] .rich-field .ql-snow .ql-tooltip::before { content: "Lien :"; }
html[lang="fr"] .rich-field .ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: "Enregistrer"; }
html[lang="fr"] .rich-field .ql-snow .ql-tooltip a.ql-action::after { content: "Modifier"; }
html[lang="fr"] .rich-field .ql-snow .ql-tooltip a.ql-remove::before { content: "Retirer"; }
.rich-field .ql-editor ul, .rich-field .ql-editor ol { padding-left: 1.2rem; }
/* Affichage d'un texte mis en forme déjà enregistré (historique, aperçu d'un modèle). */
.rich { overflow-wrap: anywhere; }
.rich p, .rich ul, .rich ol, .rich blockquote { margin: 0 0 .7rem; }
.rich h1 { font-size: 1.5rem; margin: 0 0 .5rem; } .rich h2 { font-size: 1.25rem; margin: 0 0 .5rem; } .rich h3 { font-size: 1.1rem; margin: 0 0 .5rem; }
.rich blockquote { border-left: 3px solid var(--line); padding-left: .8rem; color: var(--muted); }
.rich a { color: var(--brand); }
.rich .ql-indent-1 { padding-left: 3em; } .rich .ql-indent-2 { padding-left: 6em; } .rich .ql-indent-3 { padding-left: 9em; } .rich .ql-indent-4 { padding-left: 12em; }
.rich .ql-indent-5 { padding-left: 15em; } .rich .ql-indent-6 { padding-left: 18em; } .rich .ql-indent-7 { padding-left: 21em; } .rich .ql-indent-8 { padding-left: 24em; }
@media (max-width: 40rem) { .rich-field .ql-editor { min-height: 11rem; } }

/* Widget anti-robot ALTCHA (public/lib/altcha/altcha.css) aux couleurs du site. */
altcha-widget {
    --altcha-color-primary: var(--brand);
    --altcha-color-success: #1e7a46;
    --altcha-border-color: var(--line);
    --altcha-border-radius: var(--radius, 8px);
    --altcha-max-width: 20rem;
    display: block;
}
.field.captcha.invalid altcha-widget { --altcha-border-color: var(--bad); }
