/* ==========================================================================
   Carrière Baboone — design system (esprit Apple HIG)
   Un seul fichier, aucune dépendance. Tokens → base → layout → composants → pages.
   ========================================================================== */

/* ---------- Tokens : clair ---------- */
:root {
    color-scheme: light;
    --bg: #F2F2F7;                 /* systemGroupedBackground */
    --surface: #FFFFFF;            /* secondarySystemGroupedBackground */
    --surface-2: #F2F2F7;          /* champs, segmented control */
    --surface-3: #E5E5EA;
    --surface-hover: rgba(0,0,0,0.04);
    --nav-bg: rgba(249,249,251,0.82);
    --separator: rgba(60,60,67,0.18);
    --separator-strong: rgba(60,60,67,0.32);
    --label: #1C1C1E;
    --label-2: #5E5E63;            /* ≥ 4.5:1 sur blanc et sur --bg */
    --label-3: #6C6C70;
    --accent: #0071E3;             /* texte blanc ≥ 4.5:1 */
    --accent-hover: #0062C4;
    --accent-text: #0062C4;        /* liens sur fond clair */
    --accent-tint: rgba(0,113,227,0.10);
    --focus: rgba(0,113,227,0.55);
    --danger: #D70015;
    --danger-tint: rgba(215,0,21,0.09);
    --success: #248A3D;
    --warning: #B25000;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
    --shadow-lg: 0 18px 48px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.08);

    /* Statuts : --st-* = couleur vive (points, barres), --st-*-text = variante lisible */
    --st-nouveau: #007AFF;      --st-nouveau-text: #0040DD;
    --st-a-postuler: #FF9500;   --st-a-postuler-text: #A84700;
    --st-postule: #34C759;      --st-postule-text: #1E7A35;
    --st-entretien: #AF52DE;    --st-entretien-text: #8944AB;
    --st-refus: #FF3B30;        --st-refus-text: #C4000F;
    --st-ignore: #8E8E93;       --st-ignore-text: #5E5E63;
    --st-expire: #5856D6;       --st-expire-text: #3634A3;
    --st-relance: #32ADE6;      --st-relance-text: #00658F;
    --st-sans-reponse: #FFCC00; --st-sans-reponse-text: #8A5A00;

    --score-high: #1A6B2E;
    --score-mid: #8F3D00;
    --score-low: #6C6C70;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    --nav-h: 56px;
    --tabbar-h: 58px;
    --content-w: 1040px;
}

