/* =========================================================================
   VITAE — Design system
   Primaire #2563eb. Dominante blanche/gris froid. Zero violet. Zero emoji.
   RTL natif via proprietes logiques. Inter, chiffres tabulaires.
   ========================================================================= */

/* L'attribut HTML [hidden] doit toujours masquer, meme sur un element a classe
   definissant display (sinon le style auteur ecrase le style navigateur). */
[hidden] { display: none !important; }

/* ---- Fonts (woff2 locales, fallback systeme si absentes) --------------- */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/inter/Inter-Regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/inter/Inter-Medium.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/inter/Inter-SemiBold.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/inter/Inter-Bold.woff2') format('woff2');
}

/* ---- Tokens ------------------------------------------------------------ */
:root {
    --bg: #ffffff;
    --surface: #f8fafc;
    --surface-2: #f2f4f7;
    --border: #e5e9f0;
    --border-strong: #d4dae6;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-soft: #94a3b8;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff4ff;
    --primary-ring: rgba(37, 99, 235, .35);

    --success: #15803d;  --success-bg: #ecfdf3;
    --warning: #b45309;  --warning-bg: #fffaeb;
    --danger:  #b42318;  --danger-bg:  #fef3f2;
    --info:    #2563eb;  --info-bg:    #eff4ff;
    --neutral: #475467;  --neutral-bg: #f2f4f7;

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-full: 999px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, .06);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, .10);

    --sb-w: 240px;
    --tb-h: 60px;

    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --fnum: 'Inter', ui-monospace, 'SF Mono', monospace;

    --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---- Reset ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'cv05' 1, 'ss01' 1;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
ul { list-style: none; padding: 0; }
svg { display: block; }
.mono-num { font-family: var(--fnum); font-feature-settings: 'tnum' 1; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

/* ---- Typography helpers ------------------------------------------------ */
.eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.page-title { font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }

.brand-mark {
    display: inline-block;
    font-weight: 700;
    letter-spacing: -.01em;
    font-size: 15px;
    line-height: 1.15;
    color: #fff;
    max-width: 200px;
}
.brand-mark--dark { color: var(--text); }
/* Logo sidebar : laisser respirer le nom sur 2 lignes si besoin */
.sidebar__brand { align-items: center; }
.sidebar__brand .brand-mark { font-size: 16px; }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding-inline: 16px;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    font-weight: 600;
    font-size: 14px;
    transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); color: #fff; }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--surface); }
.btn--block { width: 100%; }

