:root {
    --bg: #eef3f2;
    --surface: #ffffff;
    --ink: #142226;
    --muted: #5d6b6e;
    --line: #d7e0df;
    --accent: #0f5c7a;
    --accent-strong: #0a3f54;
    --soft: #e7f1f5;
    --green: #1c6b34;
    --green-bg: #e3f3e6;
    --orange: #9a5b0a;
    --orange-bg: #fbeedd;
    --red: #b3261e;
    --red-bg: #fbe6e4;
    --gray: #5b6664;
    --gray-bg: #eceeed;
    --shadow: 0 10px 30px rgba(15, 40, 48, 0.06);
    --radius: 16px;
    --font: 'Inter', -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: var(--font);
    background:
        radial-gradient(900px 420px at 100% -10%, var(--glow, #d7ebf3) 0%, transparent 55%),
        var(--bg);
    color: var(--ink);
    line-height: 1.5;
}
a { color: var(--accent); }
h2 { margin: 0; font-size: 1.05rem; font-weight: 650; }
.dash { min-height: 100vh; }
.dash-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 28px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong, .brand em { display: block; }
.brand strong { font-size: 1.05rem; letter-spacing: -0.02em; }
.brand em { font-style: normal; color: var(--muted); font-size: 0.82rem; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 12px;
    background: var(--accent); color: #fff;
    display: grid; place-items: center; font-weight: 700;
}
.brand-logo {
    height: 72px; width: auto; display: block;
    background: #fff; border-radius: 12px;
}
.dash-top-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.88rem; }
.dot { width: 4px; height: 4px; border-radius: 50%; background: #b7c4c7; }
.text-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.dash-main { width: min(1240px, calc(100% - 40px)); margin: 0 auto 40px; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 0.92rem; }
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-error { background: var(--red-bg); color: var(--red); }

.runway { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; margin-bottom: 16px; }
.runway-panel, .kpi-card, .card {
    background: var(--surface);
    border: 1px solid rgba(15, 60, 74, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.runway-panel { padding: 22px 24px; }
.runway-kicker, .kpi-label {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.runway-amount { margin: 0; font-size: 2.7rem; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.runway-amount span { font-size: 1rem; color: var(--muted); margin-left: 4px; }
.runway-months { margin: 0 0 8px; font-size: 2.2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.runway-months span, .runway-months em { font-size: 1rem; font-weight: 600; }
.runway-months em { font-style: normal; color: var(--muted); margin-left: 6px; }
.runway-panel p { margin: 8px 0 0; }
.muted { color: var(--muted); font-size: 0.9rem; }
.month-track { display: flex; gap: 5px; margin-top: 16px; }
.month-cell { flex: 1; height: 8px; border-radius: 99px; background: #e4ecee; overflow: hidden; }
.month-cell > span { display: block; height: 100%; background: var(--accent); }
.runway-ok .runway-months, .runway-ok .month-cell > span { color: var(--green); background: var(--green); }
.runway-ok .runway-months { background: none; }
.runway-warn .runway-months { color: var(--orange); background: none; }
.runway-warn .month-cell > span { background: var(--orange); }
.runway-danger .runway-months { color: var(--red); background: none; }
.runway-danger .month-cell > span { background: var(--red); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.pie-card { display: flex; gap: 28px; align-items: center; }
.pie {
    width: 168px; height: 168px; border-radius: 50%; flex: none;
    display: grid; place-items: center;
    background: conic-gradient(var(--accent) 0 var(--part), #d5e4ea var(--part) 100%);
}
.pie-center {
    width: 112px; height: 112px; border-radius: 50%; background: var(--surface);
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.pie-center b { font-size: 1.25rem; line-height: 1.1; }
.pie-center small { color: var(--muted); font-size: 0.72rem; }
.speak { margin: 10px 0 0; font-size: 1rem; line-height: 1.45; }
.theme-btn {
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.82rem; font-weight: 650; cursor: pointer;
}
[data-theme="dark"] {
    --bg: #10181c;
    --surface: #1a2429;
    --ink: #e7eef0;
    --muted: #9aadae;
    --line: #2c3a40;
    --accent: #7eb8d4;
    --accent-strong: #d5eaf3;
    --soft: #24343b;
    --glow: #16303a;
    --green: #8dcea0;
    --green-bg: #1c3324;
    --orange: #e2b36a;
    --orange-bg: #3a2c16;
    --red: #f0a39c;
    --red-bg: #3a201e;
    --gray: #c5cfcc;
    --gray-bg: #2a3331;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .month-cell { background: #2a363b; }
[data-theme="dark"] .pie { background: conic-gradient(var(--accent) 0 var(--part), #314047 var(--part) 100%); }
[data-theme="dark"] .swatch-espoir { background: #314047; border-color: #46555b; }
[data-theme="dark"] .table-foot td,
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea { background: #141c20; color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .composer,
[data-theme="dark"] .chip { background: #141c20; }
.pie-empty { background: #e4ecee; }
.pie-legend { list-style: none; margin: 0; padding: 0; }
.pie-legend li { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 0.92rem; }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.swatch-dispo { background: var(--accent); }
.swatch-espoir { background: #d5e4ea; border: 1px solid #b7c9d0; }
.kpi-card { padding: 16px 18px; }
.kpi-value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.card { padding: 20px 22px; margin-bottom: 16px; }
.section-head { margin-bottom: 14px; }
.section-head p { margin: 4px 0 0; }
.split { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 16px; align-items: start; }
.split .card { margin-bottom: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { background: var(--soft); color: var(--accent-strong); border-radius: 99px; padding: 4px 10px; font-size: 0.78rem; }
.chip strong { font-variant-numeric: tabular-nums; }
.filter-row, .grid-2, .grid-3 { display: grid; gap: 12px; }
.filter-row { grid-template-columns: 1.1fr 0.8fr 0.8fr 1.3fr auto; align-items: end; margin-bottom: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
label { display: block; margin: 0 0 6px; font-size: 0.8rem; font-weight: 650; color: var(--muted); }
input, select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
    font: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #b7d4e2; border-color: var(--accent); }
.composer { border: 1px dashed #c5d5da; border-radius: 12px; padding: 10px 14px; margin: 8px 0 14px; background: #f7fbfc; }
.composer summary { cursor: pointer; font-weight: 650; font-size: 0.92rem; }
.composer[open] summary { margin-bottom: 8px; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 10px; padding: 9px 14px; cursor: pointer;
    background: var(--accent); color: #fff; font: inherit; font-size: 0.86rem; font-weight: 650;
    text-decoration: none;
}
.btn:hover { background: var(--accent-strong); }
.btn-sm { padding: 6px 10px; font-size: 0.78rem; }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { background: #f4f7f8; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-danger { background: var(--red); }
.btn-danger:hover { filter: brightness(0.95); }
.table-wrap { overflow-x: auto; margin: 0 -6px; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #edf2f3; font-size: 0.88rem; vertical-align: middle; }
th { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }
tbody tr:hover { background: #f7fbfc; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-title { display: block; font-weight: 650; }
.cell-sub { display: block; color: var(--muted); font-size: 0.78rem; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table-foot td { font-weight: 700; background: #f7fbfc; border-bottom: 0; }
.badge { display: inline-flex; padding: 3px 9px; border-radius: 99px; font-size: 0.75rem; font-weight: 700; }
.badge-communique { background: var(--green-bg); color: var(--green); }
.badge-brouillon { background: var(--orange-bg); color: var(--orange); }
.badge-archive { background: var(--gray-bg); color: var(--gray); }
.empty-state { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty-state .icon { width: 36px; height: 36px; }
.empty-state p { margin: 8px 0 0; }
.confirm-modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; }
.confirm-modal[hidden] { display: none; }
.confirm-modal-backdrop { position: absolute; inset: 0; background: rgba(12, 24, 28, 0.45); }
.confirm-modal-box { position: relative; background: #fff; border-radius: 16px; padding: 20px; width: min(380px, calc(100% - 32px)); box-shadow: var(--shadow); }
.confirm-modal-box p { margin: 0 0 8px; }
@media (max-width: 980px) {
    .runway, .kpi-grid, .split, .filter-row, .grid-3 { grid-template-columns: 1fr; }
    .dash-top { flex-direction: column; align-items: flex-start; }
    .runway-amount { font-size: 2.1rem; }
}