/* ---------- Tokens : sombre (système ou forcé) ---------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #000000;
        --surface: #1C1C1E;
        --surface-2: #2C2C2E;
        --surface-3: #3A3A3C;
        --surface-hover: rgba(255,255,255,0.06);
        --nav-bg: rgba(22,22,24,0.82);
        --separator: rgba(84,84,88,0.55);
        --separator-strong: rgba(120,120,128,0.7);
        --label: #F5F5F7;
        --label-2: #AEAEB2;
        --label-3: #98989F;
        --accent: #0A84FF;
        --accent-fill: #0071E3;
        --accent-fill-hover: #0062C4;
        --accent-hover: #3395FF;
        --accent-text: #4DA3FF;
        --accent-tint: rgba(10,132,255,0.18);
        --focus: rgba(77,163,255,0.7);
        --danger: #FF6961;
        --danger-tint: rgba(255,69,58,0.16);
        --success: #30D158;
        --warning: #FFB340;
        --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
        --shadow-lg: 0 18px 48px rgba(0,0,0,0.6);
        --st-nouveau: #0A84FF;      --st-nouveau-text: #5EB0FF;
        --st-a-postuler: #FF9F0A;   --st-a-postuler-text: #FFB340;
        --st-postule: #30D158;      --st-postule-text: #4CDB72;
        --st-entretien: #BF5AF2;    --st-entretien-text: #D48CF7;
        --st-refus: #FF453A;        --st-refus-text: #FF6961;
        --st-ignore: #98989D;       --st-ignore-text: #AEAEB2;
        --st-expire: #5E5CE6;       --st-expire-text: #8E8CF0;
        --st-relance: #64D2FF;      --st-relance-text: #70D7FF;
        --st-sans-reponse: #FFD60A; --st-sans-reponse-text: #FFD60A;
        --score-high: #4CDB72;
        --score-mid: #FFB340;
        --score-low: #98989F;
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1C1C1E;
    --surface-2: #2C2C2E;
    --surface-3: #3A3A3C;
    --surface-hover: rgba(255,255,255,0.06);
    --nav-bg: rgba(22,22,24,0.82);
    --separator: rgba(84,84,88,0.55);
    --separator-strong: rgba(120,120,128,0.7);
    --label: #F5F5F7;
    --label-2: #AEAEB2;
    --label-3: #98989F;
    --accent: #0A84FF;
    --accent-fill: #0071E3;
    --accent-fill-hover: #0062C4;
    --accent-hover: #3395FF;
    --accent-text: #4DA3FF;
    --accent-tint: rgba(10,132,255,0.18);
    --focus: rgba(77,163,255,0.7);
    --danger: #FF6961;
    --danger-tint: rgba(255,69,58,0.16);
    --success: #30D158;
    --warning: #FFB340;
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg: 0 18px 48px rgba(0,0,0,0.6);
    --st-nouveau: #0A84FF;      --st-nouveau-text: #5EB0FF;
    --st-a-postuler: #FF9F0A;   --st-a-postuler-text: #FFB340;
    --st-postule: #30D158;      --st-postule-text: #4CDB72;
    --st-entretien: #BF5AF2;    --st-entretien-text: #D48CF7;
    --st-refus: #FF453A;        --st-refus-text: #FF6961;
    --st-ignore: #98989D;       --st-ignore-text: #AEAEB2;
    --st-expire: #5E5CE6;       --st-expire-text: #8E8CF0;
    --st-relance: #64D2FF;      --st-relance-text: #70D7FF;
    --st-sans-reponse: #FFD60A; --st-sans-reponse-text: #FFD60A;
    --score-high: #4CDB72;
    --score-mid: #FFB340;
    --score-low: #98989F;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
    background: var(--bg);
    color: var(--label);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    min-height: 100dvh;
}
img, svg { display: block; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
/* Liens dans du texte courant : soulignés (ne pas reposer sur la couleur seule) */
p a, .auth-footer a, .hint a, .section-footer a { text-decoration: underline; text-underline-offset: 2px; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--label-2); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 300;
    background: var(--accent); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }
.icon { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; fill: none;
        stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 28px; height: 28px; }
.icon-xl { width: 40px; height: 40px; stroke-width: 1.6; }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Layout : barre supérieure ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: var(--nav-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--separator);
}
.topbar-inner {
    max-width: var(--content-w); margin: 0 auto; height: var(--nav-h);
    padding: 0 16px; display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--label); font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(145deg, #2F8CFF 0%, #0060DF 100%);
    box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.25);
}
.brand-mark .icon { width: 17px; height: 17px; }