/* ---- Badges ------------------------------------------------------------ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding-inline: 8px;
    border-radius: var(--r-full);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}
.badge--xs { height: 18px; font-size: 11px; padding-inline: 6px; }
.badge--success { color: var(--success); background: var(--success-bg); }
.badge--warning { color: var(--warning); background: var(--warning-bg); }
.badge--danger  { color: var(--danger);  background: var(--danger-bg); }
.badge--info    { color: var(--info);    background: var(--info-bg); }
.badge--neutral { color: var(--neutral); background: var(--neutral-bg); }

/* ---- Forms ------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text); }
.field input, .field select, .field textarea {
    height: 42px;
    padding-inline: 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--bg);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field textarea { height: auto; padding-block: 10px; min-height: 96px; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

/* ---- Alerts ------------------------------------------------------------ */
.alert {
    padding: 12px 14px;
    border-radius: var(--r-md);
    font-size: 13px;
    border: 1px solid transparent;
    margin-block-end: 16px;
}
.alert--success { color: var(--success); background: var(--success-bg); border-color: #abefc6; }
.alert--danger  { color: var(--danger);  background: var(--danger-bg);  border-color: #fecdc9; }
.alert--warning { color: var(--warning); background: var(--warning-bg); border-color: #fde2a6; }
.alert--info    { color: #1e40af;        background: var(--info-bg);    border-color: #c3d4fe; }

/* ---- Layout ------------------------------------------------------------ */
.app-body { background: var(--surface); }
.layout { display: flex; min-height: 100vh; }
.layout__main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.sidebar {
    width: var(--sb-w);
    flex-shrink: 0;
    background: var(--bg);
    border-inline-end: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar__brand {
    height: var(--tb-h);
    display: flex;
    align-items: center;
    padding-inline: 20px;
    border-block-end: 1px solid var(--border);
}
.sidebar__nav { padding: 16px 12px; overflow-y: auto; }
.sidebar__group { margin-block-end: 18px; }
.sidebar__group-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-soft);
    padding-inline: 10px;
    margin-block-end: 6px;
}
.sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-md);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    transition: background-color .12s var(--ease), color .12s var(--ease);
}
.sidebar__link:hover { background: var(--surface); color: var(--text); }
.sidebar__link.is-active { background: var(--primary-soft); color: var(--primary); }
.sidebar__link.is-active .sidebar__icon { color: var(--primary); }
.sidebar__icon { color: var(--text-soft); display: flex; }
.sidebar__text { flex: 1; }
.sidebar__link.is-soon { opacity: .5; }
.sidebar__link.is-soon:hover { opacity: .75; background: var(--surface); color: var(--text-muted); }
.sidebar__soon {
    width: 6px; height: 6px;
    border-radius: var(--r-full);
    background: var(--border-strong);
    flex-shrink: 0;
}

/* ---- Topbar ------------------------------------------------------------ */
.topbar {
    height: var(--tb-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding-inline: 24px;
    background: var(--bg);
    border-block-end: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar__search { position: relative; flex: 1; max-width: 420px; }
.topbar__search-icon {
    position: absolute;
    inset-inline-start: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-soft);
}
.topbar__search input {
    width: 100%;
    height: 38px;
    padding-inline: 38px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
}
.topbar__actions { display: flex; align-items: center; gap: 12px; margin-inline-start: auto; }

.lang-switch { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 2px; }
.lang-switch__btn {
    padding: 4px 10px;
    border-radius: var(--r-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}
.lang-switch__btn.is-active { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---- Profile dropdown -------------------------------------------------- */
.profile { position: relative; }
.profile__trigger { display: flex; align-items: center; gap: 10px; background: none; border: none; padding: 4px; border-radius: var(--r-md); }
.profile__trigger:hover { background: var(--surface); }
.avatar {
    width: 34px; height: 34px;
    border-radius: var(--r-full);
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 13px;
}
.profile__meta { display: flex; flex-direction: column; text-align: start; line-height: 1.25; }
.profile__name { font-size: 13px; font-weight: 600; }
.profile__role { font-size: 12px; color: var(--text-muted); }
.dropdown {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 6px);
    min-width: 200px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 30;
}
.dropdown__item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: none;
    background: none;
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 14px;
    text-align: start;
}
.dropdown__item:hover { background: var(--surface); }

/* ---- Content ----------------------------------------------------------- */
.content { padding: 28px 24px 48px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-block-end: 20px; }

/* ---- Cards / KPI ------------------------------------------------------- */
.card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-block-end: 24px; }
.kpi {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    /* Signature : filet de risque sur le bord d'attaque (defaut neutre) */
    border-inline-start: 3px solid var(--border-strong);
}
.kpi__head { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.kpi__icon { color: var(--text-soft); }
.kpi__label { font-size: 13px; font-weight: 500; }
.kpi__value { font-size: 30px; font-weight: 700; line-height: 1.1; margin-block: 10px 2px; }
.kpi__hint { font-size: 12px; }

/* Variantes de risque (signature couleur) */
.kpi--risk-faible   { border-inline-start-color: var(--success); }
.kpi--risk-moyen    { border-inline-start-color: var(--warning); }
.kpi--risk-eleve    { border-inline-start-color: #ea580c; }
.kpi--risk-critique { border-inline-start-color: var(--danger); }

/* ---- Panels ------------------------------------------------------------ */
.panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-block-end: 1px solid var(--border);
}

/* ---- Tables ------------------------------------------------------------ */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: start; border-block-end: 1px solid var(--border); }
.table th { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.table tbody tr { transition: background-color .1s var(--ease); }
.table tbody tr:hover { background: var(--surface); }
/* Signature : filet de risque en tete de ligne */
.table tr[data-risk] td:first-child { border-inline-start: 3px solid transparent; }
.table tr[data-risk="faible"]   td:first-child { border-inline-start-color: var(--success); }
.table tr[data-risk="moyen"]    td:first-child { border-inline-start-color: var(--warning); }
.table tr[data-risk="eleve"]    td:first-child { border-inline-start-color: #ea580c; }
.table tr[data-risk="critique"] td:first-child { border-inline-start-color: var(--danger); }

/* ---- Empty states ------------------------------------------------------ */
.empty-state { display: grid; place-items: center; text-align: center; padding: 48px 24px; gap: 6px; }
.empty-state__icon {
    width: 56px; height: 56px;
    display: grid; place-items: center;
    border-radius: var(--r-full);
    background: var(--surface);
    color: var(--text-soft);
    margin-block-end: 8px;
}
.empty-state__title { font-weight: 600; }
.empty-state__text { font-size: 13px; max-width: 360px; }

/* ---- Toast ------------------------------------------------------------- */
.toast-stack {
    position: fixed;
    inset-block-end: 24px;
    inset-inline-end: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 60;
}
.toast {
    background: var(--text);
    color: #fff;
    padding: 12px 16px;
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    min-width: 240px;
}

/* ---- Auth -------------------------------------------------------------- */
.auth-body { background: var(--surface); }
.auth-shell { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-aside {
    position: relative;
    overflow: hidden;
    color: #fff;
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 16px;
    min-height: 100vh;
}
.auth-photo { position: absolute; inset: 0; z-index: 0; }
.auth-photo img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center 28%;
    transform-origin: center 30%;
    animation: kenburns 26s ease-in-out infinite alternate;
}
.auth-aside__scrim {
    position: absolute; inset: 0; z-index: 1;
    /* Lavis bleu lumineux : tinte la photo aux couleurs de la marque, reste clair,
       et fonce juste assez en bas pour la lisibilite du texte blanc. */
    background:
        linear-gradient(180deg, rgba(37, 99, 235, .22) 0%, rgba(37, 99, 235, .42) 48%, rgba(30, 58, 138, .82) 100%),
        linear-gradient(70deg, rgba(29, 78, 216, .35), rgba(37, 99, 235, 0) 55%);
}
.auth-aside__content { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 14px; }
.auth-aside__content .brand-mark { font-size: 18px; opacity: .95; }
.auth-aside__tagline { font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; max-width: 18ch; text-shadow: 0 1px 18px rgba(15, 23, 42, .25); }
.auth-aside__baseline { font-size: 16px; color: rgba(255, 255, 255, .9); }
.auth-aside__points { display: flex; flex-direction: column; gap: 9px; margin-block-start: 10px; }
.auth-aside__points li {
    font-size: 14px;
    color: rgba(255, 255, 255, .92);
    padding-inline-start: 20px;
    position: relative;
}
.auth-aside__points li::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 7px;
    width: 7px; height: 7px;
    border-radius: var(--r-full);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .18);
}
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.09); } }
.auth-card { animation: auth-rise .5s var(--ease) both; }
@keyframes auth-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; gap: 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card__head { margin-block-end: 24px; display: flex; flex-direction: column; gap: 6px; }
.auth-card__head .brand-mark { margin-block-end: 12px; }
.auth-card__head h1 { font-size: 24px; font-weight: 700; }
.auth-lang { display: flex; gap: 10px; justify-content: center; margin-block-start: 20px; font-size: 13px; }
.auth-foot { font-size: 12px; }

