/* ==========================================================================
   Feuille de style principale — mobile d'abord, sans dépendance externe
   (compatible avec la politique de sécurité CSP stricte).
   ========================================================================== */

:root {
    /* Marque : bleu-vert Oklé ; accent : corail. */
    --color-primary: #0f5c6e;
    --color-primary-dark: #0a4452;
    --color-primary-50: #e7f3f5;
    --color-primary-100: #cfe7ec;
    --color-accent: #ff7a59;
    --color-accent-strong: #e2522f;
    --color-accent-50: #fff1ec;
    --color-text: #16202b;
    --color-muted: #5b6776;
    --color-border: #e1e7ee;
    --color-bg: #f6f8fb;
    --color-surface: #ffffff;
    --color-success-bg: #e3f6ea;
    --color-success: #1d7a45;
    --color-error-bg: #fdecea;
    --color-error: #b42318;
    --color-warning-bg: #fff4e0;
    --color-warning: #8a5a00;
    /* Couleurs des étapes du dossier. */
    --step-prospect: #64748b;
    --step-collecting: #f2a93b;
    --step-complete: #2f80ed;
    --step-banks: #6c5ce7;
    --step-offer: #0ea5a4;
    --step-accepted: #4f46e5;
    --step-funds: #0284c7;
    --step-fees: #f2994a;
    --step-success: #27ae60;
    --step-failure: #94a3b8;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgb(16 24 40 / 5%), 0 6px 16px rgb(16 24 40 / 6%);
    --shadow-lg: 0 12px 32px rgb(16 24 40 / 12%);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --sidebar-width: 256px;
    --sidebar-collapsed: 76px;
}

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

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3 {
    line-height: 1.25;
    margin: 0 0 0.5em;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

a { color: var(--color-primary); }

:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

.muted { color: var(--color-muted); }

/* ---------- En-tête ---------- */
.topbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.topbar__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    color: var(--color-primary);
    text-decoration: none;
}

.topbar__nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar__user {
    display: none;
    color: var(--color-muted);
    font-size: 0.95rem;
}

.lang-menu { position: relative; }
.lang-menu__toggle {
    display: inline-flex; align-items: center; gap: 0.3rem; min-height: 40px; padding: 0.35rem 0.55rem;
    border-radius: 8px; color: var(--color-muted); font-size: 0.85rem; font-weight: 700; cursor: pointer; list-style: none;
}
.lang-menu__toggle::-webkit-details-marker { display: none; }
.lang-menu__toggle:hover, .lang-menu[open] .lang-menu__toggle { background: var(--color-bg); color: var(--color-primary); }
.lang-menu__chevron { transition: transform 0.15s; }
.lang-menu[open] .lang-menu__chevron { transform: rotate(180deg); }
.lang-menu__list {
    position: absolute; top: calc(100% + 0.35rem); inset-inline-end: 0; z-index: 60; min-width: 11rem;
    margin: 0; padding: 0.35rem; list-style: none; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: 12px; box-shadow: 0 12px 32px rgb(15 40 60 / 16%);
}
.lang-menu__item {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.5rem 0.7rem;
    border-radius: 8px; color: var(--color-text); text-decoration: none; font-size: 0.92rem; text-align: start;
}
a.lang-menu__item:hover, a.lang-menu__item:focus-visible { background: var(--color-primary-50); color: var(--color-primary-dark); }
.lang-menu__item.is-current { color: var(--color-primary); font-weight: 700; }
.lang-menu__label { display: inline-flex; align-items: center; gap: 0.6rem; }
.lang-flag { width: 20px; height: 15px; flex: none; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px rgb(0 0 0 / 10%); }

/* ---------- Mise en page ---------- */
.container {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header { margin-bottom: 1.5rem; }

.footer {
    text-align: center;
    color: var(--color-muted);
    font-size: 0.85rem;
    padding: 1.5rem 1rem;
}

/* ---------- Composants ---------- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.card--narrow {
    max-width: 440px;
    margin: 1rem auto;
}

.empty-state {
    text-align: center;
    color: var(--color-muted);
}

.empty-state p { margin: 0; }

.hero {
    text-align: center;
    padding: 1.5rem 0 2rem;
}

.hero__title {
    font-size: 1.8rem;
    max-width: 22ch;
    margin: 0 auto 0.75rem;
}

.hero__lead {
    color: var(--color-muted);
    max-width: 60ch;
    margin: 0 auto;
}

.features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.5rem;
    color: var(--color-muted);
    text-align: center;
}

.features li::before {
    content: "✓ ";
    color: var(--color-primary);
    font-weight: 700;
}

.stat {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
}

.stat__value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--color-primary);
}

.stat__label { color: var(--color-muted); font-size: 0.9rem; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px; /* taille tactile recommandée */
    padding: 0.6rem 1.1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-dark); }
