/* =========================================================
   BIECE-AE — Espaces connectés & back-office (maquette)
   S'appuie sur les jetons et composants de styles.css
   ========================================================= */

:root {
  /* Palette des graphiques — validée (lightness, chroma, CVD, contraste) */
  --c-ok: #13904a;      /* validé / admis */
  --c-info: #3159d6;    /* en évaluation */
  --c-wait: #b98a00;    /* incomplet / en attente */
  --c-bad: #c0262d;     /* refusé */
  --c-neutral: #8a929d; /* brouillon (toujours libellé) */
  --sidebar: 268px;
  --topbar: 72px;
}

.app-body { background: #f4f2ec; }
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

/* ---------- Barre latérale ---------- */
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin;
  background: var(--forest-950); color: rgba(255,255,255,.88);
  display: flex; flex-direction: column; padding: 20px 14px; z-index: 60;
}
.sidebar .brand { padding: 0 8px 18px; }
.sidebar .brand-logo { width: 40px; height: 40px; border-radius: 12px; }
.sidebar .brand-text strong { font-size: 18px; }
.space-chip { display: flex; align-items: center; gap: 10px; margin: 0 4px 18px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.space-chip .sc-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--lime); color: var(--forest-ink); flex: none; }
.space-chip .sc-ic .icon { width: 18px; height: 18px; }
.space-chip b { display: block; color: var(--white); font-size: 13px; }
.space-chip small { font-size: 11px; }
.side-group { margin-top: 6px; }
.side-group > span { display: block; padding: 14px 12px 6px; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.35); }
.side-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 600; color: rgba(255,255,255,.7); transition: background .2s, color .2s; position: relative; }
.side-link .icon { width: 18px; height: 18px; }
.side-link:hover { background: rgba(255,255,255,.06); color: var(--white); }
.side-link.active { background: rgba(201,242,100,.12); color: var(--white); }
.side-link.active .icon { color: var(--lime); }
.side-link.active::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--lime); }
.side-link .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: rgba(255,255,255,.1); color: var(--white); }
.side-link .count.hot { background: var(--lime); color: var(--forest-ink); }
.side-foot { margin-top: auto; padding-top: 20px; display: grid; gap: 10px; }
.help-card { padding: 16px; border-radius: 14px; background: linear-gradient(135deg, rgba(31,174,90,.25), rgba(49,89,214,.25)); border: 1px solid rgba(255,255,255,.1); font-size: 13px; }
.help-card b { display: block; color: var(--white); font-size: 14px; margin-bottom: 4px; }
.help-card a { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--lime); font-weight: 700; }
.help-card a .icon { width: 14px; height: 14px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; }
.side-user:hover { background: rgba(255,255,255,.05); }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; background: var(--lime); color: var(--forest-ink); }
.side-user b { display: block; color: var(--white); font-size: 13px; }
.side-user small { font-size: 11px; }
.side-user .icon { margin-left: auto; width: 16px; height: 16px; }

/* ---------- Barre du haut ---------- */
.app-main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar);
  display: flex; align-items: center; gap: 16px; padding: 0 28px;
  background: rgba(244,242,236,.88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.tb-menu { display: none; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); place-items: center; }