/* ---- Error pages ------------------------------------------------------- */
.error-body { background: var(--surface); }
.error-shell { max-width: 460px; margin: 140px auto; text-align: center; padding-inline: 24px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.error-code { font-size: 56px; font-weight: 700; color: var(--primary); }

/* ---- Buttons (tailles) ------------------------------------------------- */
.btn--sm { height: 32px; padding-inline: 12px; font-size: 13px; }
.text-end { text-align: end; }
.link-strong { font-weight: 600; color: var(--text); }
.link-strong:hover { color: var(--primary); }
.list-count { margin-block-start: 12px; font-size: 13px; }

/* ---- Filters bar ------------------------------------------------------- */
.filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-block-end: 16px;
    flex-wrap: wrap;
}
.filters__search { position: relative; flex: 1; min-width: 240px; }
.filters__icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--text-soft); }
.filters__search input {
    width: 100%; height: 40px;
    padding-inline: 38px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--bg);
}
.filters select {
    height: 40px;
    padding-inline: 12px 28px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--bg);
}

/* ---- Page head extras -------------------------------------------------- */
.head-badges { display: flex; gap: 8px; margin-block-start: 10px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; align-items: center; }
.head-actions form { display: inline; }

/* ---- Tabs -------------------------------------------------------------- */
.tabs {
    display: flex;
    gap: 4px;
    border-block-end: 1px solid var(--border);
    margin-block-end: 24px;
    overflow-x: auto;
}
.tabs__item {
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    border-block-end: 2px solid transparent;
    white-space: nowrap;
}
.tabs__item:hover { color: var(--text); }
.tabs__item.is-active { color: var(--primary); border-block-end-color: var(--primary); }

