/* MonBudget V2 — système de design « fintech épurée » (maquettes du 20/10/2026).
   Aucun style en ligne : la politique CSP du site n'autorise que cette feuille. */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../fonts/inter-latin-wght.woff2") format("woff2-variations"), url("../fonts/inter-latin-wght.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --bg: #F7F8FA;
    --surface: #FFFFFF;
    --surface-2: #F9FAFB;
    --border: #E4E7EC;
    --border-soft: #F2F4F7;
    --border-input: #D0D5DD;
    --text: #101828;
    --text-2: #475467;
    --text-3: #344054;
    --muted: #667085;
    --accent: #4F46E5;
    --accent-strong: #3730A3;
    --accent-soft: #EEF2FF;
    --accent-line: #C7D2FE;
    --row-selected: #F5F7FF;
    --pos: #067647;   --pos-bg: #ECFDF3;  --pos-line: #ABEFC6;  --pos-ink: #054F31;
    --neg: #B42318;   --neg-bg: #FEF3F2;  --neg-line: #FDA29B;
    --warn: #B54708;  --warn-bg: #FFFAEB; --warn-line: #FEDF89; --warn-ink: #7A2E0E;
    --save: #0E7490;  --save-bg: #ECFEFF;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
    --sidebar: 264px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-feature-settings: "tnum" 1, "cv11" 1;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--border-soft); padding: 1px 6px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ── Coque de l'application ─────────────────────────────── */
.app {
    display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh;
    /* colonne blanche de la barre latérale sur toute la hauteur, même quand la page défile */
    background: linear-gradient(to right, var(--surface) calc(var(--sidebar) - 1px), var(--border) calc(var(--sidebar) - 1px), var(--border) var(--sidebar), transparent var(--sidebar));
}
.sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--surface); border-right: 1px solid var(--border);
    padding: 20px 16px; display: flex; flex-direction: column; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--text); text-decoration: none; font-size: 16px; font-weight: 700; }