.tb-title { min-width: 0; }
.tb-title small { display: block; font-size: 12px; color: var(--slate-400); font-weight: 600; }
.tb-title h1 { font-size: 22px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search { margin-left: auto; display: flex; align-items: center; gap: 10px; height: 44px; width: min(340px, 30vw); padding: 0 14px; border-radius: 12px; background: var(--white); border: 1px solid var(--line); color: var(--slate-400); }
.tb-search input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 14px; outline: none; color: var(--ink); }
.tb-search kbd { font: inherit; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--sand); color: var(--slate-500); }
.tb-switch { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border-radius: 12px; background: var(--forest-900); color: var(--white); font-size: 13px; font-weight: 600; }
.tb-switch .icon { width: 16px; height: 16px; color: var(--lime); }
.tb-switch select { background: none; border: 0; color: var(--white); font: inherit; font-weight: 700; cursor: pointer; outline: none; }
.tb-switch select option { color: var(--ink); }
.tb-btn { position: relative; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); display: grid; place-items: center; color: var(--slate-700); }
.tb-btn:hover { border-color: var(--forest-900); }
.tb-btn .dot { position: absolute; top: 9px; right: 10px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--c-bad); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--white); }
.tb-user { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--white); }
.tb-user b { font-size: 13px; color: var(--ink); }
.tb-user .icon { width: 16px; height: 16px; color: var(--slate-400); }
.pop-wrap { position: relative; }
.popover { position: absolute; right: 0; top: calc(100% + 10px); width: 360px; background: var(--white); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--line); opacity: 0; visibility: hidden; translate: 0 6px; transition: opacity .2s, translate .2s, visibility .2s; z-index: 80; overflow: hidden; }
.popover.open { opacity: 1; visibility: visible; translate: 0 0; }
.pop-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.pop-head h3 { font-size: 16px; }
.pop-head button { background: none; border: 0; color: var(--green-600); font-weight: 700; font-size: 12px; }
.notif { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--sand-2); font-size: 13px; color: var(--slate-700); }
.notif:hover { background: var(--sand); }
.notif .n-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.notif .n-ic .icon { width: 16px; height: 16px; }
.notif b { display: block; color: var(--ink); font-size: 13px; }
.notif small { color: var(--slate-400); font-size: 11px; }
.notif.unread { background: #fbfdf7; }
.notif.unread b::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green-500); margin-left: 6px; vertical-align: middle; }
.pop-foot { display: block; text-align: center; padding: 12px; font-size: 13px; font-weight: 700; color: var(--green-600); }
.menu-list { padding: 8px; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 0; background: none; font-size: 14px; color: var(--slate-700); text-align: left; }
.menu-list a:hover, .menu-list button:hover { background: var(--sand); }
.menu-list .icon { width: 16px; height: 16px; color: var(--slate-400); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.popover.small { width: 240px; }

/* ---------- Contenu ---------- */
.app-content { padding: 28px; flex: 1; }
.view { display: none; animation: viewIn .35s var(--ease); }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.view-head h2 { font-size: 28px; letter-spacing: -.02em; }
.view-head p { color: var(--slate-500); margin-top: 4px; font-size: 15px; }
.view-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--slate-500); margin-bottom: 10px; }
.back-link:hover { color: var(--ink); }
.back-link .icon { width: 14px; height: 14px; transform: rotate(180deg); }

.grid { display: grid; gap: 20px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.mt { margin-top: 20px; }
.span-2 { grid-column: span 2; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.card.flush .card-head { padding: 18px 22px 0; }
.card-head h3 { font-size: 17px; letter-spacing: -.01em; }
.card-head small { display: block; font-size: 12px; color: var(--slate-400); font-weight: 600; margin-top: 2px; }
.card-head a, .card-head .link { font-size: 13px; font-weight: 700; color: var(--green-600); background: none; border: 0; display: inline-flex; align-items: center; gap: 4px; }
.card-head a .icon { width: 14px; height: 14px; }

/* Bandeau d'accueil */
.welcome { position: relative; overflow: hidden; isolation: isolate; border-radius: var(--r-xl); padding: 30px 32px; background: var(--forest-900); color: rgba(255,255,255,.88); display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.welcome::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(400px 260px at 95% 0%, rgba(61,209,116,.35), transparent 70%), radial-gradient(360px 260px at 60% 120%, rgba(49,89,214,.4), transparent 70%); }
.welcome h2 { color: var(--white); font-size: 28px; }
.welcome h2 .serif { color: var(--lime); }
.welcome p { margin-top: 6px; max-width: 560px; }
.welcome .next { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); }
.welcome .next .n-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--lime); color: var(--forest-ink); }
.welcome .next b { display: block; color: var(--white); font-size: 14px; }
.welcome .next small { font-size: 12px; }