/* ---- Definition lists -------------------------------------------------- */
.defs { padding: 8px 20px 20px; display: flex; flex-direction: column; }
.defs > div { display: flex; justify-content: space-between; gap: 16px; padding-block: 8px; border-block-end: 1px solid var(--border); }
.defs > div:last-child { border-block-end: none; }
.defs dt { color: var(--text-muted); font-size: 13px; }
.defs dd { font-weight: 500; text-align: end; }
.defs--compact > div { padding-block: 5px; }
.panel__body { padding: 16px 20px; }
.panel__body p { line-height: 1.6; }

/* ---- Grids ------------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; align-items: start; }
.card-grid--3 { grid-template-columns: repeat(3, 1fr); }

/* ---- Forms (module) ---------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-grid .field--wide { grid-column: span 2; }
.form--inline { display: flex; flex-direction: row; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form--inline .field { min-width: 160px; }
.form--inline .field--grow { flex: 1; }
.checks { display: flex; flex-wrap: wrap; gap: 18px; padding-block-start: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.field__error { color: var(--danger); font-size: 12px; }
.field__help { color: var(--text-muted); font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-block-start: 4px; }
.form .panel { margin-block-end: 16px; }

/* ---- Authority cards --------------------------------------------------- */
.authority h3 { margin-block: 12px 4px; }
.authority__head { display: flex; gap: 8px; flex-wrap: wrap; }
.authority__note {
    margin-block-start: 12px;
    padding: 10px 12px;
    background: var(--warning-bg);
    color: var(--warning);
    border-radius: var(--r-md);
    font-size: 13px;
    line-height: 1.5;
}

/* ---- Segmented control (vue liste / kanban) ---------------------------- */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 2px; }
.seg__btn { padding: 6px 14px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; color: var(--text-muted); }
.seg__btn.is-active { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---- Callout (campagne annuelle) --------------------------------------- */
.callout {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 20px; margin-block-end: 16px;
    background: var(--primary-soft);
    border: 1px solid #c3d4fe;
    border-radius: var(--r-lg);
}
.callout p { font-size: 13px; margin-block-start: 2px; }
.filters__spacer { flex: 1; }

/* ---- Kanban ------------------------------------------------------------ */
.kanban {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 1fr);
    gap: 14px;
    overflow-x: auto;
    padding-block-end: 8px;
}
.kanban__col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; min-height: 120px; }
.kanban__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-block-end: 1px solid var(--border); }
.kanban__title { font-size: 13px; font-weight: 600; }
.kanban__count { font-size: 12px; font-weight: 600; color: var(--text-muted); background: var(--bg); border-radius: var(--r-full); padding: 1px 8px; }
.kanban__body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.kanban__empty { font-size: 13px; padding: 8px 4px; }
.kard {
    display: flex; flex-direction: column; gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--border-strong);
    border-radius: var(--r-md);
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
    transition: border-color .12s var(--ease), transform .12s var(--ease);
}
.kard:hover { transform: translateY(-1px); }
.kard__name { font-weight: 600; color: var(--text); font-size: 14px; }
.kard__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kard__foot { font-size: 12px; color: var(--text-muted); }
.kard[data-risk="faible"]   { border-inline-start-color: var(--success); }
.kard[data-risk="moyen"]    { border-inline-start-color: var(--warning); }
.kard[data-risk="eleve"]    { border-inline-start-color: #ea580c; }
.kard[data-risk="critique"] { border-inline-start-color: var(--danger); }

/* ---- Double document (Misrad Hapnim) ----------------------------------- */
.double-doc { border-block-start: 1px solid var(--border); background: var(--warning-bg); }
.double-doc__title { font-weight: 600; color: var(--warning); }
.double-doc .muted { margin-block: 2px 10px; font-size: 13px; }

/* ---- Dashboard cockpit ------------------------------------------------- */
.card-grid--6 { grid-template-columns: repeat(6, 1fr); }
a.kpi { display: block; color: inherit; transition: border-color .12s var(--ease), transform .12s var(--ease), box-shadow .12s var(--ease); }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: inherit; }