.segmented {
    display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 2px; gap: 2px;
}
.segmented a, .segmented button {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; min-height: 32px;
    border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--label); white-space: nowrap;
}
.segmented a:hover, .segmented button:hover { text-decoration: none; background: var(--surface-hover); }
.segmented [aria-current="page"], .segmented [aria-current="true"], .segmented [aria-pressed="true"] {
    background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.04); font-weight: 600;
}
.topnav { display: none; margin: 0 auto; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.avatar {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(145deg, #8E8E93, #636366); color: #fff; font-size: 13px; font-weight: 600;
    letter-spacing: 0.02em;
}
.avatar-btn { border-radius: 50%; padding: 4px; min-width: 44px; min-height: 44px; display: grid; place-items: center; }

/* ---------- Layout : contenu ---------- */
.main { max-width: var(--content-w); margin: 0 auto; padding: 20px 16px 40px; }
.main-wide { max-width: none; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.page-subtitle { color: var(--label-2); margin-top: 4px; font-size: 15px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.section { margin-top: 28px; }
.section-title {
    font-size: 13px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: 0.04em;
    margin: 0 4px 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.section-title .count { font-weight: 500; }
.section-footer { font-size: 13px; color: var(--label-2); margin: 8px 4px 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.spacer { flex: 1; }

/* ---------- Barre d'onglets mobile ---------- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--nav-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--separator);
    padding-bottom: env(safe-area-inset-bottom);
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
}
.tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    height: var(--tabbar-h); font-size: 11px; font-weight: 500; color: var(--label-3);
}
.tabbar a:hover { text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--accent-text); }
.tabbar .icon { width: 24px; height: 24px; }
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }

/* ---------- Cartes / listes groupées ---------- */
.card {
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm);
    border: 0.5px solid var(--separator);
}
.card-body { padding: 16px; }
.card-header {
    padding: 14px 16px; border-bottom: 0.5px solid var(--separator);
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card-title { font-size: 15px; font-weight: 600; }

.list { list-style: none; background: var(--surface); border-radius: var(--radius); overflow: hidden;
        border: 0.5px solid var(--separator); box-shadow: var(--shadow-sm); }
.list > li, .list > .list-row { position: relative; }
.list > li + li::before, .list > .list-row + .list-row::before {
    content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--separator);
}
.list-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 52px; color: var(--label);
}
a.list-row:hover, .list-row.is-link:hover { background: var(--surface-hover); text-decoration: none; }
.list-row-main { flex: 1; min-width: 0; }
.list-row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-sub { font-size: 13px; color: var(--label-2); margin-top: 2px; }
.list-row-end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; color: var(--label-2); }
.list-row .chev { color: var(--label-3); opacity: 0.7; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: baseline; }
.kv dt { color: var(--label-2); font-size: 14px; }
.kv dd { min-width: 0; overflow-wrap: anywhere; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 44px; padding: 0 16px; border-radius: 10px; font-size: 15px; font-weight: 500;
    background: var(--surface-2); color: var(--label); white-space: nowrap;
    transition: background-color .15s, transform .08s, opacity .15s; text-decoration: none !important;
    border: 0.5px solid transparent;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent-fill, var(--accent)); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-fill-hover, var(--accent-hover)); }
.btn-tinted { background: var(--accent-tint); color: var(--accent-text); font-weight: 600; }
.btn-tinted:hover { background: var(--accent-tint); filter: brightness(0.96); }
.btn-plain { background: transparent; color: var(--accent-text); }
.btn-plain:hover { background: var(--surface-hover); }
.btn-danger { background: var(--danger); color: #fff; font-weight: 600; }
.btn-danger:hover { background: var(--danger); filter: brightness(0.92); }
.btn-danger-plain { background: transparent; color: var(--danger); }
.btn-danger-plain:hover { background: var(--danger-tint); }
.btn-outline { background: var(--surface); border-color: var(--separator-strong); }
.btn-outline:hover { background: var(--surface-hover); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-sm.btn-icon { width: 36px; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid currentColor; border-color: var(--label-3) transparent var(--label-3) transparent;
    animation: spin .8s linear infinite;
}
.btn-primary.is-loading::after, .btn-danger.is-loading::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 16px; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
.field-row .field + .field { margin-top: 0; }
.label { font-size: 14px; font-weight: 600; color: var(--label); }
.label .optional { font-weight: 400; color: var(--label-2); }
.hint { font-size: 13px; color: var(--label-2); }
.input, .select, .textarea {
    width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; font-size: 16px; /* 16px : pas de zoom iOS */
    color: var(--label); background: var(--surface); border: 1px solid var(--separator-strong);
    border-radius: 10px; transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--label-3); opacity: 0.85; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--label-3); }
.input:focus, .select:focus, .textarea:focus, .tags:focus-within {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
.input[disabled] { background: var(--surface-2); color: var(--label-2); cursor: not-allowed; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select {
    padding-right: 36px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
.input-group { position: relative; }
.input-group .input { padding-right: 52px; }
.input-group .input-addon {
    position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
    width: 44px; height: 40px; display: grid; place-items: center; color: var(--label-2); border-radius: 8px;
}
.input-group .input-addon:hover { color: var(--label); background: var(--surface-hover); }
.input-prefix { position: relative; }
.input-prefix .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--label-3); pointer-events: none; }
.input-prefix .input { padding-left: 40px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: 15px; }
.check input, input[type="checkbox"].cb {
    width: 22px; height: 22px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0;
}
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.form-actions-sticky {
    position: sticky; bottom: 0; z-index: 5; margin: 24px -16px -16px; padding: 12px 16px;
    background: var(--nav-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 0.5px solid var(--separator); border-radius: 0 0 var(--radius) var(--radius);
    display: flex; justify-content: flex-end; gap: 8px;
}

/* Champ « étiquettes » (mots-clés, lieux…) — amélioration progressive d'un input texte */
.tags {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 44px; padding: 6px 8px;
    background: var(--surface); border: 1px solid var(--separator-strong); border-radius: 10px; cursor: text;
}
.tags .tag {
    display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border-radius: 100px;
    background: var(--accent-tint); color: var(--accent-text); font-size: 14px; font-weight: 500;
}
.tags .tag button { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: inherit; }
.tags .tag button:hover { background: rgba(0,0,0,0.08); }
.tags input { flex: 1; min-width: 120px; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px;
              color: var(--label); padding: 4px; min-height: 30px; }

/* ---------- Statuts & badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 100px;
    font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap; flex-shrink: 0;
    --c: var(--st-ignore); --t: var(--st-ignore-text);
    background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--t);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.badge.no-dot::before { display: none; }
.st-nouveau          { --c: var(--st-nouveau);       --t: var(--st-nouveau-text); }
.st-à_postuler       { --c: var(--st-a-postuler);    --t: var(--st-a-postuler-text); }
.st-postulé          { --c: var(--st-postule);       --t: var(--st-postule-text); }
.st-entretien        { --c: var(--st-entretien);     --t: var(--st-entretien-text); }
.st-refus            { --c: var(--st-refus);         --t: var(--st-refus-text); }
.st-ignoré           { --c: var(--st-ignore);        --t: var(--st-ignore-text); }
.st-expiré           { --c: var(--st-expire);        --t: var(--st-expire-text); }
.st-en_attente       { --c: var(--st-postule);       --t: var(--st-postule-text); }
.st-relance_envoyée  { --c: var(--st-relance);       --t: var(--st-relance-text); }
.st-entretien_obtenu { --c: var(--st-entretien);     --t: var(--st-entretien-text); }
.st-sans_réponse     { --c: var(--st-sans-reponse);  --t: var(--st-sans-reponse-text); }

.score {
    display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 24px; padding: 0 7px;
    border-radius: 7px; font-family: var(--mono); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
    color: var(--score-low); background: var(--surface-2);
}
.score-high { color: var(--score-high); background: color-mix(in srgb, var(--score-high) 14%, transparent); }
.score-mid  { color: var(--score-mid);  background: color-mix(in srgb, var(--score-mid) 14%, transparent); }

.chip-warn { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--warning); }
.chip-danger { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--danger); }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.dot-placeholder { width: 9px; flex-shrink: 0; }

/* ---------- Alertes & toasts ---------- */
.alert {
    display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius);
    font-size: 14px; background: var(--surface-2);
}
.alert-error { background: var(--danger-tint); color: var(--danger); }
.alert-info { background: var(--accent-tint); color: var(--accent-text); }
.alert-warn { background: color-mix(in srgb, var(--st-a-postuler) 14%, transparent); color: var(--st-a-postuler-text); }

.toasts {
    position: fixed; z-index: 200; left: 50%; transform: translateX(-50%);
    bottom: calc(16px + env(safe-area-inset-bottom)); width: min(440px, calc(100% - 32px));
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
body.has-tabbar .toasts { bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); }
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px;
    border-radius: 14px; background: rgba(30,30,32,0.94); color: #fff; box-shadow: var(--shadow-lg);
    font-size: 14px; animation: toast-in .25s ease-out;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.toast .icon { color: #30D158; }
.toast.toast-error .icon { color: #FF6961; }
.toast .toast-msg { flex: 1; }
.toast .toast-action { color: #4DA3FF; font-weight: 600; padding: 6px 8px; border-radius: 6px; min-height: 36px; }
.toast .toast-close { color: rgba(255,255,255,0.6); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; }
.toast.leaving { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Menus (details/summary) ---------- */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 80; min-width: 220px; padding: 6px;
    background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); border: 0.5px solid var(--separator);
    animation: menu-in .14s ease-out;
}
.menu-panel.left { left: 0; right: auto; }
.menu-panel.up { top: auto; bottom: calc(100% + 6px); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px;
    border-radius: 8px; color: var(--label); font-size: 14px; text-align: left;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-hover); text-decoration: none; }
.menu-item.danger { color: var(--danger); }
.menu-item[aria-current="true"] { font-weight: 600; }
.menu-item .check-mark { margin-left: auto; color: var(--accent-text); }
.menu-sep { height: 0.5px; background: var(--separator); margin: 6px 4px; }
.menu-label { padding: 6px 10px 4px; font-size: 12px; color: var(--label-2); font-weight: 600; }
.menu-head { padding: 8px 10px; }
.menu-head .name { font-weight: 600; }
.menu-head .email { font-size: 13px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; }

/* ---------- Dialogue de confirmation ---------- */
dialog.sheet {
    border: 0; padding: 0; margin: auto; width: min(420px, calc(100% - 32px));
    background: var(--surface); color: var(--label); border-radius: 16px; box-shadow: var(--shadow-lg);
}
dialog.sheet::backdrop { background: rgba(0,0,0,0.4); backdrop-filter: blur(2px); }
dialog.sheet[open] { animation: dialog-in .2s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: scale(0.96); } }
.sheet-body { padding: 22px 22px 8px; }
.sheet-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.sheet-text { color: var(--label-2); font-size: 15px; }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 22px 20px; }
.sheet-actions .btn { min-width: 110px; }

/* ---------- États vides ---------- */
.empty { text-align: center; padding: 48px 24px; max-width: 420px; margin: 0 auto; }
.empty .icon-xl { margin: 0 auto 14px; color: var(--label-3); }
.empty h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.empty p { color: var(--label-2); margin-bottom: 18px; }

/* ---------- Auth ---------- */
.auth-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 48px 16px 32px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 28px; text-align: center; }
.auth-brand .brand-mark { width: 56px; height: 56px; border-radius: 14px; }
.auth-brand .brand-mark .icon { width: 30px; height: 30px; }
.auth-brand h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.auth-brand p { color: var(--label-2); max-width: 340px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card.wide { max-width: 560px; }
.auth-card .card-body { padding: 24px; }
.auth-footer { margin-top: 20px; text-align: center; font-size: 15px; color: var(--label-2); }
.steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; }
.steps span { height: 4px; width: 36px; border-radius: 4px; background: var(--surface-3); }
.steps span.done { background: var(--accent); }