/* KPI */
.kpi-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; position: relative; overflow: hidden; }
.kpi-card .k-top { display: flex; justify-content: space-between; align-items: flex-start; }
.kpi-card .k-label { font-size: 13px; font-weight: 600; color: var(--slate-500); }
.kpi-card .k-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--green-100); color: var(--green-600); }
.kpi-card .k-ic .icon { width: 18px; height: 18px; }
.kpi-card.blue .k-ic { background: var(--blue-100); color: var(--blue-700); }
.kpi-card.gold .k-ic { background: #fff4d6; color: #8a6700; }
.kpi-card.red .k-ic { background: #fde4e2; color: var(--c-bad); }
.kpi-card .k-val { font-family: var(--font-display); font-size: 34px; font-weight: 700; color: var(--ink); letter-spacing: -.03em; line-height: 1; margin-top: 14px; }
.kpi-card .k-val small { font-size: 16px; color: var(--slate-400); font-weight: 600; }
.kpi-card .k-delta { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 12px; font-weight: 700; color: var(--slate-500); }
.k-delta.up { color: var(--c-ok); }
.k-delta.down { color: var(--c-bad); }
.k-delta .icon { width: 14px; height: 14px; }
.kpi-card .spark { position: absolute; right: 16px; bottom: 16px; width: 84px; height: 30px; }
.spark path { fill: none; stroke: var(--c-ok); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark .area { fill: rgba(19,144,74,.1); stroke: none; }

/* Statuts (texte + pastille, jamais la couleur seule) */
.st { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st.ok { background: #e3f5ea; color: #0d6e38; }
.st.info { background: #e6ecfc; color: #233f9c; }
.st.wait { background: #fbf1d6; color: #7a5b00; }
.st.bad { background: #fbe3e4; color: #9b1c22; }
.st.neutral { background: var(--sand-2); color: var(--slate-500); }

/* Tableaux */
.table-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.t-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--sand); flex: 1; min-width: 200px; max-width: 360px; color: var(--slate-400); }
.t-search input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 14px; outline: none; color: var(--ink); }
.t-select { height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); font: inherit; font-size: 13px; font-weight: 600; color: var(--slate-700); cursor: pointer; }
.table-tools .spacer { flex: 1; }
.bulk { display: none; align-items: center; gap: 10px; padding: 10px 22px; background: var(--forest-900); color: var(--white); font-size: 13px; font-weight: 600; }
.bulk.show { display: flex; }
.bulk .btn { height: 34px; font-size: 12px; padding: 0 14px; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--slate-400); background: #faf9f5; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th[data-sort] { cursor: pointer; user-select: none; }
.tbl th[data-sort]::after { content: "↕"; margin-left: 6px; opacity: .4; }
.tbl th[data-dir="asc"]::after { content: "↑"; opacity: 1; }
.tbl th[data-dir="desc"]::after { content: "↓"; opacity: 1; }
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--sand-2); color: var(--slate-700); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: #fbfaf6; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr[hidden] { display: none; }
.tbl .who { display: flex; align-items: center; gap: 10px; }
.tbl .who .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }
.tbl .who b { display: block; color: var(--ink); font-size: 14px; }
.tbl .who small { font-size: 12px; color: var(--slate-400); }
.tbl .num { font-variant-numeric: tabular-nums; text-align: right; }
.tbl input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--green-500); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); display: grid; place-items: center; color: var(--slate-500); transition: background .15s, color .15s, border-color .15s; }
.icon-btn:hover { background: var(--forest-900); color: var(--white); border-color: var(--forest-900); }
.icon-btn.ok:hover { background: var(--c-ok); border-color: var(--c-ok); }
.icon-btn.bad:hover { background: var(--c-bad); border-color: var(--c-bad); }
.icon-btn .icon { width: 16px; height: 16px; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--slate-500); flex-wrap: wrap; }
.pager { display: flex; gap: 6px; }
.pager button { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); font-weight: 700; font-size: 13px; color: var(--slate-700); }
.pager button[aria-current] { background: var(--forest-900); color: var(--white); border-color: var(--forest-900); }

/* Listes simples */
.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--sand-2); }
.li:first-child { border-top: 0; padding-top: 0; }
.li:last-child { padding-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .grow b { display: block; color: var(--ink); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .grow small { font-size: 12px; color: var(--slate-400); }
.li .l-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--sand); color: var(--slate-700); flex: none; }
.li .l-ic .icon { width: 18px; height: 18px; }
.date-chip { width: 48px; height: 52px; border-radius: 12px; background: var(--forest-900); color: var(--white); display: grid; place-items: center; text-align: center; flex: none; line-height: 1; }
.date-chip b { font-family: var(--font-display); font-size: 20px; }
.date-chip small { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--lime); margin-top: -10px; }

/* Barre de progression */
.bar { height: 8px; border-radius: 99px; background: var(--sand-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--c-ok); transition: width .6s var(--ease); }
.bar.info > span { background: var(--c-info); }
.bar.wait > span { background: var(--c-wait); }