.btn--secondary { background: var(--color-surface); color: var(--color-primary); border-color: var(--color-primary); }
.btn--secondary:hover { background: var(--color-bg); }
.btn--ghost { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn--ghost:hover { background: var(--color-bg); }
.btn--small { min-height: 36px; padding: 0.35rem 0.8rem; font-size: 0.9rem; }
.btn--block { width: 100%; }

/* ---------- Formulaires ---------- */
.form__row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

label { font-weight: 600; font-size: 0.95rem; }

input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"],
input[type="search"],
input[type="number"],
select,
textarea {
    font: inherit;
    font-size: 16px; /* évite le zoom automatique sur iOS */
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    width: 100%;
}

input:focus {
    border-color: var(--color-primary);
    outline: 2px solid rgb(15 92 110 / 20%);
}

/* ---------- Alertes ---------- */
.alert {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert--success { background: var(--color-success-bg); color: var(--color-success); }
.alert--error { background: var(--color-error-bg); color: var(--color-error); }
.alert--warning { background: #fff4e0; color: #8a5a00; }
.alert--info { background: #e3f0f3; color: var(--color-primary-dark); }

/* ---------- Navigation courtier ---------- */
.subnav { border-top: 1px solid var(--color-border); }
.subnav__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
}
.subnav a {
    padding: 0.7rem 0.8rem;
    color: var(--color-muted);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}
.subnav a[aria-current="page"] { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ---------- Utilitaires ---------- */
.small { font-size: 0.875rem; }
.center { text-align: center; }
.pre-line { white-space: pre-line; }
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.page-header--actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}
.page-header p { margin-bottom: 0.25rem; }
.card + .card, .grid + .card, .card + .grid { margin-top: 1rem; }
/* Dans une grille, les cartes sont alignées : même hauteur, boutons en bas. */
.grid > .card { margin-top: 0; display: flex; flex-direction: column; }
.grid > .card > .btn:last-child { margin-top: auto; align-self: flex-start; }
.grid > .card > p:last-of-type { margin-bottom: 1.25rem; }
.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.card__header h2 { margin: 0; }
.card--note { background: #fffbf2; border-color: #f1dfb8; }
a.stat { text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--color-primary); }

/* ---------- Badges ---------- */
.badge, .pill {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    background: var(--color-bg);
    color: var(--color-muted);
    vertical-align: middle;
}
.badge--collecting { background: #fff4e0; color: #8a5a00; }
.badge--complete { background: #e3f1ff; color: #0b4f8a; }
.badge--submitted_to_banks { background: #efe8ff; color: #5b3aa6; }
.badge--offer_received { background: #e0f5f3; color: #0f5c6e; }
.badge--prospect { background: #eceff3; color: #3d4754; }
.badge--offer_accepted { background: #d8efe9; color: #0a4452; }
.badge--awaiting_funds { background: #e6ecff; color: #2f4aa0; }
.badge--fees_due { background: #fff0d6; color: #7a4d00; }
.badge--closed_success { background: var(--color-success-bg); color: var(--color-success); }
.badge--closed_failure { background: #eceff3; color: #5b6776; }
.pill--ok { background: var(--color-success-bg); color: var(--color-success); }
.pill--wait { background: #fff4e0; color: #8a5a00; }
.pill--off { background: var(--color-error-bg); color: var(--color-error); }
.pill--info { background: #e3f0f3; color: var(--color-primary-dark); }

/* ---------- Listes ---------- */
.file-list, .people { list-style: none; margin: 0; padding: 0; }
.file-list__item + .file-list__item, .person + .person { border-top: 1px solid var(--color-border); }
.file-list__link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.85rem 0.25rem;
    text-decoration: none;
    color: inherit;
}
.file-list__link:hover { background: var(--color-bg); }
.file-list__main { display: flex; flex-direction: column; min-width: 0; }
.file-list__meta { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; }
.person {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 0;
}
.person--disabled { opacity: 0.6; }
.person .small { margin-top: 0.25rem; }
.details { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; margin: 0 0 1rem; }
.details dt { color: var(--color-muted); }
.details dd { margin: 0; font-weight: 600; }
.contact { margin: 1rem 0; padding: 0.75rem 1rem; background: var(--color-bg); border-radius: 8px; }
.contact p { margin: 0; }

/* ---------- Filtres, pagination ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.filters input[type="search"] { flex: 1 1 220px; width: auto; }
.filters select { flex: 0 1 220px; width: auto; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding-top: 1rem; border-top: 1px solid var(--color-border); }
.inline-form select { width: auto; flex: 1 1 180px; }

/* ---------- Formulaires avancés ---------- */
.form h2 { margin-top: 1.5rem; }
.form h2:first-of-type { margin-top: 0; }
.form-grid { display: grid; gap: 0 1rem; }
.fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
.fieldset legend { font-weight: 700; padding: 0; margin-bottom: 0.5rem; }
.form__help { color: var(--color-muted); font-size: 0.875rem; margin: 0; }
.form__errors { list-style: none; margin: 0; padding: 0; color: var(--color-error); font-size: 0.875rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--color-error); }
.form__row--checkbox { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 0.5rem; }
.form__row--checkbox input { width: 1.2rem; height: 1.2rem; margin-top: 0.15rem; }
.form__row--checkbox label { font-weight: 500; flex: 1; }
.form__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; margin-top: 1.5rem; }
.input-group { display: flex; }
.input-group input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group__addon {
    display: flex;
    align-items: center;
    padding: 0 0.8rem;
    border: 1px solid var(--color-border);
    border-inline-start: 0;
    border-radius: 0 8px 8px 0;
    background: var(--color-bg);
    color: var(--color-muted);
}
.co-borrower { margin: 0 0 1rem; padding: 0.75rem 1rem; border: 1px dashed var(--color-border); border-radius: 8px; }
.co-borrower summary { cursor: pointer; font-weight: 600; color: var(--color-primary); }
.co-borrower[open] summary { margin-bottom: 0.75rem; }
.separator { display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0; color: var(--color-muted); font-size: 0.875rem; }
.separator::before, .separator::after { content: ""; flex: 1; border-top: 1px solid var(--color-border); }
.form__help.center { margin-top: 0.75rem; }

/* ---------- Pièces justificatives ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist__item { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.55rem 0; }
.checklist__item + .checklist__item { border-top: 1px solid var(--color-border); }
.checklist__item input { width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; flex: none; }
.checklist__item label { font-weight: 500; cursor: pointer; }
.checklist__help { display: block; color: var(--color-muted); font-size: 0.85rem; font-weight: 400; }
.doc-group__title { font-size: 1rem; margin: 1.25rem 0 0.25rem; color: var(--color-muted); }
.doc-group__title:first-of-type { margin-top: 0.5rem; }
.doc-list { list-style: none; margin: 0 0 0.5rem; padding: 0; }
.doc-list__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.75rem 0;
}
.doc-list__item + .doc-list__item { border-top: 1px solid var(--color-border); }
.doc-list__item > div:first-child { flex: 1 1 260px; min-width: 0; }
.doc-list__item--disabled { opacity: 0.55; }
.badge--doc-requested { background: #fff4e0; color: #8a5a00; }
.badge--doc-submitted { background: #e3f1ff; color: #0b4f8a; }
.badge--doc-approved { background: var(--color-success-bg); color: var(--color-success); }
.badge--doc-rejected, .badge--overdue { background: var(--color-error-bg); color: var(--color-error); }
.custom-row { display: grid; gap: 0 1rem; padding: 0.75rem 0; }
.custom-row + .custom-row { border-top: 1px dashed var(--color-border); }
.choice-grid { display: grid; gap: 0.35rem 1rem; }
.choice { display: flex; align-items: center; gap: 0.5rem; padding: 0.15rem 0; }
.choice input { width: 1.1rem; height: 1.1rem; flex: none; margin: 0; }
.choice label { font-weight: 500; }
.form__row--checkbox .form__help { flex-basis: 100%; padding-inline-start: 1.7rem; }
.more-documents { margin-top: 0.75rem; }
.more-documents summary { cursor: pointer; color: var(--color-primary); font-weight: 600; padding: 0.4rem 0; }
input[type="date"],
input[type="datetime-local"] {
    font: inherit;
    font-size: 16px;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    width: 100%;
}

/* ---------- Dépôt et revue des fichiers ---------- */
.doc-list__item--stacked { flex-direction: column; align-items: stretch; }
.doc-list__item--stacked > div:first-child { flex: none; }
.doc-list__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.5rem 1rem; }
.doc-list__head > div:first-child { flex: 1 1 240px; min-width: 0; }
.file-chips { list-style: none; margin: 0.25rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.file-chips li {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem;
    padding: 0.45rem 0.7rem; background: var(--color-bg); border-radius: 8px;
}
.file-chips li > a:first-child { font-weight: 600; word-break: break-all; }
.file-chips li::before { content: "📄"; }
.rejection { margin: 0.25rem 0 0; padding: 0.5rem 0.75rem; background: var(--color-error-bg); color: var(--color-error); border-radius: 8px; }
.review { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.5rem; margin-top: 0.25rem; }
.review__reject summary { list-style: none; }
.review__reject summary::-webkit-details-marker { display: none; }
.review__reject[open] { flex-basis: 100%; }
.review__form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
.review__form label { flex-basis: 100%; font-size: 0.875rem; }
.review__form input[type="text"] { flex: 1 1 260px; }
.upload { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.25rem; }
.upload__picker {
    flex: 1 1 260px;
    display: flex; flex-direction: column; gap: 0.35rem;
    padding: 0.75rem; border: 2px dashed var(--color-border); border-radius: 10px;
    background: var(--color-surface); cursor: pointer; font-weight: 500;
}
.upload__picker:hover { border-color: var(--color-primary); }
.upload__picker span { color: var(--color-primary); font-weight: 600; }
.upload__picker input { font-size: 0.875rem; max-width: 100%; }
.upload .btn { min-height: 44px; }
/* Avec JavaScript : le choix du fichier suffit, l'envoi part tout seul. */
.js .upload .upload__submit { display: none; }
.js .upload__picker input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.js .upload__picker { position: relative; flex-direction: row; align-items: center; justify-content: center; padding: 0.6rem 0.75rem; }
.js .upload__picker:focus-within { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.upload.is-sending .upload__picker span::after { content: " …"; }
.upload.is-sending { opacity: 0.6; pointer-events: none; }
form.inline { display: inline; }
.link-button { background: none; border: 0; padding: 0; color: var(--color-error); text-decoration: underline; cursor: pointer; font: inherit; }
.progress { margin-bottom: 1rem; }
.progress progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 999px; background: var(--color-bg); overflow: hidden; }
.progress progress::-webkit-progress-bar { background: var(--color-bg); border-radius: 999px; }
.progress progress::-webkit-progress-value { background: var(--color-success); border-radius: 999px; }
.progress progress::-moz-progress-bar { background: var(--color-success); border-radius: 999px; }
.progress p { margin: 0.35rem 0 0; }
.stat--alert { border-color: var(--color-accent); }
.stat--alert .stat__value { color: #8a5a00; }

/* ---------- Suivi : relances et historique ---------- */
.reminders { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 1rem; padding: 0.6rem 0.8rem; background: var(--color-bg); border-radius: 8px; }
.reminders p { margin: 0; }
.history summary { cursor: pointer; list-style: none; }
.history summary::-webkit-details-marker { display: none; }
.history summary h2 { display: inline; }
.history summary::after { content: " ▾"; color: var(--color-muted); }
.history[open] summary::after { content: " ▴"; }
.timeline { list-style: none; margin: 1rem 0 0; padding: 0; padding-inline-start: 1rem; border-inline-start: 2px solid var(--color-border); }
.timeline__item { position: relative; display: flex; flex-wrap: wrap; gap: 0.1rem 0.75rem; padding: 0.35rem 0; font-size: 0.925rem; }
.timeline__item::before { content: ""; position: absolute; inset-inline-start: calc(-1rem - 6px); top: 0.75rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-border); }
.timeline__item time { color: var(--color-muted); min-width: 8.5rem; font-variant-numeric: tabular-nums; }
.timeline__item--document_approved::before, .timeline__item--file_completed::before { background: var(--color-success); }
.timeline__item--document_rejected::before { background: var(--color-error); }
.timeline__item--document_uploaded::before { background: #0b4f8a; }
.timeline__item--reminder_sent::before { background: var(--color-accent); }

/* ---------- Questionnaire ---------- */
.js-only { display: none; }
.js .js-only { display: inline-flex; }
[hidden] { display: none !important; }
.questionnaire-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin: 1rem 0; padding: 0.75rem 1rem; border: 1px solid var(--color-border); border-radius: 8px; }
.questionnaire-cta h3 { margin: 0; }
.questionnaire-cta p { margin: 0; }
.questionnaire-part h3 { margin: 0; font-size: 1.05rem; }
.questionnaire-part .card__header { margin-bottom: 0.75rem; }
.questionnaire-part h4 { margin: 1rem 0 0.4rem; font-size: 0.95rem; }
.questionnaire-progress { list-style: none; margin: 0; padding: 0; }
.questionnaire-progress li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.25rem 1rem; padding: 0.5rem 0; }
.questionnaire-progress li + li { border-top: 1px solid var(--color-border); }
.questionnaire-progress .pill { justify-self: end; }
.questionnaire-progress progress { grid-column: 1 / -1; grid-row: 2; width: 100%; height: 8px; appearance: none; border: 0; border-radius: 999px; background: var(--color-bg); overflow: hidden; }
.questionnaire-progress progress::-webkit-progress-bar { background: var(--color-bg); border-radius: 999px; }
.questionnaire-progress progress::-webkit-progress-value { background: var(--color-success); border-radius: 999px; }
.questionnaire-progress progress::-moz-progress-bar { background: var(--color-success); border-radius: 999px; }
.answer-list { list-style: none; margin: 0 0 0.5rem; padding: 0; }
.answer-list li { padding: 0.4rem 0; }
.answer-list li + li { border-top: 1px solid var(--color-border); }
.small-title { font-size: 1rem; margin: 1rem 0 0.5rem; }
.steps { list-style: none; display: flex; gap: 0.5rem; margin: 0 0 1rem; padding: 0; overflow-x: auto; }
.steps__item { flex: 1 1 0; min-width: 5.5rem; }
.steps__item a { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 0.5rem 0.25rem; border-radius: 8px; color: var(--color-muted); text-decoration: none; text-align: center; font-size: 0.8rem; line-height: 1.25; }
.steps__number { display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 2px solid var(--color-border); background: var(--color-surface); font-weight: 700; }
.steps__item.is-done .steps__number { border-color: var(--color-success); background: var(--color-success-bg); color: var(--color-success); }
.steps__item.is-current a { color: var(--color-text); font-weight: 600; }
.steps__item.is-current .steps__number { border-color: var(--color-primary); background: var(--color-primary); color: #fff; }
.list-rows { display: grid; gap: 0.75rem; margin-bottom: 0.75rem; }
.list-row { padding: 0.75rem 1rem; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-bg); }
.list-row .form__row--checkbox { margin-bottom: 0.25rem; }
.form h2 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
.form h2:first-of-type { margin-top: 0; }

/* ---------- Simulations ---------- */
.tabs { display: flex; gap: 0.25rem; margin: 0 0 0.75rem; overflow-x: auto; border-bottom: 1px solid var(--color-border); }
.tabs__item { padding: 0.55rem 0.9rem; color: var(--color-muted); text-decoration: none; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs__item[aria-current="page"] { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.stats { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.stat--highlight { background: var(--color-primary); border-color: var(--color-primary); }
.stat--highlight .stat__value, .stat--highlight .stat__label, .stat--highlight .muted { color: #fff; }
.stat .stat__value { font-size: 1.5rem; }
.input--short { max-width: 10rem; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
.table th, .table td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--color-border); text-align: start; vertical-align: top; }
.table thead th { color: var(--color-muted); font-weight: 600; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table--plan .total th, .table--plan .total td { font-weight: 700; border-top: 2px solid var(--color-text); }
.table--compare tbody th { font-weight: 600; color: var(--color-muted); }
.schedule { margin: 1rem 0; }
.schedule summary { cursor: pointer; font-weight: 600; color: var(--color-primary); }
.breakdown { display: block; width: 100%; height: 12px; border-radius: 999px; overflow: hidden; margin: 0.5rem 0; }
.breakdown__principal { fill: var(--color-primary); }
.breakdown__interest { fill: var(--color-accent); }
.breakdown__insurance { fill: #8fa3b8; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0 0 1rem; padding: 0; }
.legend__dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; margin-inline-end: 0.35rem; vertical-align: -0.05rem; }
.legend__dot--principal { background: var(--color-primary); }
.legend__dot--interest { background: var(--color-accent); }
.legend__dot--insurance { background: #8fa3b8; }
.simulation-list { list-style: none; margin: 0; padding: 0; }
.simulation-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; padding: 0.55rem 0; }
.simulation-list li + li { border-top: 1px solid var(--color-border); }
.simulation-list label { font-weight: 400; display: flex; align-items: center; gap: 0.5rem; flex: 1 1 14rem; }
.simulation-list .num { font-variant-numeric: tabular-nums; }

.tool-grid { margin-bottom: 0; }
.tool { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.9rem 1rem; border: 1px solid var(--color-border); border-radius: 10px; color: var(--color-text); text-decoration: none; }
.tool:hover, .tool:focus-visible { border-color: var(--color-primary); background: var(--color-bg); }
.tool strong { color: var(--color-primary); }
.simulation-list__main { flex: 1 1 14rem; }

/* ---------- Dossier banque ---------- */
.stat__value--text { font-size: 1.05rem !important; }
.bank-list { list-style: none; margin: 0; padding: 0; }
.bank-list__item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 1.5rem; padding: 0.9rem 0; }
.bank-list__item + .bank-list__item { border-top: 1px solid var(--color-border); }
.bank-list__main { flex: 1 1 20rem; }
.bank-list__main .pill { margin-inline-end: 0.4rem; }
.bank-list__actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.bank-list__actions select { width: auto; padding: 0.4rem 0.6rem; }

/* ---------- Centre d'aide ---------- */
.topbar__help { color: var(--color-muted); font-weight: 600; text-decoration: none; padding: 0.35rem 0.5rem; }
.topbar__help:hover { color: var(--color-primary); }
.guide-list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.75rem; }
.guide-card { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem 1.25rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); color: var(--color-text); text-decoration: none; }
.guide-card:hover, .guide-card:focus-visible { border-color: var(--color-primary); }
.guide-card strong { display: block; color: var(--color-primary); font-size: 1.05rem; }
.guide-card__number { flex: 0 0 2rem; height: 2rem; border-radius: 50%; background: var(--color-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.help-layout { display: grid; gap: 1rem; }
.help-toc ol { margin: 0; padding-inline-start: 1.2rem; font-size: 0.92rem; }
.help-toc li { margin-bottom: 0.35rem; }
.help-toc a { color: var(--color-muted); text-decoration: none; }
.help-toc a[aria-current="page"] { color: var(--color-primary); font-weight: 700; }
.help-article h2 { font-size: 1.25rem; margin: 1.75rem 0 0.5rem; }
.help-article h2:first-child { margin-top: 0; }
.help-article ol, .help-article ul { padding-inline-start: 1.3rem; }
.help-article li { margin-bottom: 0.4rem; }
.help-shot { margin: 1rem 0 1.5rem; }
.help-shot img { display: block; max-width: 100%; height: auto; border: 1px solid var(--color-border); border-radius: 10px; box-shadow: var(--shadow); }
.help-shot figcaption { font-size: 0.85rem; color: var(--color-muted); margin-top: 0.4rem; }
.help-shot--phone img { max-width: 300px; }
.help-tip { padding: 0.75rem 1rem; background: #fff8ea; border-inline-start: 4px solid var(--color-accent); border-radius: 6px; font-size: 0.95rem; }
.help-pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--color-border); }
.faq details { padding: 0.6rem 0; border-bottom: 1px solid var(--color-border); }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 0.5rem 0 0; }
.help-link { font-size: 0.9rem; }

.legal { max-width: 820px; }
.legal h2 { font-size: 1.15rem; margin-top: 1.5rem; }
.footer a { color: var(--color-muted); }

/* ---------- Écrans plus larges ---------- */
@media (min-width: 640px) {
    h1 { font-size: 2rem; }
    .hero__title { font-size: 2.4rem; }
    .grid--2 { grid-template-columns: repeat(2, 1fr); }
    .stats--3 { grid-template-columns: repeat(3, 1fr); }
    .grid--3 { grid-template-columns: repeat(3, 1fr); }
    .features { grid-auto-flow: column; justify-content: center; gap: 2rem; }
    .topbar__user { display: inline; }
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .file-list__meta { align-items: flex-end; }
    .custom-row { grid-template-columns: 2fr 1fr; }
    .custom-row__wide { grid-column: 1 / -1; }
    .choice-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
    .help-layout { grid-template-columns: 240px 1fr; align-items: start; }
    .help-toc { position: sticky; top: 1rem; }
}

@media (min-width: 900px) {
    .form-grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Version imprimable ---------- */
.container--print { max-width: 820px; }
.print-page { background: var(--color-surface); }
.print-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.print-header { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; margin-bottom: 1.5rem; border-bottom: 2px solid var(--color-primary); }
.print-header .brand { margin: 0; font-size: 1.4rem; }
.print-header__meta { text-align: end; }
.print-disclaimer { margin-top: 2rem; }
.details--inputs { grid-template-columns: auto 1fr; }

@media print {
    @page { margin: 14mm; }
    .no-print, .topbar, .subnav, .footer, .schedule summary::marker { display: none !important; }
    body, .print-page { background: #fff; font-size: 11pt; }
    .container { padding: 0; }
    .card, .stat { box-shadow: none; }
    .stat--highlight, .breakdown, .legend__dot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .table { font-size: 9pt; }
    .simulation-result h3, .table tr { break-inside: avoid; }
    a { color: inherit; text-decoration: none; }
}


/* Double authentification */
.setup-steps { margin: 0 0 1rem; padding-inline-start: 1.4rem; }
.setup-steps li { margin-bottom: 0.4rem; }
.qr { display: inline-block; background: #fff; padding: 0.5rem; border: 1px solid var(--color-border); border-radius: 8px; }
.secret { font-size: 0.95rem; letter-spacing: 0.08em; word-break: break-all; }
.backup-codes { list-style: none; padding: 0; margin: 1rem 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.backup-codes code { display: block; text-align: center; padding: 0.45rem; border: 1px dashed var(--color-border); border-radius: 6px; font-size: 1rem; letter-spacing: 0.08em; }

/* Back office Oklé */
.grid--4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .grid--4 { grid-template-columns: repeat(4, 1fr); } }
.subnav--platform { background: #eef2f7; }
.brand__tag { display: inline-block; margin-inline-start: 0.4rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--color-primary); color: #fff; font-size: 0.75rem; font-weight: 700; vertical-align: middle; }

/* Mode démonstration */
.demo-banner { background: #fff4e0; color: #8a5a00; text-align: center; font-size: 0.9rem; font-weight: 600; padding: 0.45rem 1rem; border-bottom: 1px solid #f0dcb4; }
.demo-accounts { margin: 1rem 0; padding: 0.75rem 1rem; border: 1px dashed var(--color-border); border-radius: 8px; font-size: 0.9rem; }
.demo-accounts p { margin: 0 0 0.4rem; }
.demo-accounts ul { margin: 0; padding-inline-start: 1.1rem; }

/* Mot de passe : bouton pour afficher / masquer la saisie */
.password-field { position: relative; display: block; }
.password-field input { padding-inline-end: 3rem; }
.password-toggle { position: absolute; top: 50%; inset-inline-end: 0.35rem; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--color-muted); cursor: pointer; }
.password-toggle:hover { color: var(--color-primary); background: var(--color-bg); }
.password-toggle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.password-toggle svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Présentation de la plateforme (fenêtre en étapes) */
.tour { width: min(720px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; border: 0; border-radius: var(--radius); background: var(--color-surface); color: var(--color-text); box-shadow: 0 20px 60px rgb(16 24 40 / 30%); overflow: hidden; }
.tour::backdrop { background: rgb(15 30 45 / 55%); }
.tour__inner { position: relative; display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); }
.tour__close { position: absolute; top: 0.6rem; inset-inline-end: 0.6rem; z-index: 2; display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border: 0; border-radius: 999px; background: rgb(255 255 255 / 92%); color: var(--color-text); cursor: pointer; box-shadow: var(--shadow); }
.tour__close:hover { background: #fff; color: var(--color-primary); }
.tour__close:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.tour__step { display: flex; flex-direction: column; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.tour__step[hidden] { display: none; }
.tour__visual { flex: 0 0 auto; height: 220px; background: linear-gradient(160deg, #e3f0f3, #f5f7fa); border-bottom: 1px solid var(--color-border); display: flex; align-items: flex-start; justify-content: center; overflow: hidden; }
.tour__visual img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.tour__visual--phone { padding-top: 1.25rem; }
.tour__visual--phone img { width: 190px; height: auto; object-fit: initial; border: 6px solid #1c2530; border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: var(--shadow); }
.tour__icon { width: 150px; height: 150px; margin: auto; }
.tour__icon-bg { fill: #fff; }
.tour__icon-shape { fill: var(--color-primary); }
.tour__icon-line { fill: none; stroke: var(--color-primary); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.tour__icon-check { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.tour__icon-accent { fill: var(--color-accent); }
.tour__body { padding: 1.25rem 1.5rem 0.5rem; }
@media (min-width: 640px) { .tour__body { min-height: 15.5rem; } }
.tour__count { margin: 0 0 0.35rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-primary); }
.tour__body h2 { font-size: 1.35rem; margin-bottom: 0.4rem; }
.tour__body > p { color: var(--color-muted); margin-bottom: 0.75rem; }
.tour__points { list-style: none; margin: 0; padding: 0; }
.tour__points li { position: relative; padding-inline-start: 1.6rem; margin-bottom: 0.5rem; }
.tour__points li::before { content: ""; position: absolute; inset-inline-start: 0.1rem; top: 0.35rem; width: 0.9rem; height: 0.9rem; border-radius: 999px; background: var(--color-success-bg); box-shadow: inset 0 0 0 2px var(--color-success); }
.tour__footer { flex: 0 0 auto; display: grid; grid-template-columns: auto 1fr; gap: 0.75rem; align-items: center; padding: 0.9rem 1.5rem 1.1rem; border-top: 1px solid var(--color-border); background: var(--color-surface); }
.tour__dots { grid-column: 1 / -1; display: flex; gap: 0.4rem; justify-content: center; }
.tour__dot { width: 0.55rem; height: 0.55rem; border-radius: 999px; background: var(--color-border); transition: width 0.2s, background 0.2s; }
.tour__dot.is-active { width: 1.4rem; background: var(--color-primary); }
.tour__skip { justify-self: start; padding: 0.55rem 0.75rem; border: 0; border-radius: 8px; background: none; color: var(--color-muted); font: inherit; font-weight: 600; cursor: pointer; }
.tour__skip:hover, .tour__skip:focus-visible { background: var(--color-bg); color: var(--color-text); }
.tour__skip.is-hidden { visibility: hidden; }
.tour__hint { grid-column: 1 / -1; order: 4; display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin: 0; font-size: 0.8rem; color: var(--color-muted); text-align: center; }
.tour__actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
.tour__actions .btn { flex: 1 1 0; }
@media (min-width: 640px) {
    .tour__visual { height: 280px; }
    .tour__footer { grid-template-columns: auto 1fr auto; }
    .tour__dots { order: 2; grid-column: auto; }
    .tour__skip { order: 1; }
    .tour__actions { order: 3; }
    .tour__actions .btn { flex: 0 0 auto; }
}
@media (max-width: 639px) {
    .tour { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
    .tour__inner { height: 100dvh; max-height: 100dvh; }
}
@media (prefers-reduced-motion: reduce) {
    .tour__dot { transition: none; }
}

/* Suivi du dossier (workflow) */
.workflow__steps { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; gap: 0.25rem; overflow-x: auto; }
.workflow__step { flex: 1 0 5.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; text-align: center; font-size: 0.78rem; color: var(--color-muted); position: relative; padding-top: 0.1rem; }
.workflow__step::before { content: ""; position: absolute; top: 0.95rem; inset-inline-start: -50%; inset-inline-end: 50%; height: 2px; background: var(--color-border); z-index: 0; }
.workflow__step:first-child::before { display: none; }
.workflow__step--done::before, .workflow__step--current::before, .workflow__step--stopped::before { background: var(--color-primary); }
.workflow__dot { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem; border-radius: 999px; border: 2px solid var(--color-border); background: var(--color-surface); font-weight: 700; font-size: 0.8rem; }
.workflow__step--done .workflow__dot { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.workflow__step--current .workflow__dot { border-color: var(--color-primary); color: var(--color-primary); box-shadow: 0 0 0 4px #e3f0f3; }
.workflow__step--current .workflow__label { color: var(--color-text); font-weight: 700; }
.workflow__step--stopped .workflow__dot { background: #eceff3; border-color: #5b6776; color: #5b6776; }
.workflow__now { font-weight: 600; }
.workflow__dates { margin-bottom: 1rem; }
.workflow__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.workflow__actions form { margin: 0; }
.btn--danger { background: var(--color-error); color: #fff; }
.btn--danger:hover { background: #861c16; }
.btn--ghost.btn--danger { background: transparent; color: var(--color-error); border-color: var(--color-border); }
.btn--ghost.btn--danger:hover { background: var(--color-error-bg); }

/* Tableau de bord : dossiers par étape */
.pipeline { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: 0.5rem; }
.pipeline__stage { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.6rem 0.75rem; border: 1px solid var(--color-border); border-radius: 10px; text-decoration: none; color: var(--color-text); background: var(--color-surface); height: 100%; }
.pipeline__stage:hover { border-color: var(--color-primary); }
.pipeline__stage--empty { color: var(--color-muted); }
.pipeline__count { font-size: 1.4rem; font-weight: 800; color: var(--color-primary); line-height: 1.1; }
.pipeline__stage--empty .pipeline__count { color: var(--color-muted); }
.pipeline__label { font-size: 0.82rem; }
.pipeline__fees { margin: 0; font-size: 0.95rem; }
/* Frise du client : 6 étapes, sans défilement sur téléphone */
.workflow__steps--client { gap: 0; }
.workflow__steps--client .workflow__step { flex: 1 1 0; min-width: 0; font-size: 0.7rem; }
.workflow__steps--client .workflow__label { line-height: 1.25; }
@media (max-width: 560px) {
    /* Téléphone : seul le libellé de l'étape en cours est affiché (les autres restent lus par les lecteurs d'écran). */
    .workflow__steps--client .workflow__step:not([aria-current]) .workflow__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .workflow__steps--client .workflow__step[aria-current] .workflow__label { white-space: nowrap; overflow: visible; }
}
@media (max-width: 480px) {
    .workflow__step { flex-basis: 4.6rem; font-size: 0.72rem; }
    .workflow__dot { width: 1.7rem; height: 1.7rem; }
}

/* Agenda */
.cal-toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.cal-nav { display: flex; gap: 0.35rem; }
.cal-views { margin: 0; }
.cal-filter select { width: auto; min-width: 12rem; padding: 0.45rem 0.7rem; }
.cal-period { margin: 0; }
.cal-scroll { overflow-x: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; }
.cal-grid { display: grid; min-width: 100%; }
.cal-grid--7 { grid-template-columns: 3.5rem repeat(7, minmax(7.5rem, 1fr)); min-width: 58rem; }
.cal-grid--1 { grid-template-columns: 3.5rem 1fr; }
.cal-corner, .cal-allday-label { border-bottom: 1px solid var(--color-border); }
.cal-allday-label { font-size: 0.7rem; color: var(--color-muted); padding: 0.35rem 0.3rem; text-align: end; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.25rem; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--color-border); border-inline-start: 1px solid var(--color-border); }
.cal-head a { text-decoration: none; color: var(--color-text); }
.cal-head__name { font-size: 0.8rem; color: var(--color-muted); margin-inline-end: 0.3rem; }
.cal-head__number { font-weight: 800; font-size: 1.1rem; }
.cal-head--today .cal-head__number { display: inline-flex; align-items: center; justify-content: center; min-width: 1.9rem; height: 1.9rem; border-radius: 999px; background: var(--color-primary); color: #fff; }
.cal-head__add { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 999px; color: var(--color-primary) !important; font-weight: 700; }
.cal-head__add:hover { background: #e3f0f3; }
.cal-allday { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.25rem; border-bottom: 1px solid var(--color-border); border-inline-start: 1px solid var(--color-border); min-height: 2rem; }
.cal-hours { display: grid; grid-template-rows: repeat(56, 1.1rem); }
.cal-hour { grid-row-end: span 4; font-size: 0.7rem; color: var(--color-muted); text-align: end; padding: 0 0.35rem; transform: translateY(-0.45rem); }
.cal-hour:first-child { transform: none; }
.cal-day { display: grid; grid-template-rows: repeat(56, 1.1rem); grid-template-columns: 100%; border-inline-start: 1px solid var(--color-border); background-image: linear-gradient(var(--color-border) 1px, transparent 1px); background-size: 100% 4.4rem; position: relative; }
.cal-day--today { background-color: #f7fbfc; }
.cal-slot { grid-column: 1; padding: 1px 2px; min-width: 0; z-index: 1; }
.cal-slot .cal-item { height: 100%; overflow: hidden; }
.cal-slot.r1 { grid-row-start: 1; }
.cal-slot.r2 { grid-row-start: 2; }
.cal-slot.r3 { grid-row-start: 3; }
.cal-slot.r4 { grid-row-start: 4; }
.cal-slot.r5 { grid-row-start: 5; }
.cal-slot.r6 { grid-row-start: 6; }
.cal-slot.r7 { grid-row-start: 7; }
.cal-slot.r8 { grid-row-start: 8; }
.cal-slot.r9 { grid-row-start: 9; }
.cal-slot.r10 { grid-row-start: 10; }
.cal-slot.r11 { grid-row-start: 11; }
.cal-slot.r12 { grid-row-start: 12; }
.cal-slot.r13 { grid-row-start: 13; }
.cal-slot.r14 { grid-row-start: 14; }
.cal-slot.r15 { grid-row-start: 15; }
.cal-slot.r16 { grid-row-start: 16; }
.cal-slot.r17 { grid-row-start: 17; }
.cal-slot.r18 { grid-row-start: 18; }
.cal-slot.r19 { grid-row-start: 19; }
.cal-slot.r20 { grid-row-start: 20; }
.cal-slot.r21 { grid-row-start: 21; }
.cal-slot.r22 { grid-row-start: 22; }
.cal-slot.r23 { grid-row-start: 23; }
.cal-slot.r24 { grid-row-start: 24; }
.cal-slot.r25 { grid-row-start: 25; }
.cal-slot.r26 { grid-row-start: 26; }
.cal-slot.r27 { grid-row-start: 27; }
.cal-slot.r28 { grid-row-start: 28; }
.cal-slot.r29 { grid-row-start: 29; }
.cal-slot.r30 { grid-row-start: 30; }
.cal-slot.r31 { grid-row-start: 31; }
.cal-slot.r32 { grid-row-start: 32; }
.cal-slot.r33 { grid-row-start: 33; }
.cal-slot.r34 { grid-row-start: 34; }
.cal-slot.r35 { grid-row-start: 35; }
.cal-slot.r36 { grid-row-start: 36; }
.cal-slot.r37 { grid-row-start: 37; }
.cal-slot.r38 { grid-row-start: 38; }
.cal-slot.r39 { grid-row-start: 39; }
.cal-slot.r40 { grid-row-start: 40; }
.cal-slot.r41 { grid-row-start: 41; }
.cal-slot.r42 { grid-row-start: 42; }
.cal-slot.r43 { grid-row-start: 43; }
.cal-slot.r44 { grid-row-start: 44; }
.cal-slot.r45 { grid-row-start: 45; }
.cal-slot.r46 { grid-row-start: 46; }
.cal-slot.r47 { grid-row-start: 47; }
.cal-slot.r48 { grid-row-start: 48; }
.cal-slot.r49 { grid-row-start: 49; }
.cal-slot.r50 { grid-row-start: 50; }
.cal-slot.r51 { grid-row-start: 51; }
.cal-slot.r52 { grid-row-start: 52; }
.cal-slot.r53 { grid-row-start: 53; }
.cal-slot.r54 { grid-row-start: 54; }
.cal-slot.r55 { grid-row-start: 55; }
.cal-slot.r56 { grid-row-start: 56; }
.cal-slot.s1 { grid-row-end: span 1; }
.cal-slot.s2 { grid-row-end: span 2; }
.cal-slot.s3 { grid-row-end: span 3; }
.cal-slot.s4 { grid-row-end: span 4; }
.cal-slot.s5 { grid-row-end: span 5; }
.cal-slot.s6 { grid-row-end: span 6; }
.cal-slot.s7 { grid-row-end: span 7; }
.cal-slot.s8 { grid-row-end: span 8; }
.cal-slot.s9 { grid-row-end: span 9; }
.cal-slot.s10 { grid-row-end: span 10; }
.cal-slot.s11 { grid-row-end: span 11; }
.cal-slot.s12 { grid-row-end: span 12; }
.cal-slot.s13 { grid-row-end: span 13; }
.cal-slot.s14 { grid-row-end: span 14; }
.cal-slot.s15 { grid-row-end: span 15; }
.cal-slot.s16 { grid-row-end: span 16; }
.cal-slot.s17 { grid-row-end: span 17; }
.cal-slot.s18 { grid-row-end: span 18; }
.cal-slot.s19 { grid-row-end: span 19; }
.cal-slot.s20 { grid-row-end: span 20; }
.cal-slot.s21 { grid-row-end: span 21; }
.cal-slot.s22 { grid-row-end: span 22; }
.cal-slot.s23 { grid-row-end: span 23; }
.cal-slot.s24 { grid-row-end: span 24; }
.cal-slot.s25 { grid-row-end: span 25; }
.cal-slot.s26 { grid-row-end: span 26; }
.cal-slot.s27 { grid-row-end: span 27; }
.cal-slot.s28 { grid-row-end: span 28; }
.cal-slot.s29 { grid-row-end: span 29; }
.cal-slot.s30 { grid-row-end: span 30; }
.cal-slot.s31 { grid-row-end: span 31; }
.cal-slot.s32 { grid-row-end: span 32; }
.cal-slot.s33 { grid-row-end: span 33; }
.cal-slot.s34 { grid-row-end: span 34; }
.cal-slot.s35 { grid-row-end: span 35; }
.cal-slot.s36 { grid-row-end: span 36; }
.cal-slot.s37 { grid-row-end: span 37; }
.cal-slot.s38 { grid-row-end: span 38; }
.cal-slot.s39 { grid-row-end: span 39; }
.cal-slot.s40 { grid-row-end: span 40; }
.cal-slot.s41 { grid-row-end: span 41; }
.cal-slot.s42 { grid-row-end: span 42; }
.cal-slot.s43 { grid-row-end: span 43; }
.cal-slot.s44 { grid-row-end: span 44; }
.cal-slot.s45 { grid-row-end: span 45; }
.cal-slot.s46 { grid-row-end: span 46; }
.cal-slot.s47 { grid-row-end: span 47; }
.cal-slot.s48 { grid-row-end: span 48; }
.cal-slot.s49 { grid-row-end: span 49; }
.cal-slot.s50 { grid-row-end: span 50; }
.cal-slot.s51 { grid-row-end: span 51; }
.cal-slot.s52 { grid-row-end: span 52; }
.cal-slot.s53 { grid-row-end: span 53; }
.cal-slot.s54 { grid-row-end: span 54; }
.cal-slot.s55 { grid-row-end: span 55; }
.cal-slot.s56 { grid-row-end: span 56; }
.cal-slot.l0-1 { width: 100%; margin-inline-start: 0; }
.cal-slot.l0-2 { width: calc(100% / 2); margin-inline-start: 0; }
.cal-slot.l1-2 { width: calc(100% / 2); margin-inline-start: calc(100% * 1 / 2); }
.cal-slot.l0-3 { width: calc(100% / 3); margin-inline-start: 0; }
.cal-slot.l1-3 { width: calc(100% / 3); margin-inline-start: calc(100% * 1 / 3); }
.cal-slot.l2-3 { width: calc(100% / 3); margin-inline-start: calc(100% * 2 / 3); }
.cal-slot.l0-4 { width: calc(100% / 4); margin-inline-start: 0; }
.cal-slot.l1-4 { width: calc(100% / 4); margin-inline-start: calc(100% * 1 / 4); }
.cal-slot.l2-4 { width: calc(100% / 4); margin-inline-start: calc(100% * 2 / 4); }
.cal-slot.l3-4 { width: calc(100% / 4); margin-inline-start: calc(100% * 3 / 4); }
.cal-item { display: flex; flex-direction: column; gap: 0.05rem; padding: 0.2rem 0.4rem; border-radius: 6px; border-inline-start: 3px solid; font-size: 0.78rem; line-height: 1.25; text-decoration: none; color: var(--color-text); min-width: 0; }
.cal-item:hover { filter: brightness(0.97); }
.cal-item__time { font-weight: 700; font-size: 0.72rem; }
.cal-item__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.cal-item__meta { color: var(--color-muted); font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-t-prospect { --cal-bg: #fff4e0; --cal-c: #d98a14; }
.cal-t-client { --cal-bg: #e3f0f3; --cal-c: #0f5c6e; }
.cal-t-bank { --cal-bg: #efe8ff; --cal-c: #6c4ad0; }
.cal-t-notary { --cal-bg: #e6f4ea; --cal-c: #1e6b34; }
.cal-t-internal { --cal-bg: #e6ecff; --cal-c: #2f4aa0; }
.cal-t-other { --cal-bg: #eceff3; --cal-c: #5b6776; }
.cal-t-busy { --cal-bg: #eceff3; --cal-c: #8a94a3; }
.cal-t-deadline { --cal-bg: #fdecea; --cal-c: #a4231b; }
.cal-item { background: var(--cal-bg, #eef2f7); border-color: var(--cal-c, #5b6776); }
.cal-item.cal-t-busy { background: repeating-linear-gradient(135deg, #eceff3, #eceff3 6px, #e2e6eb 6px, #e2e6eb 12px); color: #3d4754; }
.cal-item.cal-t-deadline { border-inline-start-style: dashed; }
.cal-dot { background: var(--cal-c, #5b6776); border: 0; }
.cal-item--compact { flex-direction: row; gap: 0.3rem; white-space: nowrap; }
.cal-legend { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.85rem; color: var(--color-muted); }
.cal-legend li { display: inline-flex; align-items: center; gap: 0.35rem; }
.cal-dot { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 3px; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; box-shadow: var(--shadow); }
.cal-month__name { padding: 0.4rem; font-size: 0.8rem; color: var(--color-muted); text-align: center; border-bottom: 1px solid var(--color-border); }
.cal-month__day { min-height: 6.5rem; padding: 0.3rem; border-inline-end: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.cal-month__day:nth-child(7n) { border-inline-end: 0; }
.cal-month__day--out { background: #f8f9fb; }
.cal-month__day--out .cal-month__number { color: #9aa3ae; }
.cal-month__number { font-weight: 700; font-size: 0.85rem; text-decoration: none; color: var(--color-text); align-self: flex-start; padding: 0 0.25rem; border-radius: 999px; }
.cal-month__day--today .cal-month__number { background: var(--color-primary); color: #fff; }
.cal-month .cal-item { padding: 0.1rem 0.3rem; font-size: 0.72rem; flex-direction: row; gap: 0.3rem; white-space: nowrap; overflow: hidden; }
.cal-month__more { font-size: 0.75rem; }
@media (max-width: 640px) { .cal-month__day { min-height: 4.5rem; } .cal-month .cal-item__title { display: none; } .cal-month .cal-item { justify-content: center; } .cal-month .cal-t-deadline .cal-item__title { display: inline; } }
.cal-list { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.cal-list__day h2 { font-size: 1rem; }
.cal-list__day h2 a { color: var(--color-text); text-decoration: none; }
.cal-list__day--today { border-color: var(--color-primary); }
.cal-list__day ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.cal-list .cal-item { font-size: 0.9rem; flex-direction: row; flex-wrap: wrap; gap: 0.2rem 0.6rem; padding: 0.45rem 0.6rem; }
.cal-list .cal-item__meta { flex-basis: 100%; white-space: normal; }

.stack { display: grid; gap: 0.5rem; justify-items: start; }
.stack form { margin: 0; }
.feed-url { display: block; padding: 0.6rem 0.75rem; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 8px; font-size: 0.85rem; word-break: break-all; }
.appointment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.appointment-list li { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.appointment-list--client li { display: grid; gap: 0.1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--color-border); }
.appointment-list--client li:last-child { border-bottom: 0; }

/* Versements d'honoraires (suivi du dossier). */
.fee-payments { list-style: none; margin: 0 0 0.75rem; padding: 0; display: grid; gap: 0.25rem; }
.fee-payments li { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; padding: 0.25rem 0; border-bottom: 1px solid var(--color-border); }
.fee-payments li:last-child { border-bottom: 0; }

/* Coordonnées du cabinet (back office). */
.agency-contact { margin: 0.25rem 0 0; display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

/* ---------- Champs obligatoires ---------- */
.required-mark { color: var(--color-error); font-weight: 700; }
.form__required-note { font-size: 0.85rem; color: var(--color-muted); margin: 0 0 1rem; }

/* ---------- Téléphone : pays + numéro ---------- */
.phone-input { position: relative; display: flex; gap: 0.5rem; align-items: stretch; }
.phone-input > select { flex: 0 0 11rem; width: 11rem; }
.phone-input > input { flex: 1 1 auto; min-width: 0; }
.phone-input.is-enhanced > select { display: none; }
.phone-input__trigger {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 0.7rem;
    font: inherit;
    font-size: 16px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
}
.phone-input__trigger::after { content: ""; border: 5px solid transparent; border-top-color: var(--color-muted); margin-top: 5px; }
.phone-input__trigger:focus-visible { border-color: var(--color-primary); outline: 2px solid rgb(15 92 110 / 20%); }
.phone-input__flag { width: 24px; height: 18px; border-radius: 2px; box-shadow: 0 0 0 1px rgb(0 0 0 / 8%); object-fit: cover; flex: 0 0 auto; }
.phone-input__panel {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    inset-inline-start: 0;
    width: min(22rem, 100%);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 0.5rem;
}
.phone-input__search { margin-bottom: 0.4rem; }
.phone-input__list { list-style: none; margin: 0; padding: 0; max-height: 16rem; overflow-y: auto; }
.phone-input__list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.5rem; border-radius: 6px; cursor: pointer; }
.phone-input__list li:hover, .phone-input__list li.is-active { background: #e3f0f3; }
.phone-input__name { flex: 1 1 auto; }
.phone-input__dial { color: var(--color-muted); font-variant-numeric: tabular-nums; }
.phone-input__empty { margin: 0.4rem 0.5rem; color: var(--color-muted); font-size: 0.9rem; }

/* ---------- Adresses ---------- */
.address__grid { display: grid; grid-template-columns: minmax(7rem, 10rem) 1fr 1fr; gap: 0 1rem; }
@media (max-width: 640px) {
    .address__grid { grid-template-columns: 1fr; }
}
.suggest { position: relative; }
.suggest__list {
    position: absolute;
    z-index: 30;
    inset-inline-start: 0;
    inset-inline-end: 0;
    top: 100%;
    margin: 4px 0 0;
    padding: 0.3rem;
    list-style: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-height: 16rem;
    overflow-y: auto;
}
.suggest__list li { padding: 0.5rem 0.6rem; border-radius: 6px; cursor: pointer; }
.suggest__list li:hover, .suggest__list li.is-active { background: #e3f0f3; }
.phone-input__list li.is-first-of-all { margin-top: 0.3rem; border-top: 1px solid var(--color-border); border-radius: 0 0 6px 6px; padding-top: 0.6rem; }
.choices-inline { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; }

/* ==========================================================================
   Refonte de l'interface (2026) : barre latérale, couleurs teal + corail,
   composants harmonisés. Placée en fin de fichier : elle complète et
   remplace les styles précédents.
   ========================================================================== */

body { font-size: 15.5px; letter-spacing: -0.005em; }
h1 { font-size: 1.55rem; font-weight: 750; letter-spacing: -0.02em; }
h2 { font-size: 1.12rem; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 1rem; }
a { color: var(--color-primary); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid rgb(255 122 89 / 55%); outline-offset: 2px; }

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }
.icon--sm { width: 1em; height: 1em; vertical-align: -0.15em; }
.icon--lg { width: 1.6em; height: 1.6em; }

.skip-link { position: absolute; inset-inline-start: -999px; top: 0.5rem; z-index: 100; padding: 0.5rem 1rem; background: var(--color-surface); border-radius: 8px; box-shadow: var(--shadow-lg); }
.skip-link:focus { inset-inline-start: 0.5rem; }

/* ---------- Marque ---------- */
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-size: 1.25rem; }
.brand__mark {
    display: inline-grid; place-items: center;
    width: 2rem; height: 2rem; border-radius: 10px;
    background: linear-gradient(135deg, var(--color-accent), #ffb35c);
    color: #fff; font-weight: 800; font-size: 1.05rem; box-shadow: 0 3px 8px rgb(255 122 89 / 35%);
}
.brand--light { color: #fff; }
.brand__tag { background: var(--color-accent); }

/* ---------- Coquille : barre latérale + contenu ---------- */
.has-shell { display: block; }
.app { display: flex; min-height: 100vh; }
.app__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app__main .container { max-width: 1240px; padding: 1.5rem 1rem 6rem; }

.sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60;
    width: min(86vw, var(--sidebar-width));
    display: flex; flex-direction: column; gap: 0.75rem;
    padding: 1rem 0.75rem;
    background: linear-gradient(180deg, #0b3f4c 0%, #0f5c6e 100%);
    color: #d6eaef;
    transform: translateX(-105%);
    transition: transform 0.2s ease, width 0.2s ease;
    overflow-y: auto;
}
.sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 55; background: rgb(11 30 38 / 45%); }
.sidebar__brand { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.5rem 0.5rem; }
.sidebar__brand .brand { text-decoration: none; }
.sidebar__close { margin-inline-start: auto; background: none; border: 0; color: #fff; padding: 0.35rem; border-radius: 8px; cursor: pointer; }
.sidebar__cta {
    display: flex; align-items: center; gap: 0.6rem;
    margin: 0 0.25rem; padding: 0.7rem 0.9rem; border-radius: 12px;
    background: var(--color-accent); color: #2b1208; font-weight: 700; text-decoration: none;
    box-shadow: 0 6px 16px rgb(255 122 89 / 30%);
}
.sidebar__cta:hover { background: #ff8d70; }
.sidenav__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sidenav__heading { margin: 1rem 0.9rem 0.35rem; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #8fc1cc; }
.sidenav__link {
    position: relative; display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 0.9rem; border-radius: 10px;
    color: #d6eaef; text-decoration: none; font-weight: 600; font-size: 0.95rem;
}
.sidenav__link:hover { background: rgb(255 255 255 / 8%); color: #fff; }
.sidenav__link[aria-current="page"] { background: rgb(255 255 255 / 14%); color: #fff; }
.sidenav__link[aria-current="page"]::before { content: ""; position: absolute; inset-inline-start: -0.75rem; top: 20%; bottom: 20%; width: 4px; border-start-end-radius: 4px; border-end-end-radius: 4px; background: var(--color-accent); }
.sidebar__footer { margin-top: auto; padding-top: 0.75rem; border-top: 1px solid rgb(255 255 255 / 12%); }
.sidebar__collapse { display: none; }

@media (min-width: 1024px) {
    .sidebar { position: sticky; top: 0; height: 100vh; transform: none; width: var(--sidebar-width); flex: none; }
    .sidebar__close, .sidebar-backdrop, .appbar__menu { display: none !important; }
    .sidebar__collapse {
        display: inline-grid; place-items: center; margin: 0.5rem 0 0; margin-inline-start: 0.5rem;
        width: 2rem; height: 2rem; border-radius: 8px; border: 1px solid rgb(255 255 255 / 20%);
        background: transparent; color: #d6eaef; cursor: pointer;
    }
    .sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
    .sidebar-collapsed .sidenav__label, .sidebar-collapsed .brand__name, .sidebar-collapsed .brand__tag, .sidebar-collapsed .sidenav__heading { display: none; }
    .sidebar-collapsed .sidenav__link, .sidebar-collapsed .sidebar__cta { justify-content: center; padding-inline: 0; }
    .sidebar-collapsed .sidebar__collapse .icon { transform: rotate(180deg); }
    .app__main .container { padding: 2rem 2rem 3rem; }
}

/* ---------- Barre du haut (espace courtier) ---------- */
.appbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: rgb(255 255 255 / 88%); backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--color-border);
}
.appbar__menu, .icon-btn {
    display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: none;
    border-radius: 10px; border: 1px solid var(--color-border); background: var(--color-surface);
    color: var(--color-text); cursor: pointer; text-decoration: none;
}
.icon-btn:hover, .appbar__menu:hover { background: var(--color-bg); }
.appbar__title { font-weight: 700; color: var(--color-muted); }
.appbar__actions { margin-inline-start: auto; display: flex; align-items: center; gap: 0.5rem; }


.search { position: relative; flex: 1 1 auto; max-width: 560px; }
.search__icon { position: absolute; inset-inline-start: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--color-muted); pointer-events: none; }
.search input[type="search"] {
    padding: 0.6rem 2.5rem 0.6rem 2.5rem; border-radius: 12px; background: var(--color-bg); border-color: transparent;
}
.search input[type="search"]:focus { background: var(--color-surface); border-color: var(--color-primary); }
.search__kbd { position: absolute; inset-inline-end: 0.7rem; top: 50%; transform: translateY(-50%); padding: 0 0.4rem; border: 1px solid var(--color-border); border-radius: 6px; font-size: 0.75rem; color: var(--color-muted); background: var(--color-surface); }
@media (max-width: 719px) { .search__kbd { display: none; } }
.search__results {
    position: absolute; inset-inline-start: 0; inset-inline-end: 0; top: calc(100% + 6px); z-index: 50;
    margin: 0; padding: 0.35rem; list-style: none;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; box-shadow: var(--shadow-lg);
    max-height: 70vh; overflow-y: auto;
}
.search__results a { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.65rem; border-radius: 8px; color: inherit; text-decoration: none; }
.search__results a:hover, .search__results li.is-active a { background: var(--color-primary-50); }
.search__results .search__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.search__results .search__main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search__empty { padding: 0.75rem; color: var(--color-muted); }

.avatar { display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--color-text); font-weight: 600; }
.avatar__initials {
    display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), #1b8aa3); color: #fff; font-size: 0.85rem; font-weight: 700;
}
.avatar__name { display: none; }
@media (min-width: 900px) { .avatar__name { display: inline; } }

/* ---------- Barre du bas (mobile, courtier) ---------- */
.bottomnav {
    position: fixed; inset: auto 0 0 0; z-index: 45;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom));
    background: rgb(255 255 255 / 96%); border-top: 1px solid var(--color-border);
    backdrop-filter: blur(10px);
}
.bottomnav a, .bottomnav button {
    display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
    padding: 0.3rem 0; font: inherit; font-size: 0.7rem; font-weight: 600;
    color: var(--color-muted); text-decoration: none; background: none; border: 0; cursor: pointer;
}
.bottomnav .icon { width: 1.4rem; height: 1.4rem; }
.bottomnav [aria-current="page"] { color: var(--color-primary); }
.bottomnav__new .icon { width: 2.6rem; height: 2.6rem; padding: 0.55rem; margin-top: -1.1rem; border-radius: 50%; background: var(--color-accent); color: #2b1208; box-shadow: 0 6px 14px rgb(255 122 89 / 45%); }
@media (min-width: 1024px) { .bottomnav { display: none; } }

/* ---------- Barre du haut (client, pages publiques) ---------- */
.topbar { background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.topbar__inner { max-width: 1100px; }
.topbar .brand { color: var(--color-primary); }
.topbar__help { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--color-muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.topbar__help > span:not([data-unread-badge]) { display: none; }
@media (min-width: 640px) { .topbar__help > span:not([data-unread-badge]) { display: inline; } }
.topbar .btn__label { display: none; }
@media (min-width: 640px) { .topbar .btn__label { display: inline; } }
.topbar .avatar__name { display: none; }
@media (min-width: 640px) { .topbar .avatar__name { display: inline; } }

.demo-banner { display: flex; align-items: center; justify-content: center; gap: 0.4rem; background: linear-gradient(90deg, #fff4e0, #ffe9e1); border-bottom: 1px solid #f6dcc8; }
.footer { font-size: 0.8rem; }

/* ---------- Titres de page ---------- */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin-bottom: 0.25rem; }
.page-header p { margin-bottom: 0.25rem; }
.page-header > p:first-child a, .back-link { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.eyebrow { display: inline-block; margin-bottom: 0.35rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-accent-strong); }

/* ---------- Cartes ---------- */
.card { border-color: var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.35rem; margin-bottom: 1.25rem; }
.grid > .card { margin-bottom: 0; }
.card__header { margin-bottom: 1rem; }
.card__title { display: flex; align-items: center; gap: 0.6rem; margin: 0; }
.card__title .icon-chip { margin-inline-end: 0.1rem; }
.card--note { background: #fffaf0; border-color: #f6e3bd; }
.icon-chip {
    display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none;
    border-radius: 10px; background: var(--color-primary-50); color: var(--color-primary);
}
.icon-chip--accent { background: var(--color-accent-50); color: var(--color-accent-strong); }
.icon-chip--violet { background: #efedff; color: #5b4bd6; }
.icon-chip--blue { background: #e8f1fe; color: #1f6fd6; }
.icon-chip--amber { background: #fff4e0; color: #b7791f; }
.icon-chip--green { background: #e3f6ea; color: #1d7a45; }
.icon-chip--red { background: #fdecea; color: #b42318; }

/* ---------- Boutons ---------- */
.btn { gap: 0.45rem; border-radius: 10px; font-weight: 650; transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--color-primary); box-shadow: 0 2px 6px rgb(15 92 110 / 25%); }
.btn--primary:hover { background: var(--color-primary-dark); }
.btn--accent { background: var(--color-accent); color: #2b1208; box-shadow: 0 4px 12px rgb(255 122 89 / 35%); }
.btn--accent:hover { background: #ff8d70; }
.btn--secondary { border-color: var(--color-primary-100); background: var(--color-primary-50); color: var(--color-primary-dark); }
.btn--secondary:hover { background: var(--color-primary-100); }
.btn--ghost { background: var(--color-surface); }
.btn--danger { background: var(--color-error); color: #fff; }
.btn .icon { width: 1.1em; height: 1.1em; }

/* ---------- Champs ---------- */
input[type="email"], input[type="password"], input[type="text"], input[type="tel"], input[type="search"], input[type="number"], input[type="url"], input[type="date"], input[type="datetime-local"], input[type="time"], select, textarea {
    border-radius: 10px; border-color: #d5dde6; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 4px rgb(15 92 110 / 12%); }
label { font-weight: 650; font-size: 0.92rem; }
.fieldset legend { font-size: 0.95rem; }

/* ---------- Alertes ---------- */
.alert { display: flex; align-items: flex-start; gap: 0.6rem; border-radius: 12px; border: 1px solid transparent; }
.alert__icon { margin-top: 0.1rem; }
.alert--success { border-color: #bfe6cd; }
.alert--error { border-color: #f6c8c3; }
.alert--warning { background: var(--color-warning-bg); color: var(--color-warning); border-color: #f5dcae; }

/* ---------- Badges des étapes (pastille colorée) ---------- */
.badge { position: relative; padding-block: 0.2rem; padding-inline: 1.35rem 0.65rem; font-weight: 650; }
.badge::before { content: ""; position: absolute; inset-inline-start: 0.55rem; top: 50%; width: 0.45rem; height: 0.45rem; margin-top: -0.225rem; border-radius: 50%; background: currentColor; }
.badge--prospect { background: #eef1f5; color: #475569; }
.badge--collecting { background: #fff4e0; color: #9a5b00; }
.badge--complete { background: #e8f1fe; color: #1f5fbf; }
.badge--submitted_to_banks { background: #efedff; color: #5343c9; }
.badge--offer_received { background: #e0f6f5; color: #0b7574; }
.badge--offer_accepted { background: #eceafe; color: #4338ca; }
.badge--awaiting_funds { background: #e3f2fb; color: #0369a1; }
.badge--fees_due { background: #fff0e3; color: #b4570f; }
.badge--closed_success { background: #e3f6ea; color: #1d7a45; }
.badge--closed_failure { background: #f1f4f8; color: #64748b; }
.pill { font-weight: 650; }

/* ---------- Statistiques ---------- */
.stat { position: relative; overflow: hidden; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; gap: 0.15rem; }
.stat__value { font-size: 1.9rem; letter-spacing: -0.02em; }
a.stat:hover { border-color: var(--color-primary-100); box-shadow: var(--shadow-lg); }

/* ---------- Tableaux et listes ---------- */
.table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); }
.file-list__link { border-radius: 10px; padding: 0.85rem 0.75rem; }
.file-list__link:hover { background: var(--color-primary-50); }

/* ---------- Tableau de bord « À faire » ---------- */
.dash-hero {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1.4rem 1.5rem; margin-bottom: 1.25rem; border-radius: 18px; color: #fff;
    background: radial-gradient(120% 140% at 100% 0%, #ff9f7f 0%, rgb(255 159 127 / 0%) 45%), linear-gradient(120deg, #0b3f4c, #0f5c6e 55%, #16788f);
    box-shadow: var(--shadow-lg);
}
.dash-hero h1 { margin: 0 0 0.2rem; color: #fff; }
.dash-hero p { margin: 0; color: #cfe7ec; }
.dash-hero a { color: #fff; }
.kpis { display: grid; gap: 0.75rem; grid-template-columns: repeat(2, 1fr); margin-bottom: 1.25rem; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { display: flex; align-items: center; gap: 0.85rem; padding: 1rem 1.1rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: inherit; }
a.kpi:hover { box-shadow: var(--shadow-lg); border-color: var(--color-primary-100); }
.kpi__value { display: block; font-size: 1.55rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.kpi__label { display: block; font-size: 0.85rem; color: var(--color-muted); }
.kpi--alert { border-color: #ffc9b8; background: linear-gradient(180deg, #fff, var(--color-accent-50)); }

.dash-grid { display: grid; gap: 1.25rem; }
@media (min-width: 1280px) { .dash-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo { display: flex; align-items: center; gap: 0.85rem; padding: 0.8rem 0.25rem; }
.todo + .todo { border-top: 1px solid var(--color-border); }
.todo__body { flex: 1; min-width: 0; }
.todo__title { display: block; font-weight: 650; }
.todo__meta { display: block; font-size: 0.85rem; color: var(--color-muted); }
.todo__action { flex: none; }
.todo-empty { display: flex; align-items: center; gap: 0.75rem; padding: 1rem; border-radius: 12px; background: var(--color-success-bg); color: var(--color-success); font-weight: 600; }

.agenda-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.agenda-mini li { display: flex; gap: 0.75rem; align-items: center; padding: 0.55rem 0.7rem; border-radius: 10px; background: var(--color-bg); }
.agenda-mini time { flex: none; min-width: 3.2rem; font-weight: 800; color: var(--color-primary); font-variant-numeric: tabular-nums; }
.agenda-mini a { color: inherit; text-decoration: none; font-weight: 600; }

/* Pipeline : une couleur par étape. */
.pipeline__stage { border-top: 4px solid var(--stage, var(--color-primary)); }
.pipeline__count { color: var(--stage, var(--color-primary)); }
.stage--prospect { --stage: var(--step-prospect); }
.stage--collecting { --stage: var(--step-collecting); }
.stage--complete { --stage: var(--step-complete); }
.stage--submitted_to_banks { --stage: var(--step-banks); }
.stage--offer_received { --stage: var(--step-offer); }
.stage--offer_accepted { --stage: var(--step-accepted); }
.stage--awaiting_funds { --stage: var(--step-funds); }
.stage--fees_due { --stage: var(--step-fees); }
.stage--closed_success { --stage: var(--step-success); }
.stage--closed_failure { --stage: var(--step-failure); }

/* ---------- Fiche dossier ---------- */
.file-head {
    display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem;
    padding: 1.25rem 1.35rem; margin-bottom: 1rem; border-radius: 18px; background: var(--color-surface);
    border: 1px solid var(--color-border); box-shadow: var(--shadow); border-top: 5px solid var(--stage, var(--color-primary));
}
.file-head h1 { margin: 0.1rem 0 0.3rem; }
.file-head__meta { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; color: var(--color-muted); font-size: 0.9rem; margin: 0; }
.file-head__meta span { display: inline-flex; align-items: center; gap: 0.3rem; }
.file-head__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.tabs-nav { display: flex; gap: 0.25rem; margin: 0 0 1.25rem; padding: 0.3rem; overflow-x: auto; border-radius: 14px; background: #eaf0f4; scrollbar-width: none; }
.tabs-nav::-webkit-scrollbar { display: none; }
.tabs-nav a {
    display: inline-flex; align-items: center; gap: 0.45rem; flex: none;
    padding: 0.55rem 0.9rem; border-radius: 10px; font-weight: 650; font-size: 0.92rem;
    color: var(--color-muted); text-decoration: none; white-space: nowrap;
}
.tabs-nav a:hover { color: var(--color-text); background: rgb(255 255 255 / 60%); }
.tabs-nav a[aria-selected="true"] { background: var(--color-surface); color: var(--color-primary-dark); box-shadow: var(--shadow); }
.tabs-nav__count { display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 0.35rem; border-radius: 999px; background: var(--color-accent); color: #2b1208; font-size: 0.72rem; font-weight: 800; }
.tabs-nav__count--muted { background: #d9e2ea; color: var(--color-muted); }
.js .tab-panel[hidden] { display: none; }

/* ---------- Espace client ---------- */
.client-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.progress-ring { --p: 0; position: relative; width: 4.5rem; height: 4.5rem; flex: none; border-radius: 50%; background: conic-gradient(var(--color-accent) calc(var(--p) * 1%), #e8eef3 0); display: grid; place-items: center; }
.progress-ring::before { content: ""; position: absolute; inset: 0.45rem; border-radius: 50%; background: var(--color-surface); }
.progress-ring span { position: relative; font-weight: 800; font-size: 1rem; color: var(--color-primary-dark); }
.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.task { display: flex; align-items: center; gap: 0.9rem; padding: 0.95rem 1rem; border-radius: 14px; border: 1px solid var(--color-border); background: var(--color-surface); box-shadow: var(--shadow); text-decoration: none; color: inherit; }
a.task:hover { border-color: var(--color-primary-100); box-shadow: var(--shadow-lg); }
.task--todo { border-inline-start: 5px solid var(--color-accent); }
.task--done { border-inline-start: 5px solid var(--step-success); opacity: 0.85; }
.task__body { flex: 1; min-width: 0; }
.task__title { display: block; font-weight: 700; }
.task__meta { display: block; font-size: 0.88rem; color: var(--color-muted); }
.task .icon-chip { width: 2.6rem; height: 2.6rem; }
.broker-card { display: flex; align-items: center; gap: 0.85rem; }
.broker-card .avatar__initials { width: 2.75rem; height: 2.75rem; font-size: 1rem; }

/* ---------- Pages de connexion ---------- */
.no-shell .container { max-width: 1100px; }
.auth-page .card--narrow { margin-top: 2.5rem; border-top: 5px solid var(--color-accent); }

/* ---------- Impression : on masque la navigation. ---------- */
@media print {
    .sidebar, .appbar, .bottomnav, .demo-banner { display: none !important; }
    .app__main .container { padding: 0; max-width: none; }
}
.pipeline--compact { grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); }
.dash-hero .btn--ghost { background: rgb(255 255 255 / 12%); color: #fff; border-color: rgb(255 255 255 / 30%); }
.dash-hero .btn--ghost:hover { background: rgb(255 255 255 / 20%); }
.back-link-row { margin: 0 0 0.6rem; }

/* Pièces : un liseré de couleur selon l'état. */
.doc-list__item--stacked { padding: 0.85rem 0.9rem; border-inline-start: 4px solid transparent; border-radius: 10px; }
.doc-list__item--stacked + .doc-list__item--stacked { border-top-color: var(--color-border); }
.doc--submitted { border-inline-start-color: var(--step-complete); background: #f5f9ff; }
.doc--rejected { border-inline-start-color: var(--color-error); }
.doc--requested { border-inline-start-color: var(--step-collecting); }
.doc--approved { border-inline-start-color: var(--step-success); }
.doc-group__title { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.7rem; border-radius: 999px; background: var(--color-primary-50); color: var(--color-primary-dark); font-size: 0.85rem; }
.file-chips li { background: #f1f5f8; }
.progress progress::-webkit-progress-value { background: linear-gradient(90deg, #27ae60, #5ed38f); }
.progress progress::-moz-progress-bar { background: linear-gradient(90deg, #27ae60, #5ed38f); }
/* Suivi du dossier : étape en cours à la couleur de l'étape. */
.workflow { border-top: 4px solid var(--color-primary-100); }
.workflow__step--current .workflow__dot { border-color: var(--color-accent); color: var(--color-accent-strong); box-shadow: 0 0 0 5px var(--color-accent-50); }

/* Anneau de progression (sans style en ligne : sécurité CSP). */
.progress-ring.p-0 { --p: 0; }
.progress-ring.p-5 { --p: 5; }
.progress-ring.p-10 { --p: 10; }
.progress-ring.p-15 { --p: 15; }
.progress-ring.p-20 { --p: 20; }
.progress-ring.p-25 { --p: 25; }
.progress-ring.p-30 { --p: 30; }
.progress-ring.p-35 { --p: 35; }
.progress-ring.p-40 { --p: 40; }
.progress-ring.p-45 { --p: 45; }
.progress-ring.p-50 { --p: 50; }
.progress-ring.p-55 { --p: 55; }
.progress-ring.p-60 { --p: 60; }
.progress-ring.p-65 { --p: 65; }
.progress-ring.p-70 { --p: 70; }
.progress-ring.p-75 { --p: 75; }
.progress-ring.p-80 { --p: 80; }
.progress-ring.p-85 { --p: 85; }
.progress-ring.p-90 { --p: 90; }
.progress-ring.p-95 { --p: 95; }
.progress-ring.p-100 { --p: 100; }
.doc--requested .upload__picker, .doc--rejected .upload__picker { border-color: #ffc3b1; background: var(--color-accent-50); }
.doc--requested .upload__picker span, .doc--rejected .upload__picker span { color: var(--color-accent-strong); }
.client-hero h1 { margin-bottom: 0.2rem; }
.client-file h3 { margin-top: 1.25rem; }
.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { min-width: 0; }
.kpi > span:last-child { min-width: 0; }
@media (max-width: 599px) {
    .kpi { flex-direction: column; align-items: flex-start; gap: 0.5rem; padding: 0.85rem; }
    .kpi__value { font-size: 1.3rem; }
    .task .btn { display: none; }
    .dash-hero { padding: 1.1rem; }
    .dash-hero .actions { width: 100%; }
    .file-head__actions { width: 100%; }
    .todo { flex-wrap: wrap; }
    .todo__action { margin-inline-start: 3.1rem; }
}
.app__main { overflow-x: clip; }
@media (max-width: 599px) {
    .todo__body { flex: 1 1 calc(100% - 3.5rem); }
    .card__header { flex-wrap: wrap; }
    .card__header .btn { font-size: 0.85rem; }
}

/* Liste des dossiers : initiales à la couleur de l'étape. */
.file-list__link { justify-content: flex-start; flex-wrap: nowrap; }
.file-list__main { flex: 1; }
.file-list__avatar {
    display: inline-grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; border-radius: 12px;
    background: color-mix(in srgb, var(--stage, var(--color-primary)) 14%, white); color: var(--stage, var(--color-primary));
    font-weight: 800; font-size: 0.85rem;
}
@media (max-width: 599px) { .file-list__link { flex-wrap: wrap; } .file-list__meta { flex-basis: 100%; padding-inline-start: 3.25rem; } }

/* Connexion : présentation à côté du formulaire sur grand écran. */
.auth { display: grid; gap: 1.5rem; align-items: center; max-width: 980px; margin: 1rem auto; }
.auth .card--narrow { margin: 0 auto; width: 100%; border-top: 5px solid var(--color-accent); }
.auth__brand { display: none; }
@media (min-width: 900px) {
    .auth { grid-template-columns: 1fr 440px; }
    .auth__brand {
        display: block; align-self: stretch; padding: 2.5rem; border-radius: 22px; color: #fff;
        background: radial-gradient(90% 90% at 100% 0%, rgb(255 159 127 / 70%) 0%, rgb(255 159 127 / 0%) 55%), linear-gradient(140deg, #0b3f4c, #0f5c6e 60%, #16788f);
        box-shadow: var(--shadow-lg);
    }
    .auth__brand .brand__mark { width: 3rem; height: 3rem; font-size: 1.5rem; border-radius: 14px; }
    .auth__title { margin: 1.75rem 0 1.25rem; font-size: 1.6rem; font-weight: 800; line-height: 1.25; letter-spacing: -0.02em; }
    .auth__points { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; color: #d6eaef; }
    .auth__points li { display: flex; gap: 0.6rem; align-items: flex-start; }
    .auth__points .icon { color: #ffb39f; margin-top: 0.1rem; }
}
.no-shell .card--narrow { border-top: 5px solid var(--color-accent); }

/* ---------- Messagerie ---------- */
.sidenav__badge, .bottomnav__badge {
    display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; padding: 0 0.35rem;
    border-radius: 999px; background: var(--color-accent); color: #2b1208; font-size: 0.72rem; font-weight: 800;
}
.sidenav__link .sidenav__badge { margin-inline-start: auto; }
.sidebar-collapsed .sidenav__link .sidenav__badge { position: absolute; top: 0.2rem; inset-inline-end: 0.6rem; margin: 0; }
.bottomnav a { position: relative; }
.bottomnav__badge { position: absolute; top: 0; inset-inline-start: 55%; }
.topbar__messages { position: relative; }
.topbar__messages .sidenav__badge { margin-inline-start: 0.2rem; }
@media (max-width: 639px) { .topbar__messages .sidenav__badge { position: absolute; top: -0.15rem; inset-inline-end: -0.3rem; margin: 0; min-width: 1.1rem; height: 1.1rem; font-size: 0.65rem; } }
.unread-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--color-accent); color: #2b1208; font-size: 0.75rem; font-weight: 700; }
[data-unread-badge].is-new { animation: badge-pop 0.6s ease-out; }
@keyframes badge-pop { 0% { transform: scale(0.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { [data-unread-badge].is-new { animation: none; } }

.inbox { list-style: none; margin: 0; padding: 0; }
.inbox__item + .inbox__item { border-top: 1px solid var(--color-border); }
.inbox__item > a { display: flex; align-items: center; gap: 0.85rem; padding: 0.8rem 0.6rem; border-radius: 12px; color: inherit; text-decoration: none; }
.inbox__item > a:hover { background: var(--color-primary-50); }
.inbox__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.inbox__title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.inbox__preview { color: var(--color-muted); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox__author { font-weight: 650; color: var(--color-text); }
.inbox__side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; flex: none; }
.inbox__item.is-unread .inbox__preview { color: var(--color-text); font-weight: 600; }

.chat-card { padding-bottom: 1rem; }
.chat__audience { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 1rem; padding: 0.5rem 0.75rem; border-radius: 10px; background: var(--color-bg); }
.chat { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; max-height: 62vh; overflow-y: auto; scroll-behavior: smooth; }
.chat__item { display: flex; align-items: flex-end; gap: 0.6rem; max-width: 86%; }
.chat__item--mine { align-self: flex-end; flex-direction: row-reverse; }
.chat__avatar { width: 2.1rem; height: 2.1rem; font-size: 0.75rem; flex: none; }
.chat__item:not(.chat__item--staff) .chat__avatar { background: linear-gradient(135deg, #6c5ce7, #8f83f0); }
.chat__bubble { padding: 0.65rem 0.9rem; border-radius: 16px 16px 16px 4px; background: #f1f5f8; border: 1px solid var(--color-border); min-width: 0; }
.chat__item--mine .chat__bubble { border-radius: 16px 16px 4px 16px; background: var(--color-accent-50); border-color: #ffd3c5; }
.chat__meta { display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; align-items: baseline; margin: 0 0 0.2rem; font-size: 0.8rem; color: var(--color-muted); }
.chat__meta strong { color: var(--color-text); }
.chat__text { margin: 0; overflow-wrap: anywhere; }
.chat__bubble .file-chips { margin-top: 0.4rem; }
.chat-empty { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 2rem 1rem; text-align: center; color: var(--color-muted); }
.chat-form { border-top: 1px solid var(--color-border); padding-top: 1rem; }
.chat-form textarea { resize: vertical; min-height: 5rem; }
.chat-form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.6rem; }
.chat-form__actions .btn { margin-inline-start: auto; }
.chat-form__attach { position: relative; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.45rem 0.75rem; border: 1px dashed #c9d3dd; border-radius: 10px; font-weight: 600; font-size: 0.9rem; color: var(--color-primary); cursor: pointer; }
.chat-form__attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chat-form__attach:focus-within { outline: 3px solid rgb(255 122 89 / 55%); outline-offset: 2px; }
.chat-form__hint { flex: 1 1 12rem; }
@media (max-width: 599px) { .chat__item { max-width: 100%; } .chat { max-height: none; } }
.notifications .form__row--checkbox { padding: 0.75rem 0; border-bottom: 1px solid var(--color-border); margin: 0; }
.notifications .choices-inline { padding-block: 0.5rem 0.75rem; padding-inline: 1.7rem 0; }

/* Petits écrans : la barre du haut du client garde toutes ses actions visibles. */
@media (max-width: 479px) {
    .topbar .brand__name { display: none; }
    .topbar__nav { gap: 0.4rem; }
    .tabs-nav--wrap { flex-wrap: wrap; }
}

/* ---------- Écriture de droite à gauche (arabe) ---------- */
/* Les marges et positions utilisent des propriétés logiques (inline-start/end) :
   seules les transformations et les icônes directionnelles sont retournées ici. */
[dir="rtl"] .sidebar:not(.is-open) { transform: translateX(105%); }
@media (min-width: 1024px) { [dir="rtl"] .sidebar:not(.is-open) { transform: none; } }
[dir="rtl"] .icon--flip-rtl { transform: scaleX(-1); }
[dir="rtl"] .sidebar-collapsed .sidebar__collapse .icon { transform: none; }
[dir="rtl"] .workflow__step::before { transform: none; }
[dir="rtl"] input[type="tel"], [dir="rtl"] input[type="email"], [dir="rtl"] input[type="url"] { direction: ltr; text-align: end; }