/* ---------- Page offres ---------- */
.toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.toolbar-row { display: flex; gap: 8px; align-items: center; }
.toolbar-row .search { flex: 1; min-width: 0; }
.search .input { background: var(--surface); }
.search .kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.kbd {
    font-family: var(--mono); font-size: 12px; color: var(--label-2); border: 0.5px solid var(--separator-strong);
    border-radius: 5px; padding: 1px 6px; background: var(--surface-2); display: none;
}
.filters {
    display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px;
    -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
}
.filters::-webkit-scrollbar { display: none; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; min-height: 36px; border-radius: 100px;
    background: var(--surface); border: 0.5px solid var(--separator-strong); color: var(--label);
    font-size: 14px; font-weight: 500; white-space: nowrap; scroll-snap-align: start;
}
.filter-chip:hover { text-decoration: none; background: var(--surface-hover); }
.filter-chip .n { color: var(--label-2); font-variant-numeric: tabular-nums; font-weight: 500; }
.filter-chip[aria-current="true"] { background: var(--label); color: var(--surface); border-color: var(--label); }
.filter-chip[aria-current="true"] .n { color: inherit; opacity: 0.75; }
.filter-sep { width: 0.5px; background: var(--separator-strong); margin: 6px 4px; flex-shrink: 0; }