/* Frise horizontale de suivi */
.track-h { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; counter-reset: th; }
.th { position: relative; padding-top: 44px; text-align: center; font-size: 13px; color: var(--slate-400); }
.th::before { counter-increment: th; content: counter(th); position: absolute; top: 0; left: 50%; translate: -50% 0; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--white); border: 2px solid var(--line); font-weight: 800; color: var(--slate-400); z-index: 1; }
.th::after { content: ""; position: absolute; top: 16px; left: 50%; width: 100%; height: 2px; background: var(--line); }
.th:last-child::after { display: none; }
.th b { display: block; color: var(--slate-500); font-size: 13px; }
.th.done::before { content: "✓"; background: var(--c-ok); border-color: var(--c-ok); color: var(--white); }
.th.done::after { background: var(--c-ok); }
.th.done b { color: var(--ink); }
.th.now::before { background: var(--forest-900); border-color: var(--forest-900); color: var(--lime); box-shadow: 0 0 0 6px rgba(201,242,100,.35); }
.th.now b { color: var(--ink); }
.th small { display: block; font-size: 11px; margin-top: 2px; }

/* Frise verticale (historique) */
.vline { display: grid; gap: 0; }
.vl { position: relative; padding: 0 0 20px 30px; font-size: 14px; color: var(--slate-500); }
.vl::before { content: ""; position: absolute; left: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--white); border: 2px solid var(--green-500); }
.vl::after { content: ""; position: absolute; left: 11px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.vl:last-child::after { display: none; }
.vl b { display: block; color: var(--ink); }
.vl small { font-size: 12px; color: var(--slate-400); }
.vl.warn::before { border-color: var(--c-wait); }
.vl.bad::before { border-color: var(--c-bad); }

/* Alertes */
.alert { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--r-md); font-size: 14px; }
.alert .icon { flex: none; margin-top: 1px; }
.alert b { display: block; }
.alert.wait { background: #fdf6e3; border: 1px solid #f1dfa6; color: #6b5000; }
.alert.info { background: #eef2fd; border: 1px solid #ccd8f7; color: #233f9c; }
.alert.ok { background: #e9f7ef; border: 1px solid #bfe7cf; color: #0d6e38; }
.alert .btn { margin-left: auto; flex: none; }

/* Graphiques */
.chart { position: relative; }
.vbars { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding: 0 4px; border-bottom: 1px solid var(--line); background-image: linear-gradient(var(--sand-2) 1px, transparent 1px); background-size: 100% 25%; }
.vbars .vb { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; cursor: default; }
.vbars .vb i { display: block; width: 100%; max-width: 34px; border-radius: 4px 4px 0 0; background: var(--c-ok); opacity: .85; transition: opacity .2s, height .8s var(--ease); }
.vbars .vb:hover i, .vbars .vb:focus i { opacity: 1; }
.vbars .vb.hl i { opacity: 1; }
.vbars .vb .v-lbl { position: absolute; top: -20px; font-size: 11px; font-weight: 700; color: var(--slate-700); opacity: 0; transition: opacity .2s; }
.vbars .vb.hl .v-lbl, .vbars .vb:hover .v-lbl { opacity: 1; }
.vbars.info .vb i { background: var(--c-info); }
.x-axis { display: flex; gap: 10px; padding: 8px 4px 0; font-size: 11px; color: var(--slate-400); }
.x-axis span { flex: 1; text-align: center; }
.hbars { display: grid; gap: 12px; }
.hb { display: grid; grid-template-columns: 110px 1fr 46px; gap: 12px; align-items: center; font-size: 13px; }
.hb > span:first-child { color: var(--slate-700); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb .track { height: 10px; border-radius: 99px; background: var(--sand-2); overflow: hidden; }
.hb .track i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--c-ok); }
.hb b { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut { position: relative; width: 160px; height: 160px; flex: none; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 18; }
.donut .d-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut .d-center b { display: block; font-family: var(--font-display); font-size: 28px; color: var(--ink); line-height: 1; }
.donut .d-center small { font-size: 11px; color: var(--slate-400); font-weight: 600; }
.legend { display: grid; gap: 10px; font-size: 13px; flex: 1; min-width: 170px; }
.legend div { display: flex; align-items: center; gap: 10px; color: var(--slate-700); }
.legend i { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.legend b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.legend small { color: var(--slate-400); margin-left: 6px; }
.line-chart svg { width: 100%; height: 200px; display: block; overflow: visible; }
.line-chart .grid-l { stroke: var(--sand-2); stroke-width: 1; }
.line-chart .ln { fill: none; stroke: var(--c-info); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-chart .ar { fill: rgba(49,89,214,.08); }
.line-chart .pt { fill: var(--c-info); stroke: var(--white); stroke-width: 2; }
.line-chart .hit { fill: transparent; cursor: crosshair; }
.line-chart .xh { stroke: var(--slate-400); stroke-dasharray: 3 3; opacity: 0; }
.tip { position: fixed; z-index: 200; pointer-events: none; padding: 8px 12px; border-radius: 10px; background: var(--ink); color: var(--white); font-size: 12px; font-weight: 600; box-shadow: var(--shadow-md); opacity: 0; transition: opacity .12s; white-space: nowrap; }
.tip.show { opacity: 1; }
.tip b { color: var(--lime); }
.chart-toggle { background: none; border: 0; font-size: 12px; font-weight: 700; color: var(--slate-500); display: inline-flex; align-items: center; gap: 4px; }
.chart-table { display: none; }
.chart-table.show { display: block; }

/* Onglets */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--sand-2); width: max-content; max-width: 100%; overflow-x: auto; margin-bottom: 20px; }
.tabs button { height: 38px; padding: 0 16px; border-radius: 10px; border: 0; background: none; font-weight: 700; font-size: 13px; color: var(--slate-500); white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--white); color: var(--ink); box-shadow: var(--shadow-sm); }
.tab-panel[hidden] { display: none; }

/* Kanban (glisser-déposer) */
.kanban-board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: #ebe8df; border-radius: var(--r-lg); padding: 12px; min-height: 420px; transition: background .2s, box-shadow .2s; }
.kcol.over { background: var(--green-100); box-shadow: inset 0 0 0 2px var(--green-400); }
.kcol-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 12px; font-size: 13px; font-weight: 800; color: var(--ink); }
.kcol-head .st { height: 22px; }
.kcol-head .n { min-width: 24px; height: 24px; border-radius: 99px; background: var(--white); display: grid; place-items: center; font-size: 12px; color: var(--slate-500); }
.kcard { background: var(--white); border-radius: 14px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); cursor: grab; border: 1px solid transparent; transition: box-shadow .2s, transform .2s, border-color .2s; }
.kcard:hover { box-shadow: var(--shadow-md); border-color: var(--line); }
.kcard.dragging { opacity: .5; transform: rotate(2deg); }
.kcard .kc-top { display: flex; align-items: center; gap: 10px; }
.kcard .kc-top b { display: block; font-size: 14px; color: var(--ink); }
.kcard .kc-top small { font-size: 12px; color: var(--slate-400); }
.kcard .kc-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.kcard .match { margin-left: auto; font-size: 12px; font-weight: 800; color: var(--c-ok); }