.brand:hover { color: var(--text); }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.brand-tag { font-size: 11px; font-weight: 600; color: var(--accent-strong); background: var(--accent-soft); border-radius: 999px; padding: 1px 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: var(--radius);
    color: var(--text-3); text-decoration: none; font-size: 14px; font-weight: 500;
}
.nav-item svg { flex: none; }
.nav-item:hover { background: var(--border-soft); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }
.nav-item.is-soon { color: var(--muted); cursor: default; }
.nav-item.is-soon:hover { background: none; color: var(--muted); }
.nav-label { flex: 1; }
.nav-count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.nav-soon { font-size: 11px; font-weight: 500; color: var(--muted); }
.nav-sep { height: 1px; background: var(--border); margin: 10px 4px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.sidebar-foot form { margin: 0; }

.main { padding: 32px 40px 48px; display: flex; flex-direction: column; gap: 24px; min-width: 0; max-width: 1360px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.page-sub { margin-top: 4px; font-size: 14px; color: var(--text-2); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: 13px; color: var(--text-2); }
.breadcrumb a { text-decoration: none; }

/* Page sans barre latérale (connexion, erreur hors session) */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 400px; }

/* ── Cartes ─────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.card-flush { padding: 0; gap: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-flush > .card-head { padding: 16px 24px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 16px; font-weight: 600; }
.card-link { font-size: 13px; font-weight: 600; text-decoration: none; }
.card-foot { padding: 12px 24px; font-size: 13px; color: var(--text-2); display: flex; flex-direction: column; gap: 12px; }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 24px; }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.kpi-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.kpi-sub { font-size: 13px; color: var(--text-2); }

/* Étapes du point hebdomadaire */
.step { display: flex; gap: 12px; padding: 14px; border-radius: 10px; border: 1px solid var(--border); align-items: flex-start; }
.step-body { flex: 1; min-width: 0; }
.step-title { font-size: 14px; font-weight: 600; }
.step-text { font-size: 13px; color: var(--text-2); }
.step-mark { width: 24px; height: 24px; flex: none; border-radius: 999px; border: 2px solid #98A2B3; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--text-2); }
.step-link { align-self: center; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.step.is-done { border-color: var(--pos-line); background: var(--pos-bg); }
.step.is-done .step-mark { background: var(--pos); border-color: var(--pos); }
.step.is-done .step-text { color: var(--pos-ink); }
.step.is-todo { border-color: var(--warn-line); background: var(--warn-bg); }
.step.is-todo .step-mark { border-color: var(--warn); color: var(--warn); }
.step.is-todo .step-text { color: var(--warn-ink); }

/* Liste clé / valeur (soldes) */
.kv { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.kv-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv-row dt { color: var(--text); }
.kv-row dd { margin: 0; font-weight: 600; text-align: right; }
.kv-group { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); padding-top: 6px; }
.kv-note { font-size: 12px; color: var(--text-2); font-weight: 400; }

/* ── Boutons ────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 16px; border-radius: var(--radius); border: 1px solid transparent;
    font: 600 14px/1 "Inter", system-ui, sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #FFFFFF; }
.btn-primary:hover { background: var(--accent-strong); color: #FFFFFF; }
.btn-secondary { background: var(--surface); color: var(--text-3); border-color: var(--border-input); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-soft { background: var(--accent-soft); color: var(--accent-strong); }
.btn-danger { background: var(--surface); color: var(--neg); border-color: var(--neg-line); }
.btn-danger:hover { background: var(--neg-bg); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; min-height: 44px; }
.btn-ghost { background: none; border: 0; color: var(--text-2); padding: 0 12px; min-height: 40px; font: 500 14px "Inter", system-ui, sans-serif; cursor: pointer; border-radius: var(--radius); display: flex; align-items: center; gap: 10px; width: 100%; }
.btn-ghost:hover { background: var(--border-soft); color: var(--text); }

/* ── Formulaires ────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-3); }
.input, .select {
    height: 40px; width: 100%; padding: 0 12px; border: 1px solid var(--border-input); border-radius: var(--radius);
    font: 14px "Inter", system-ui, sans-serif; color: var(--text); background: var(--surface);
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { font-size: 13px; color: var(--text-2); font-weight: 400; }
.form { display: flex; flex-direction: column; gap: 16px; }
.inline { display: inline; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
    padding: 28px 20px; border: 1.5px dashed var(--border-input); border-radius: var(--radius-lg); background: var(--surface-2);
}
.dropzone-icon { width: 44px; height: 44px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.dropzone input[type=file] { font: 14px "Inter", system-ui, sans-serif; color: var(--text-2); max-width: 100%; }
.dropzone input[type=file]::file-selector-button {
    margin-right: 12px; min-height: 36px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--border-input);
    background: var(--surface); color: var(--text-3); font: 600 13px "Inter", system-ui, sans-serif; cursor: pointer;
}

/* ── Badges, alertes ────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.badge-accent { background: var(--accent-soft); color: var(--accent-strong); }
.badge-neutral { background: var(--border-soft); color: var(--text-3); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-pos { background: var(--pos-bg); color: var(--pos); }
.badge-neg { background: var(--neg-bg); color: var(--neg); }
.badge-save { background: var(--save-bg); color: var(--save); }
a.tag-note { text-decoration: none; }
a.tag-note:hover { border-color: var(--accent); color: var(--accent-strong); }
.tag-note { white-space: nowrap; display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; border: 1px dashed #98A2B3; color: var(--text-2); font-size: 12px; font-weight: 500; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid; font-size: 14px; }
.alert-icon { width: 22px; height: 22px; flex: none; border-radius: 999px; display: flex; align-items: center; justify-content: center; color: #FFFFFF; }
.alert strong { font-weight: 600; }
.alert-ok { background: var(--pos-bg); border-color: var(--pos-line); color: var(--pos-ink); }
.alert-ok .alert-icon { background: var(--pos); }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.alert-warn .alert-icon { background: var(--warn); }
.alert-error { background: var(--neg-bg); border-color: var(--neg-line); color: var(--neg); }
.alert-error .alert-icon { background: var(--neg); }
.alert-info { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
.alert-info .alert-icon { background: var(--accent); }

/* ── Tableaux (densité confortable : lignes de 52 px) ───── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    height: 44px; padding: 0 16px; text-align: left; background: var(--surface-2); border-bottom: 1px solid var(--border);
    font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.table td { height: 52px; padding: 6px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 24px; }
.table th:last-child, .table td:last-child { padding-right: 24px; }
.table tbody tr:hover { background: var(--row-selected); }
.table .num { text-align: right; white-space: nowrap; }
.table .date { color: var(--text-2); white-space: nowrap; }
.table .strong { font-weight: 500; }
.table .sub { display: block; font-size: 12px; color: var(--text-2); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .status { flex-wrap: nowrap; justify-content: flex-end; }

.amount { font-weight: 500; white-space: nowrap; color: var(--text-2); }
.amount.neg { color: var(--neg); }
.amount.pos { color: var(--pos); }

.muted { color: var(--text-2); }
.empty { padding: 32px 24px; text-align: center; color: var(--text-2); }
.text-ok { color: var(--pos); font-weight: 600; }
.text-accent { color: var(--accent-strong); font-weight: 600; }
.text-warn { color: var(--warn); font-weight: 600; }
.status { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── À catégoriser ──────────────────────────────────────── */
.work { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.tab { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: var(--radius); color: var(--text-2); font-size: 13px; font-weight: 600; text-decoration: none; }
.tab:hover { background: var(--border-soft); color: var(--text); }
.tab[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }
.queue { list-style: none; margin: 0; padding: 0; }
.queue-item { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.queue-item:last-child { border-bottom: 0; }
.queue-item .date { color: var(--text-2); white-space: nowrap; }
.queue-item.is-selected { background: var(--row-selected); box-shadow: inset 3px 0 0 var(--accent); }
.queue-label { min-width: 0; }
.queue-label a { color: var(--text); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.queue-label a:hover { color: var(--accent); }
.queue-label .sub { display: block; font-size: 12px; color: var(--text-2); }
.queue-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.panel { position: sticky; top: 24px; box-shadow: var(--shadow); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.rule { border: 0; border-top: 1px solid var(--border); margin: 0; padding: 16px 0 0; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rule legend { padding: 0; margin-bottom: 14px; float: left; width: 100%; }
.rule legend .check { font-size: 14px; font-weight: 600; color: var(--text); }
.check-list { display: flex; flex-direction: column; gap: 6px; padding-top: 2px; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 1100px) { .work { grid-template-columns: 1fr; } .panel { position: static; } }
@media (max-width: 640px) { .queue-item { grid-template-columns: 1fr auto; } .queue-item .date { grid-column: 1 / -1; } .queue-actions { grid-column: 1 / -1; justify-content: flex-start; } }

/* ── Opérations ─────────────────────────────────────────── */
.filters { gap: 16px; }
.filters-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.filters-grid .span-2 { grid-column: span 2; }
.filters-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.multi { position: relative; }
.multi > summary { list-style: none; display: flex; align-items: center; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 28px; }
.multi > summary::-webkit-details-marker { display: none; }
.multi > summary::after { content: "▾"; position: absolute; right: 12px; color: var(--text-2); }
.multi-list { position: absolute; z-index: 20; top: 44px; left: 0; min-width: 100%; width: max-content; max-width: 360px; max-height: 320px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 24, 40, .12); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.bulkbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.bulkbar-label { font-size: 13px; font-weight: 600; color: var(--text-3); margin-right: 4px; }
.select-sm, .input-sm { height: 32px; font-size: 13px; width: auto; min-width: 150px; }
.table-ops .col-check { width: 44px; padding-right: 0; }
.table-ops .col-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.table tr.is-ignored td { opacity: .5; }
.table tr.is-selected { background: var(--row-selected); box-shadow: inset 3px 0 0 var(--accent); }
.row-link { color: var(--text); font-weight: 500; text-decoration: none; }
.row-link:hover { color: var(--accent); text-decoration: underline; }
.sort { color: inherit; text-decoration: none; }
.sort:hover { color: var(--text); }
.pager { flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--border); }
.edit-panel { border-color: var(--accent-line); box-shadow: var(--shadow); }
.edit-grid { display: grid; grid-template-columns: 2fr 2fr 1fr; gap: 12px 16px; align-items: end; }
.edit-grid > .check { grid-column: 1 / 3; }
.edit-actions { display: flex; justify-content: flex-end; }
.edit-grid .span-all { grid-column: 1 / -1; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 20px; padding-top: 4px; }
.field .check { font-weight: 500; }
.tabs-page { padding: 0; border-bottom: 1px solid var(--border); gap: 4px; }
.tabs-page .tab { border-radius: var(--radius) var(--radius) 0 0; min-height: 40px; padding: 0 16px; font-size: 14px; }
.tabs-page .tab[aria-current="page"] { background: none; color: var(--accent-strong); box-shadow: inset 0 -2px 0 var(--accent); }
.table td.indent { padding-left: 48px; }
.table td.indent::before { content: "↳ "; color: var(--muted); }
.rule-preview { border-top: 1px solid var(--border); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.danger-zone { border-top: 1px solid var(--border); padding-top: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.kpi-value.amount { font-weight: 600; }
@media (max-width: 1100px) { .filters-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .edit-grid { grid-template-columns: 1fr; } .edit-grid > .check, .edit-grid .span-all { grid-column: auto; } .filters-grid { grid-template-columns: 1fr 1fr; } .filters-grid .span-2 { grid-column: 1 / -1; } }

/* ── Budget ─────────────────────────────────────────────── */
.budget-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.budget-list li { display: flex; flex-direction: column; gap: 6px; }
.budget-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; flex-wrap: wrap; }
.budget-line .row-link { font-weight: 500; }
.bar { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: 999px; background: var(--border-soft); overflow: hidden; color: var(--accent); }
.bar::-webkit-progress-bar { background: var(--border-soft); border-radius: 999px; }
.bar::-webkit-progress-value { background: currentColor; border-radius: 999px; }
.bar::-moz-progress-bar { background: currentColor; border-radius: 999px; }
.bar-ok { color: var(--accent); }
.bar-warn { color: #F79009; } /* ambre plus clair que le texte d'alerte : bien distinct du rouge */
.bar-neg { color: var(--neg); }
.bar-pos { color: var(--pos); }
.bar-wrap { position: relative; }
.bar-wrap:not([class*="mk"])::after { display: none; }
.bar-wrap::after { content: ""; position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; }
.mk-1::after { left: 8.333%; }
.mk-2::after { left: 16.667%; }
.mk-3::after { left: 25.0%; }
.mk-4::after { left: 33.333%; }
.mk-5::after { left: 41.667%; }
.mk-6::after { left: 50.0%; }
.mk-7::after { left: 58.333%; }
.mk-8::after { left: 66.667%; }
.mk-9::after { left: 75.0%; }
.mk-10::after { left: 83.333%; }
.mk-11::after { left: 91.667%; }
.mk-12::after { left: 100.0%; }
.mkp-0::after { left: 0%; }
.mkp-5::after { left: 5%; }
.mkp-10::after { left: 10%; }
.mkp-15::after { left: 15%; }
.mkp-20::after { left: 20%; }
.mkp-25::after { left: 25%; }
.mkp-30::after { left: 30%; }
.mkp-35::after { left: 35%; }
.mkp-40::after { left: 40%; }
.mkp-45::after { left: 45%; }
.mkp-50::after { left: 50%; }
.mkp-55::after { left: 55%; }
.mkp-60::after { left: 60%; }
.mkp-65::after { left: 65%; }
.mkp-70::after { left: 70%; }
.mkp-75::after { left: 75%; }
.mkp-80::after { left: 80%; }
.mkp-85::after { left: 85%; }
.mkp-90::after { left: 90%; }
.mkp-95::after { left: 95%; }
.mkp-100::after { left: 100%; }
.amount-cell { display: flex; align-items: center; gap: 6px; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; padding: 0; border: 1px solid var(--border-input); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; }
.btn-icon:hover, .btn-icon[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.btn-icon.is-set { color: var(--accent); }
.btn-icon[hidden] { display: none; }
.table-budget td:first-child { min-width: 240px; }
.table .sub.ech-resume { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.table-budget tr.ech-row > td { padding-top: 0; background: var(--surface-2); }
.ech-panel { display: flex; flex-direction: column; gap: 10px; padding: 12px 0 4px; }
.ech-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.ech-grid { display: grid; grid-template-columns: repeat(12, minmax(72px, 1fr)); gap: 6px; }
.ech-cell { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
.ech-cell .input { width: 100%; }
@media (max-width: 1100px) { .ech-grid { grid-template-columns: repeat(6, minmax(72px, 1fr)); } }
@media (max-width: 720px) { .ech-grid { grid-template-columns: repeat(3, minmax(64px, 1fr)); } }
.text-neg { color: var(--neg); font-weight: 600; }
.table .group-row th { background: var(--surface); color: var(--accent-strong); font-size: 12px; height: 40px; border-bottom: 1px solid var(--border); }
.input-amount { width: 120px; min-width: 0; text-align: right; }
.push-right { margin-left: auto; }

/* ── Reste à vivre ──────────────────────────────────────── */
.kpi-link { color: inherit; text-decoration: none; }
.kpi-link:hover { border-color: var(--accent-line); color: inherit; }
.rav-total { text-align: right; }
.rav-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; border-top: 1px solid var(--border); padding-top: 16px; }
.rav-amount { font-size: 20px; font-weight: 600; margin: 2px 0 8px; }
.rav-detail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.rav-detail li { display: flex; justify-content: space-between; gap: 8px; }
@media (max-width: 1100px) { .rav-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .rav-grid { grid-template-columns: 1fr; } .rav-total { text-align: left; } }

/* ── Volet latéral (modification d'une opération) ───────── */
body:has(.drawer) { overflow: hidden; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(16, 24, 40, .45); cursor: default; animation: fade-in .15s ease-out; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(460px, 100%); overflow-y: auto;
    background: var(--surface); border-left: 1px solid var(--border); box-shadow: -12px 0 32px rgba(16, 24, 40, .18);
    padding: 24px; display: flex; flex-direction: column; gap: 20px; animation: slide-in .2s ease-out; }
.drawer .edit-grid { grid-template-columns: 1fr; }
.drawer .edit-grid > .check { grid-column: auto; }
.drawer .edit-actions { justify-content: stretch; }
.drawer .edit-actions .btn { width: 100%; }
.drawer .card-head { align-items: flex-start; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-backdrop { animation: none; } }

/* ── Sélecteur de période ───────────────────────────────── */
.period-panel { position: absolute; z-index: 20; top: 44px; left: 0; width: 520px; max-width: calc(100vw - 32px);
    display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: 0 8px 24px rgba(16, 24, 40, .12); overflow: hidden; }
.period-presets { list-style: none; margin: 0; padding: 8px 0; border-right: 1px solid var(--border); }
.period-preset { display: block; width: 100%; text-align: left; padding: 10px 20px; border: 0; background: none; cursor: pointer;
    font: 400 14px "Inter", system-ui, sans-serif; color: var(--text-3); }
.period-preset:hover { background: var(--border-soft); color: var(--text); }
.period-preset[aria-current="true"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.period-custom { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 560px) { .period-panel { grid-template-columns: 1fr; } .period-presets { border-right: 0; border-bottom: 1px solid var(--border); } }

/* ── Écrans étroits ─────────────────────────────────────── */
@media (max-width: 1100px) {
    .grid-2 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; background: none; }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .nav-item.is-soon, .nav-sep { display: none; }
    .sidebar-foot { margin: 0 0 0 auto; }
    .main { padding: 24px 16px 40px; }
    .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .grid-4 { grid-template-columns: 1fr; }
    .page-title { font-size: 24px; }
}

/* ── Analyse : graphique mensuel en SVG ─────────────────────── */
.chart-wrap { width: 100%; overflow: hidden; }
.chart { display: block; width: 100%; height: auto; font-family: inherit; }
.chart .grid { stroke: var(--border-soft); stroke-width: 1; }
.chart .grid-zero { stroke: var(--border); }
.chart .tick { font-size: 11px; fill: var(--muted); }
.chart .hit { fill: var(--text); fill-opacity: 0; }
.chart .col:hover .hit, .chart .col:focus .hit { fill-opacity: .05; }
.chart .col { cursor: pointer; outline: none; }
.chart .mark, .chart .line, .chart .dot, .chart .ref { pointer-events: none; }
.chart .partiel { fill-opacity: .55; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.ref { fill: none; }
.ref-moyenne { stroke: var(--text-2); stroke-width: 1.5; stroke-dasharray: 5 4; }
.ref-budget { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--text-3); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; flex: none; vertical-align: -1px; }
.swatch-line { width: 18px; }
.multi-group { padding: 8px 4px 2px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.multi-list .check.indent { padding-left: 16px; }
.table-analyse th[scope=col] { white-space: nowrap; }
.table-analyse tfoot th, .table-analyse tfoot td { border-top: 1px solid var(--border); font-weight: 500; }
.table-analyse tr.is-partial th, .table-analyse tr.is-partial td { background: var(--surface-2); }
.cell-link { color: inherit; text-decoration: none; }
.cell-link:hover { color: var(--accent); text-decoration: underline; }
.text-plus { color: #c4363a; font-weight: 500; }
.text-moins { color: #1f62b3; font-weight: 500; }
.chart .val { font-size: 11px; fill: var(--text-2); font-variant-numeric: tabular-nums; }
.multi-hint { margin: 2px 4px 6px; }
.suivi-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.suivi-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.suivi-head { padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.suivi-title { margin: 0; font-size: 17px; font-weight: 600; color: var(--text); }
.suivi-title .muted { font-weight: 400; font-size: 14px; }
.sub-title { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.annuel-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
@media (max-width: 1100px) { .suivi-cols { grid-template-columns: 1fr; } }
.gauge { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.bar-lg { height: 12px; }
.bar-wrap:has(.bar-lg)::after { top: -4px; bottom: -4px; }
.annuel-meta svg { vertical-align: -2px; }
.table-cumul { font-size: 13px; }
.table-cumul th, .table-cumul td { padding: 8px 0 8px 12px; }
.table-cumul th:first-child, .table-cumul td:first-child { padding-left: 0; }
.recap-mois { display: flex; flex-direction: column; gap: 12px; }
.kpi-total { border-color: var(--accent-line); background: var(--accent-soft); }