.list-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 4px 8px; font-size: 13px; color: var(--label-2); min-height: 36px; }

.offer-row { display: flex; align-items: stretch; gap: 0; min-height: 68px; }
.offer-row:hover { background: var(--surface-hover); }
.offer-row.is-selected { background: var(--accent-tint); }
.offer-select { display: flex; align-items: center; padding: 0 4px 0 14px; cursor: pointer; }
.offer-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 8px; color: var(--label); }
.offer-link:hover { text-decoration: none; }
.offer-main { flex: 1; min-width: 0; }
.offer-title { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offer-row.unread .offer-title { font-weight: 700; }
.offer-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 13px; color: var(--label-2); }
.offer-meta > span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.offer-meta .icon { width: 14px; height: 14px; color: var(--label-3); }
.offer-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.offer-actions { display: none; align-items: center; gap: 2px; padding-right: 10px; }
.offer-actions .btn { color: var(--label-2); }
.offer-actions .btn:hover { color: var(--label); }

.bulkbar {
    position: fixed; z-index: 70; left: 50%; transform: translateX(-50%);
    bottom: calc(16px + env(safe-area-inset-bottom)); width: min(680px, calc(100% - 24px));
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px;
    background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); border: 0.5px solid var(--separator);
    animation: toast-in .2s ease-out;
}
body.has-tabbar .bulkbar { bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)); }
.bulkbar .count { font-weight: 600; padding: 0 6px; }
.bulkbar .select { width: auto; min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 14px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; font-size: 14px; color: var(--label-2); }