/* Tiroir latéral & fenêtre modale */
.overlay { position: fixed; inset: 0; z-index: 90; background: rgba(3,32,26,.45); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
.overlay.open { opacity: 1; visibility: visible; }
.drawer { position: fixed; z-index: 95; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--white); box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .35s var(--ease); display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 20px; }
.drawer-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
.drawer-foot { display: flex; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); }
.drawer-foot .btn { flex: 1; }
.modal { position: fixed; z-index: 95; top: 50%; left: 50%; width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; translate: -50% -46%; opacity: 0; visibility: hidden; background: var(--white); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); transition: opacity .25s, translate .25s var(--ease), visibility .25s; }
.modal.open { opacity: 1; visibility: visible; translate: -50% -50%; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 24px 0; }
.modal-head h3 { font-size: 21px; }
.modal-body { padding: 18px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; }
.x-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--white); display: grid; place-items: center; flex: none; }
.x-btn .icon { width: 16px; height: 16px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--slate-400); font-weight: 600; }
.kv dd { margin: 0; color: var(--ink); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px; background: var(--sand); font-size: 13px; font-weight: 600; color: var(--slate-700); }
.chip button { border: 0; background: none; padding: 0; display: grid; color: var(--slate-400); }
.chip button .icon { width: 14px; height: 14px; }

/* Interrupteurs */
.switch { position: relative; display: inline-flex; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--white); box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked + span { background: var(--green-500); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--green-400); outline-offset: 2px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--sand-2); }
.setting:first-child { border-top: 0; }
.setting b { display: block; font-size: 14px; color: var(--ink); }
.setting small { font-size: 13px; color: var(--slate-500); }