.dash-grid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.dash-side { display: flex; flex-direction: column; gap: 16px; }

.alert--link { display: block; text-decoration: none; }
.alert--link:hover { filter: brightness(.98); }

/* Timeline (echeances du mois) */
.timeline { padding: 8px 20px 16px; display: flex; flex-direction: column; }
.timeline__item { display: flex; align-items: center; gap: 10px; padding-block: 8px; border-block-end: 1px solid var(--border); }
.timeline__item:last-child { border-block-end: none; }
.timeline__dot { width: 8px; height: 8px; border-radius: var(--r-full); background: var(--neutral); flex-shrink: 0; }
.dot--faible { background: var(--success); }
.dot--moyen { background: var(--warning); }
.dot--eleve { background: #ea580c; }
.dot--critique { background: var(--danger); }
.timeline__date { font-size: 13px; color: var(--text-muted); min-width: 84px; }
.timeline__label { font-weight: 500; font-size: 14px; }

/* Fil d'activite */
.feed { padding: 8px 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.feed__item { display: flex; flex-direction: column; gap: 1px; padding-block: 4px; }
.feed__action { font-size: 13px; color: var(--text); }
.feed__meta { font-size: 12px; }

/* Pager */
.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin-block-start: 16px; }

/* ---- Variables / troncature -------------------------------------------- */
.var-list { display: flex; flex-direction: column; gap: 8px; }
.var-list li { font-size: 13px; color: var(--text-muted); }
.var-list code, .field__help code {
    font-family: var(--fnum);
    background: var(--surface-2);
    padding: 1px 6px;
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 12px;
}
.cell-truncate { display: inline-block; max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* ---- Mapping d'import CSV ---------------------------------------------- */
.map-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 24px; }
.map-row { display: flex; align-items: center; gap: 12px; }
.map-field { flex: 0 0 40%; font-size: 13px; font-weight: 500; color: var(--text); }
.map-row select { flex: 1; height: 38px; padding-inline: 10px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--bg); }
.map-row select.map-req { border-color: var(--primary); }
.table-scroll { overflow-x: auto; }

/* ---- Cloche de notifications ------------------------------------------- */
.notif { position: relative; }
.notif__trigger { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); cursor: pointer; color: var(--text-muted); }
.notif__trigger:hover { color: var(--primary); border-color: var(--primary); }
.notif__badge { position: absolute; inset-block-start: -6px; inset-inline-end: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.dropdown--wide { width: 340px; max-width: 90vw; padding: 0; }
@media (max-width: 560px) {
    .dropdown--wide {
        position: fixed;
        inset-inline: 10px;
        inset-block-start: 66px;
        width: auto;
        max-width: none;
        max-height: 70vh;
        overflow-y: auto;
    }
}
.dropdown__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-block-end: 1px solid var(--border); }
.dropdown__link { background: none; border: none; color: var(--primary); font-size: 12px; cursor: pointer; }
.dropdown__empty { padding: 20px 14px; color: var(--text-muted); font-size: 14px; text-align: center; }
.notif__item { display: flex; gap: 10px; padding: 10px 14px; border-block-end: 1px solid var(--border); text-decoration: none; color: inherit; }
.notif__item:last-child { border-block-end: none; }
.notif__item:hover { background: var(--surface-2, var(--primary-soft)); }
.notif__icon { color: var(--primary); flex-shrink: 0; margin-block-start: 2px; }
.notif__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif__label { font-size: 13px; line-height: 1.4; }
.notif__date { font-size: 11px; color: var(--text-muted); }
.notif__push { display: flex; gap: 8px; padding: 10px 14px; border-block-end: 1px solid var(--border); background: var(--surface); }