/* ---------- Fiche offre ---------- */
.detail-head { margin-bottom: 16px; }
.detail-company { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.company-logo {
    width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
    font-weight: 700; font-size: 19px; color: #fff; background: linear-gradient(145deg, #636366, #3A3A3C);
}
.detail-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: var(--label-2); font-size: 14px; }
.detail-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.detail-meta .icon { width: 16px; height: 16px; }
.reason { margin-top: 12px; font-size: 13px; color: var(--label-2); display: flex; gap: 8px; align-items: flex-start; }
.reason .icon { width: 16px; height: 16px; margin-top: 2px; }

.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stepper button {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px;
    border-radius: 10px; font-size: 13px; font-weight: 500; color: var(--label-2); min-height: 64px;
}
.stepper button:hover { background: var(--surface-hover); color: var(--label); }
.stepper .step-dot {
    width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--separator-strong);
    background: var(--surface); color: #fff;
}
.stepper .step-dot .icon { width: 14px; height: 14px; stroke-width: 3; }
.stepper button.done .step-dot { background: var(--c); border-color: var(--c); }
.stepper button.current { color: var(--label); font-weight: 700; }
.stepper button.current .step-dot { background: var(--c); border-color: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent); }
.stepper-off { margin-top: 10px; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.next-action { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.next-action .text { flex: 1; min-width: 200px; }
.next-action .text strong { display: block; }

.prose { font-size: 15px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.prose.clamped[data-ready] { max-height: 18em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.expand-btn { margin-top: 8px; }

.detail-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
.detail-aside { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Pipeline / kanban ---------- */
.board {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 86vw); gap: 12px;
    overflow-x: auto; padding: 4px 16px 16px; margin: 0 -16px; scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch; align-items: start;
}
.column {
    background: var(--surface-2); border-radius: var(--radius-lg); padding: 10px; scroll-snap-align: center;
    display: flex; flex-direction: column; gap: 8px; min-height: 160px;
    border: 2px dashed transparent; transition: border-color .15s, background-color .15s;
}
:root[data-theme="dark"] .column { background: #141416; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .column { background: #141416; } }
.column.drop-target { border-color: var(--accent); background: var(--accent-tint); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 6px; font-weight: 700; font-size: 15px; }
.column-head .bar { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.column-head .n { color: var(--label-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.column-body { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.column-empty { font-size: 13px; color: var(--label-2); text-align: center; padding: 20px 8px; border-radius: 10px; }
.column-more { font-size: 13px; text-align: center; padding: 8px; }
.kcard {
    background: var(--surface); border-radius: 12px; padding: 12px; box-shadow: var(--shadow-sm);
    border: 0.5px solid var(--separator); position: relative; cursor: grab;
}
.kcard:hover { box-shadow: var(--shadow-md); }
.kcard.dragging { opacity: 0.4; }
.kcard.moving { opacity: 0.55; pointer-events: none; }
.kcard-title { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--label); padding-right: 34px; }
.kcard-title:hover { text-decoration: none; color: var(--accent-text); }
.kcard-title::after { content: ""; position: absolute; inset: 0; } /* toute la carte est cliquable */
.kcard-sub { font-size: 13px; color: var(--label-2); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--label-2); }
.kcard .menu { position: absolute; top: 6px; right: 6px; z-index: 2; }
.kcard .menu > summary { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--label-2); }
.kcard .menu > summary:hover { background: var(--surface-hover); }

/* ---------- Stats ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kpi { padding: 16px; }
.kpi-label { font-size: 13px; color: var(--label-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; line-height: 1.1; }
.kpi-note { font-size: 13px; color: var(--label-2); margin-top: 4px; }
.bars { list-style: none; display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.bars li { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; align-items: center; gap: 12px; font-size: 14px; }
.bars .bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .track { display: block; height: 10px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bars .fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); min-width: 2px; }
.bars .bv { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; min-width: 3ch; text-align: right; }
.bars li:hover .fill { filter: brightness(1.1); }
.funnel { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.funnel-step .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.funnel-step .top strong { font-variant-numeric: tabular-nums; font-size: 17px; }
.funnel-step .rate { font-size: 13px; color: var(--label-2); }
.funnel-step .track { height: 14px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.funnel-step .fill { height: 100%; border-radius: 4px; background: var(--c, var(--accent)); min-width: 2px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--label-2); padding: 10px 16px; border-bottom: 0.5px solid var(--separator); white-space: nowrap; }
.table td { padding: 10px 16px; border-bottom: 0.5px solid var(--separator); font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table td.zero { color: var(--label-3); }

/* ---------- Profil ---------- */
.subnav {
    position: sticky; top: var(--nav-h); z-index: 20; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
    padding: 10px 16px; margin: -8px -16px 8px; background: var(--bg);
}
.subnav::-webkit-scrollbar { display: none; }
.profile-layout { display: grid; grid-template-columns: 1fr; gap: 24px; }
.cv-box { display: flex; align-items: center; gap: 14px; padding: 16px; }
.cv-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-tint); color: var(--accent-text); flex-shrink: 0; }
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 16px; text-align: center;
    border: 1.5px dashed var(--separator-strong); border-radius: var(--radius); cursor: pointer; color: var(--label-2);
    transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-tint); }
.dropzone strong { color: var(--accent-text); }
.keywords { display: flex; flex-wrap: wrap; gap: 6px; }
.keywords span { font-size: 12px; padding: 3px 9px; border-radius: 100px; background: var(--surface-2); color: var(--label-2); }
.inline-form { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px 16px; }
.edit-panel { padding: 0 16px 16px; }

/* ---------- Responsive ---------- */
@media (min-width: 600px) {
    .field-row { grid-template-columns: 1fr 1fr; }
    .kpis { grid-template-columns: repeat(4, 1fr); }
    .board { grid-auto-columns: 300px; }
    .inline-form.cols-2 { grid-template-columns: 1fr 1fr auto; align-items: end; }
    .inline-form.cols-4 { grid-template-columns: 1fr 1fr 1fr auto; align-items: end; }
    .detail-title { font-size: 28px; }
}
@media (min-width: 900px) {
    body.has-tabbar { padding-bottom: 0; }
    .tabbar { display: none; }
    .topnav { display: flex; }
    .mobile-only { display: none !important; }
    .main { padding: 28px 24px 56px; }
    .main-wide { padding-left: 24px; padding-right: 24px; }
    .page-title { font-size: 32px; }
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .toolbar { flex-direction: row; align-items: center; flex-wrap: wrap; }
    .toolbar-row { flex: 1 1 360px; }
    .kbd { display: inline-block; }
    .filters { flex-wrap: wrap; overflow: visible; }
    .offer-actions { display: flex; opacity: 0; transition: opacity .12s; }
    .offer-row:hover .offer-actions, .offer-row:focus-within .offer-actions { opacity: 1; }
    body.has-tabbar .toasts, body.has-tabbar .bulkbar { bottom: 24px; }
    .board { margin: 0 -24px; padding: 4px 24px 24px; grid-auto-columns: minmax(210px, 1fr); }
    .detail-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
    .detail-aside { position: sticky; top: calc(var(--nav-h) + 20px); }
    .profile-layout { grid-template-columns: 200px minmax(0, 1fr); }
    .subnav { flex-direction: column; position: sticky; top: calc(var(--nav-h) + 24px); margin: 0; padding: 0; background: none; align-self: start; }
    .subnav .filter-chip { background: transparent; border-color: transparent; border-radius: 8px; justify-content: flex-start; }
    .subnav .filter-chip:hover { background: var(--surface-hover); }
    .subnav .filter-chip[aria-current="true"] { background: var(--surface); color: var(--label); border-color: var(--separator); box-shadow: var(--shadow-sm); }
}
@media (max-width: 899px) {
    .desktop-only { display: none !important; }
}
@media (max-width: 420px) {
    .offer-select { padding-left: 10px; }
    .kv { grid-template-columns: 1fr; gap: 2px; }
    .kv dd { margin-bottom: 8px; }
    .stepper button { font-size: 12px; }
}
@media (forced-colors: active) {
    .badge::before, .unread-dot, .step-dot { forced-color-adjust: none; }
}

/* Titres d'offre : 2 lignes sur mobile plutôt qu'une ellipse trop agressive */
@media (max-width: 599px) {
    .offer-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