/* Calendrier semaine */
.week { display: grid; grid-template-columns: 56px repeat(5, minmax(120px, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--white); }
.week .wh { padding: 12px; font-size: 12px; font-weight: 800; text-align: center; color: var(--slate-500); background: #faf9f5; border-bottom: 1px solid var(--line); }
.week .wh b { display: block; font-family: var(--font-display); font-size: 20px; color: var(--ink); }
.week .wh.today b { color: var(--green-600); }
.week .hr { font-size: 11px; color: var(--slate-400); text-align: right; padding: 4px 8px 0 0; height: 64px; border-top: 1px solid var(--sand-2); }
.week .cell { position: relative; height: 64px; border-top: 1px solid var(--sand-2); border-left: 1px solid var(--sand-2); }
.ev { position: absolute; left: 4px; right: 4px; top: 4px; z-index: 1; padding: 8px 10px; border-radius: 10px; font-size: 12px; line-height: 1.3; background: var(--green-100); color: #0d6e38; border-left: 3px solid var(--c-ok); cursor: pointer; }
.ev b { display: block; color: var(--ink); }
.ev.info { background: #e6ecfc; color: #233f9c; border-left-color: var(--c-info); }
.ev.wait { background: #fbf1d6; color: #7a5b00; border-left-color: var(--c-wait); }

/* Grille d'évaluation */
.criteria { display: grid; gap: 14px; }
.crit { padding: 16px 18px; border-radius: var(--r-md); background: var(--sand); }
.crit-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.crit-top b { color: var(--ink); font-size: 14px; }
.crit-top small { display: block; font-size: 12px; color: var(--slate-500); margin-top: 2px; }
.crit-top output { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.crit-top output small { display: inline; font-size: 13px; color: var(--slate-400); }
.crit input[type=range] { width: 100%; accent-color: var(--green-500); }
.score-total { display: flex; align-items: center; gap: 18px; padding: 20px; border-radius: var(--r-lg); background: var(--forest-900); color: rgba(255,255,255,.88); }
.score-total .ring { --p: 0; background: conic-gradient(var(--lime) calc(var(--p) * 1%), rgba(255,255,255,.12) 0); }
.score-total .ring::before { background: var(--forest-900); color: var(--white); }
.score-total b { display: block; color: var(--white); font-size: 18px; }

/* Matrice des rôles */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix td:first-child b { display: block; color: var(--ink); }
.matrix td:first-child small { color: var(--slate-400); font-size: 12px; }

/* Aperçu en direct (création d'offre) */
.preview-card { position: sticky; top: calc(var(--topbar) + 20px); }
.preview-card .offer { border: 1px solid var(--line); }
.char-count { font-size: 12px; color: var(--slate-400); text-align: right; }

/* Mobile */
.side-backdrop { display: none; }
@media (max-width: 1280px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-search { display: none; }
}
@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); transform: translateX(-105%); transition: transform .35s var(--ease); }
  .sidebar.open { transform: none; }
  .side-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(3,32,26,.5); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
  .side-backdrop.open { opacity: 1; visibility: visible; }
  .tb-menu { display: grid; }
  .g-21, .g-12, .g-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}
@media (max-width: 700px) {
  .topbar { padding: 0 14px; gap: 10px; }
  .tb-switch span, .tb-user b, .tb-user .icon:last-child { display: none; }
  .tb-switch { padding: 0 10px; }
  .tb-switch select { max-width: 110px; }
  .tb-title h1 { font-size: 18px; }
  .tb-title small { display: none; }
  .app-content { padding: 18px 14px; }
  .g-4, .g-2 { grid-template-columns: 1fr; }
  .welcome { padding: 24px 20px; }
  .welcome h2 { font-size: 23px; }
  .view-head h2 { font-size: 23px; }
  .track-h { grid-auto-flow: row; grid-auto-columns: auto; gap: 14px; }
  .th { padding: 0 0 0 46px; text-align: left; min-height: 34px; }
  .th::before { left: 0; translate: 0 0; }
  .th::after { display: none; }
  .popover { position: fixed; left: 12px; right: 12px; top: calc(var(--topbar) + 6px); width: auto; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .hb { grid-template-columns: 80px 1fr 40px; }
}
.tb-switch { white-space: nowrap; flex: none; }
.tb-title { flex: 1 1 auto; }
.tb-search { flex: 0 1 300px; width: auto; }
@media (max-width: 1500px) { .tb-switch > span { display: none; } }
.hb .track { display: block; }
.card-head .chart-toggle { white-space: nowrap; flex: none; }
.kcard .kc-top > span:nth-child(2) { flex: 1; min-width: 0; }
.kcard .kc-top b, .kcard .kc-top small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.kcard .match { white-space: nowrap; }
.kanban-board { grid-template-columns: repeat(5, minmax(240px, 1fr)); }
.tbl .who { padding: 0; border: 0; background: none; border-radius: 0; flex-direction: row; overflow: visible; min-height: 0; }
/* Pastille de notifications : posée sur le coin, hors de l icône */
.tb-btn .dot { top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 5px; font-size: 11px; line-height: 1; border: 2px solid #f4f2ec; box-shadow: 0 2px 6px rgba(192,38,45,.35); }

/* ---------- Éditeur de contenu ---------- */
.rte-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #faf9f5; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.rte-bar button { height: 34px; min-width: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid transparent; background: none; font-size: 13px; color: var(--slate-700); display: inline-flex; align-items: center; gap: 6px; }
.rte-bar button:hover { background: var(--white); border-color: var(--line); }
.rte-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.rte { min-height: 380px; padding: 24px 26px; outline: none; font-size: 17px; }
.rte:empty::before { content: attr(data-placeholder); color: var(--slate-400); }
.rte:focus { box-shadow: inset 0 0 0 2px var(--green-200); }
.rte img { max-width: 100%; border-radius: 12px; }
.rte-foot { display: flex; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--slate-400); }
.ed-cover { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 16/9; border-radius: 14px; border: 2px dashed var(--line); background: var(--sand) center/cover no-repeat; cursor: pointer; text-align: center; padding: 12px; transition: border-color .2s; }
.ed-cover:hover { border-color: var(--green-500); }
.ed-cover b { color: var(--ink); font-size: 14px; }
.ed-cover small { color: var(--slate-400); font-size: 12px; }
.ed-cover.has { border-style: solid; }
.ed-cover.has > * { opacity: 0; }
.serp { padding: 14px; border-radius: 12px; background: var(--white); border: 1px solid var(--line); font-family: Arial, sans-serif; }
.serp small { display: block; font-size: 12px; color: #4d5156; }
.serp b { display: block; font-size: 17px; font-weight: 400; color: #1a0dab; margin: 4px 0; line-height: 1.3; }
.serp span { font-size: 13px; color: #4d5156; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tbl tr.hl { animation: rowHl 2.2s ease; }
@keyframes rowHl { 0%, 40% { background: var(--green-100); } 100% { background: transparent; } }
/* ---------- Création de bourse ---------- */
.budget-box { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-top: 18px; padding: 16px 18px; border-radius: 14px; background: var(--forest-900); color: rgba(255,255,255,.85); }
.budget-box span { font-size: 13px; font-weight: 600; }
.budget-box b { font-family: var(--font-display); font-size: 26px; color: var(--lime); letter-spacing: -.02em; }
.budget-box small { flex-basis: 100%; font-size: 12px; color: rgba(255,255,255,.75); }
.cover-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .cover-grid { grid-template-columns: 1fr; } .rte { padding: 18px; } }

/* Sélection des appels liés (création de bourse) */
.call-pick { display: grid; gap: 8px; }
.call-pick .choice { flex-direction: row; align-items: center; gap: 14px; padding: 14px 16px; }
.call-pick .choice input { position: absolute; opacity: 0; width: auto; height: auto; }
.cp-box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); background: var(--white); display: grid; place-items: center; flex: none; transition: background .15s, border-color .15s; }
.cp-box .icon { width: 13px; height: 13px; stroke-width: 3.5; color: var(--white); opacity: 0; margin: 0; }
.call-pick .choice:has(input:checked) .cp-box { background: var(--green-500); border-color: var(--green-500); }
.call-pick .choice:has(input:checked) .cp-box .icon { opacity: 1; }
.call-pick .choice span:last-child { display: flex; flex-direction: column; gap: 2px; }
.cp-new { display: inline-flex; align-items: center; gap: 8px; justify-self: start; height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px dashed var(--green-400); color: var(--green-600); font-weight: 700; font-size: 14px; }
.cp-new:hover { background: var(--green-50); }
.cp-new .icon { width: 16px; height: 16px; }