/* ---- Calendrier -------------------------------------------------------- */
.cal-legend { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); margin-block-end: 14px; }
.cal-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 4px; vertical-align: middle; }
.calendar { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.calendar__grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar__head { background: var(--surface); }
.calendar__dow { padding: 8px; text-align: center; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.calendar__cell { min-height: 96px; border-block-start: 1px solid var(--border); border-inline-start: 1px solid var(--border); padding: 4px 6px; display: flex; flex-direction: column; gap: 3px; }
.calendar__cell:nth-child(7n+1) { border-inline-start: none; }
.calendar__cell--empty { background: var(--surface); }
.calendar__cell.is-today { background: var(--primary-soft); }
.calendar__num { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.cal-event { font-size: 11px; line-height: 1.3; padding: 2px 5px; border-radius: 4px; text-decoration: none; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev--cert { background: var(--danger); }
.ev--tache { background: var(--primary); }
.ev--rappel { background: #b08900; }
.cal-dot.ev--cert { background: var(--danger); }
.cal-dot.ev--tache { background: var(--primary); }
.cal-dot.ev--rappel { background: #b08900; }

/* ---- Aide / listes ----------------------------------------------------- */
.aide-steps { display: flex; flex-direction: column; gap: 16px; padding: 0; list-style: none; }
.aide-steps h3 { font-size: 15px; margin-block-end: 4px; }
.aide-steps p { color: var(--text-muted); line-height: 1.6; font-size: 14px; }
.list-rows { list-style: none; padding: 0; margin: 0; }
.list-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-block-end: 1px solid var(--border); font-size: 14px; }
.list-row:last-child { border-block-end: none; }

/* ---- Banniere d'installation PWA --------------------------------------- */
.pwa-banner { position: fixed; inset-inline: 16px; inset-block-end: 16px; z-index: 60; max-width: 460px; margin-inline: auto; display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.pwa-banner[hidden] { display: none; }
.pwa-banner__icon { width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; }
.pwa-banner__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pwa-banner__text strong { font-size: 14px; }
.pwa-banner__text span { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.pwa-banner__actions { display: flex; gap: 6px; flex-shrink: 0; margin-inline-start: auto; }
@media (max-width: 520px) { .pwa-banner { flex-wrap: wrap; } .pwa-banner__actions { margin-inline-start: 0; width: 100%; } .pwa-banner__actions .btn { flex: 1; } }

/* ---- Logo de marque ---------------------------------------------------- */
.brand-logo { height: 40px; width: auto; display: block; }
.sidebar__brand .brand-logo { max-width: 188px; height: auto; }
.auth-card__head .brand-logo { height: 46px; margin-block-end: 16px; }
.portail-head .brand-logo { height: 52px; margin-inline: auto; margin-block-end: 6px; }

/* ---- Menu mobile (hamburger + overlay) --------------------------------- */
.topbar__burger { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); color: var(--text-muted); cursor: pointer; flex-shrink: 0; margin-inline-end: 10px; }
.topbar__burger:hover { color: var(--primary); border-color: var(--primary); }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 49; opacity: 0; transition: opacity .2s var(--ease); }
.sidebar-overlay.is-open { opacity: 1; }
@media (max-width: 860px) { .topbar__burger { display: inline-flex; } }

/* ---- Kanban glisser-deposer -------------------------------------------- */
.kard[draggable="true"] { cursor: grab; }
.kard.is-dragging { opacity: .45; cursor: grabbing; }
.kanban__body { min-height: 40px; border-radius: var(--r-md); transition: background .12s, box-shadow .12s; }
.kanban__body.is-over { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }

/* ---- Statistiques ------------------------------------------------------ */
.stat-gauge { display: flex; align-items: center; gap: 20px; }
.stat-gauge__chart { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.stat-gauge__pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; color: var(--primary); }

/* ---- Simulateur de pension --------------------------------------------- */
.sim-grid { display: flex; flex-direction: column; gap: 12px; }
.sim-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.sim-check input { width: auto; }
.sim-result { margin-block: 16px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.sim-line { display: flex; justify-content: space-between; padding: 10px 14px; border-block-end: 1px solid var(--border); font-size: 14px; }
.sim-line:last-child { border-block-end: none; }
.sim-line--hl { background: var(--primary-soft); font-size: 16px; }
.sim-line strong { font-variant-numeric: tabular-nums; }
.sim-taux { font-size: 12px; color: var(--text-muted); margin-block-start: 8px; }
.sim-disclaimer { font-size: 11px; color: var(--text-muted); margin-block-start: 4px; font-style: italic; }

/* ---- Bandeau dashboard (FX + prospects) -------------------------------- */
.dash-strip { display: flex; gap: 16px; margin-block-end: 20px; flex-wrap: wrap; }
.dash-strip__item { flex: 1; min-width: 200px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 18px; box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 2px; }
.dash-strip__label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.dash-strip__value { font-size: 22px; font-weight: 700; }
.dash-strip__sub { font-size: 12px; color: var(--text-muted); }
.fx-trend { font-size: 13px; font-weight: 600; }
.fx-trend.is-up { color: var(--success); }
.fx-trend.is-down { color: var(--danger); }

/* ---- Portail : mode grand-age + outils --------------------------------- */
.portail-tools { display: flex; gap: 8px; justify-content: center; margin-block-start: 10px; }
.portail--xl { font-size: 19px; }
.portail--xl .portail-head h1 { font-size: 34px; }
.portail--xl .portail-status { font-size: 24px; }
.portail--xl .portail-card h2 { font-size: 21px; }
.portail--xl .portail-card p,
.portail--xl .portail-doclist li { font-size: 18px; }
.portail--xl .btn { font-size: 18px; padding: 14px 18px; }

/* ---- Assistant IA ------------------------------------------------------ */
.assistant-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-block-end: 10px; }
.assistant-answer { white-space: pre-line; line-height: 1.65; font-size: 14px; }

/* ---- Portail client / famille ------------------------------------------ */
.portail-body { background: var(--surface); }
.portail-wrap { max-width: 640px; margin: 0 auto; padding: 32px 20px 64px; }
.portail-head { text-align: center; margin-block-end: 24px; }
.portail-head .brand-mark { color: var(--primary); font-size: 18px; }
.portail-head h1 { font-size: 26px; margin-block: 12px 4px; }
.portail-status { text-align: center; padding: 28px 20px; border-radius: var(--r-lg); margin-block-end: 20px; font-size: 18px; font-weight: 600; }
.portail-status--ok { background: var(--success-bg); color: var(--success); }
.portail-status--warn { background: var(--warning-bg); color: var(--warning); }
.portail-status--bad { background: var(--danger-bg); color: var(--danger); }
.portail-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; margin-block-end: 16px; box-shadow: var(--shadow-sm); }
.portail-card h2 { font-size: 16px; margin-block-end: 10px; }
.portail-card p { font-size: 15px; line-height: 1.6; }
.portail-upload input[type=file] { width: 100%; margin-block: 10px; }
.portail-doclist { list-style: none; padding: 0; }
.portail-doclist li { display: flex; justify-content: space-between; padding-block: 8px; border-block-end: 1px solid var(--border); font-size: 14px; }
.portail-foot { text-align: center; font-size: 12px; color: var(--text-muted); margin-block-start: 24px; }
.portail-link-box { background: var(--surface-2); border-radius: var(--r-md); padding: 10px 12px; font-family: var(--fnum); font-size: 12px; word-break: break-all; }

/* ---- Veille reglementaire ---------------------------------------------- */
.feed-list { display: flex; flex-direction: column; gap: 14px; }
.veille-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.veille-card__head h2 { font-size: 17px; }
.veille-card__meta { font-size: 12px; margin-block: 2px 10px; }
.veille-card__body { font-size: 14px; line-height: 1.6; white-space: pre-line; }
.veille-card__client { margin-block-start: 12px; padding: 12px 14px; background: var(--primary-soft); border-radius: var(--r-md); }
.veille-card__client p:last-child { font-size: 14px; line-height: 1.6; }
.veille-card__actions { display: flex; gap: 8px; align-items: center; margin-block-start: 14px; }
.veille-card__actions form { display: inline; }

/* ---- Row actions (formulaires en ligne dans un tableau) ---------------- */
.row-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.row-actions form { display: inline; }
.inline-form { display: inline; }
.inline-form select { height: 32px; padding-inline: 8px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg); font-size: 13px; }

/* ---- Page transition --------------------------------------------------- */
[data-page] { animation: fade-in .18s var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 1024px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); }
    .card-grid--3 { grid-template-columns: repeat(2, 1fr); }
    .card-grid--6 { grid-template-columns: repeat(3, 1fr); }
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .map-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .sidebar { position: fixed; transform: translateX(-100%); z-index: 50; transition: transform .2s var(--ease); }
    html[dir="rtl"] .sidebar { transform: translateX(100%); }
    .sidebar.is-open { transform: none; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
}
@media (max-width: 560px) {
    .card-grid, .card-grid--3, .card-grid--6, .form-grid { grid-template-columns: 1fr; }
    .form-grid .field--wide { grid-column: auto; }
    .content { padding: 20px 16px 40px; }
    .profile__meta { display: none; }
}

/* ---- Reduced motion ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
    [data-page] { animation: none; }
}
