/* FLASH : feuille de style unique (aucun CDN, aucun style en ligne : CSP stricte).
   Jetons de design repris des maquettes validées (cahier §12). */

:root {
  --teal: #0F5C5C; --teal-1: #86BAB6; --teal-2: #BEDCD9; --teal-3: #F1F7F6; --teal-4: #E1ECEA; --teal-txt: #0B3D3D;
  --ink: #1B2430; --ink-2: #5A6470; --ink-3: #8E97A3; --ink-4: #3F4752;
  --bg: #F5F2EC; --bg-2: #F0ECE4; --bg-3: #E9E4D8; --bg-4: #EEEBE4; --bg-5: #FAF8F4;
  --line: #E4DFD5; --line-2: #F0ECE4; --line-3: #DDD7CA; --line-4: #B9B2A3;
  --white: #FFFFFF;
  --red: #B5391B; --red-bg: #F7E1DA; --red-txt: #8A2A12;
  --amber: #A86A00; --amber-bg: #FBF1DC; --amber-line: #E7CF9A; --amber-txt: #7A4B00;
  --blue-bg: #E7EEF7; --blue-txt: #1F4E79;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.45; }
a { color: var(--teal); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
h1 { font-size: 34px; line-height: 1.1; }
h2 { font-size: 22px; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.neg { color: var(--red); }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }

/* ---------- Mise en page ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex-shrink: 0; background: var(--ink); color: var(--bg-3); padding: 28px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: block; font-family: var(--serif); font-weight: 600; font-size: 22px; color: var(--white); padding: 0 10px; text-decoration: none; }
.brand-logo { display: block; width: 188px; max-width: 100%; height: auto; }
.brand-sub { font-size: 12px; color: #A9B0BA; padding: 0 10px 18px; }
.nav-h { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; color: var(--ink-3); padding: 18px 10px 4px; text-transform: uppercase; }
.nav-h:first-of-type { padding-top: 8px; }
.nav a { display: block; padding: 9px 10px; border-radius: 8px; color: var(--bg-3); text-decoration: none; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,0.07); }
.nav a[aria-current="page"] { background: var(--teal); color: var(--white); font-weight: 600; }
.side-foot { margin-top: auto; padding: 16px 10px 0; font-size: 12.5px; color: #A9B0BA; border-top: 1px solid rgba(255,255,255,0.1); }
.side-foot strong { color: var(--white); font-weight: 500; display: block; overflow-wrap: anywhere; }
.side-foot button { margin-top: 8px; background: transparent; border: 1px solid rgba(255,255,255,0.25); color: var(--bg-3); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.side-foot button:hover { background: rgba(255,255,255,0.08); }
.main { flex: 1; min-width: 0; padding: 32px 28px 48px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.page-head .lead { font-size: 14px; color: var(--ink-2); margin-top: 6px; max-width: 70ch; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.pill { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--white); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.pill-warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-txt); }
.pill-ok { background: var(--teal-4); border-color: var(--teal-1); color: var(--teal-txt); }
.pill-bad { background: var(--red-bg); border-color: #E5B4A6; color: var(--red-txt); }

/* ---------- Cartes, tuiles, alertes ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.card-head h3 { font-family: var(--sans); font-size: 15px; font-weight: 600; }
.card-pad { padding: 14px 18px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi .k-label { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; color: var(--ink-2); text-transform: uppercase; }
.kpi .k-value { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .k-note { font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.k-teal { color: var(--teal); } .k-amber { color: var(--amber); }
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13.5px; line-height: 1.45; border: 1px solid; }
.alert-info { background: var(--blue-bg); border-color: #C5D5E8; color: var(--blue-txt); }
.alert-ok { background: var(--teal-4); border-color: var(--teal-1); color: var(--teal-txt); }
.alert-warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-txt); }
.alert-bad { background: var(--red-bg); border-color: #E5B4A6; color: var(--red-txt); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; text-align: center; padding: 4px 10px; border-radius: 999px; background: var(--bg-4); color: var(--ink-4); white-space: nowrap; }
.tag-warn { background: var(--amber-bg); color: var(--amber-txt); } .tag-bad { background: var(--red-bg); color: var(--red-txt); }
.tag-info { background: var(--blue-bg); color: var(--blue-txt); } .tag-ok { background: var(--teal-4); color: var(--teal-txt); }

/* ---------- Statuts des mois ---------- */
.status-grid { display: grid; grid-template-columns: 170px repeat(12, minmax(0, 1fr)); gap: 4px; align-items: center; }
.status-grid .h { text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.status-grid .lab { font-size: 13.5px; font-weight: 500; }
.st { height: 24px; border-radius: 5px; font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.st-reel { background: var(--teal); color: var(--white); }
.st-cloturer { background: var(--amber-bg); color: var(--amber-txt); border: 1px dashed var(--amber); }
.st-lu { background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.st-forecast { background: repeating-linear-gradient(135deg, var(--teal-1) 0, var(--teal-1) 4px, var(--teal-2) 4px, var(--teal-2) 8px); color: var(--teal-txt); }
.legend { display: flex; gap: 22px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 7px; }
.sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.sw-reel { background: var(--teal); }
.sw-cloturer { background: var(--amber-bg); border: 1px dashed var(--amber); }
.sw-prov { background: color-mix(in srgb, var(--amber-bg) 40%, var(--white)); border: 1px dashed var(--amber); }
.sw-lu { background: var(--bg); border: 1px solid var(--line); }
.sw-forecast { background: repeating-linear-gradient(135deg, var(--teal-1) 0, var(--teal-1) 4px, var(--teal-2) 4px, var(--teal-2) 8px); }
.sw-flag { background: var(--amber-bg); border: 1px solid var(--amber-line); }
.sw-sel { border: 2px solid var(--teal); background: var(--white); }

/* ---------- Tableaux ---------- */
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { background: var(--bg); font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.04em; text-align: right; padding: 9px 12px; text-transform: uppercase; }
.tbl th:first-child, .tbl td:first-child { text-align: left; padding-left: 18px; }
.tbl td { padding: 9px 12px; text-align: right; border-top: 1px solid var(--line-2); }
.tbl .sub td:first-child { padding-left: 38px; color: var(--ink-2); }
.tbl .tot td { background: var(--bg-2); font-weight: 600; border-top: 1px solid var(--line-4); }
.tbl .conso td { background: var(--teal-4); font-weight: 600; border-top: 1px solid var(--teal); }
.tbl .base td:first-child { font-weight: 500; }
.tbl-scroll { overflow-x: auto; }

.pnl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; font-variant-numeric: tabular-nums; table-layout: fixed; min-width: 1090px; }
.pnl th, .pnl td { padding: 0; }
.pnl thead th { background: var(--bg); border-bottom: 1px solid var(--ink); font-size: 12px; font-weight: 600; text-align: center; padding: 6px 2px; line-height: 1.25; border-left: 1px solid var(--white); }
.pnl thead th:first-child { text-align: left; padding: 10px 12px; color: var(--ink-2); letter-spacing: 0.06em; width: 215px; border-left: 0; }
.pnl .h-reel { background: var(--teal); color: var(--white); }
.pnl .h-cloturer { background: var(--amber-bg); color: var(--amber-txt); outline: 1px dashed var(--amber); outline-offset: -2px; }
.pnl .h-lu { background: var(--bg-2); color: var(--ink-2); }
.pnl .h-provisoire { background: var(--amber-bg); color: var(--amber-txt); outline: 1px dashed var(--amber); outline-offset: -2px; }
.pnl .h-forecast { background: repeating-linear-gradient(135deg, var(--teal-1) 0, var(--teal-1) 5px, var(--teal-2) 5px, var(--teal-2) 10px); color: var(--teal-txt); }
.pnl th small { display: block; font-weight: 400; font-size: 11px; }
.pnl td.l { padding: 5px 12px 5px 24px; text-align: left; background: var(--white); border-top: 1px solid var(--line-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: sticky; left: 0; z-index: 1; }
.pnl td.l .lnum { display: inline-block; min-width: 24px; margin-right: 6px; font-size: 10.5px; font-weight: 400; color: var(--ink-3, #8a8f98); font-variant-numeric: tabular-nums; }
.pnl tr.sec td { padding: 8px 12px; background: var(--bg-4); font-size: 11px; font-weight: 600; letter-spacing: 0.12em; color: var(--ink-2); border-top: 1px solid var(--line); }
.pnl tr.tot td.l, .pnl tr.sub td.l { padding-left: 12px; font-weight: 600; }
.pnl tr.tot td.l { background: var(--bg-2); border-top-color: var(--line-4); }
.pnl tr.sub td.l { border-top-color: var(--line-3); }
.pnl td.c { padding: 0; border-top: 1px solid var(--line-2); border-left: 1px solid var(--line-2); background: var(--white); }
.pnl tr.tot td.c { background: var(--bg-2); border-top-color: var(--line-4); font-weight: 600; }
.pnl tr.sub td.c { border-top-color: var(--line-3); font-weight: 600; }
.pnl td.c.fc { background: var(--teal-3); }
.pnl tr.tot td.c.fc { background: var(--teal-4); }
.pnl td.c.prov { background: color-mix(in srgb, var(--amber-bg) 40%, var(--white)); }
.pnl tr.tot td.c.prov { background: color-mix(in srgb, var(--amber-bg) 65%, var(--white)); }
.pnl td.c.flag { background: var(--amber-bg); }
.pnl-court { min-width: 1500px; }
.pnl-court col.c-lab { width: 185px; } .pnl-court col.c-n1 { width: 78px; } .pnl-court col.c-var { width: 76px; }
.pnl-court td.c.n1 { background: var(--bg-2); }
.pnl-court tr.ratio td { font-size: 11.5px; color: var(--ink-2); font-style: italic; }
.pnl-court tr.controle td { font-size: 11px; color: var(--ink-3); border-top: 1px dashed var(--line-2); }
.pnl-court tr.controle td.ecart { color: var(--amber-txt); background: var(--amber-bg); font-weight: 600; }
.notes-court { margin: 10px 2px 0; } .notes-court p { margin: 3px 0; }
.pnl td.c .cell { display: block; width: 100%; margin: 0; border: 0; background: transparent; text-align: right; padding: 5px 5px; cursor: pointer; font: inherit; color: inherit; font-weight: inherit; }
.pnl td.c .cell:hover { background: rgba(15,92,92,0.08); }
.pnl td.c .cell[aria-pressed="true"] { outline: 2px solid var(--teal); outline-offset: -2px; }
.pnl td.c.saisie .cell::after { content: '●'; color: var(--teal); font-size: 7px; vertical-align: super; margin-left: 2px; }
.pnl td.s { padding: 5px 6px; text-align: right; background: var(--bg-5); border-left: 1px solid var(--line); border-top: 1px solid var(--line-2); }
.pnl tr.tot td.s { background: var(--bg-2); border-top-color: var(--line-4); font-weight: 600; }
.pnl td.s.n2 { color: var(--ink-4); border-left-color: var(--line-2); }
.pnl col.c-lab { width: 190px; } .pnl col.c-mois { width: auto; } .pnl col.c-ajust { width: 48px; } .pnl col.c-fy { width: 66px; } .pnl col.c-sem { width: 58px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { font-size: 14px; font-weight: 600; padding: 9px 16px; border-radius: 10px; border: 1px solid #D9D3C6; background: var(--white); color: var(--ink); text-decoration: none; cursor: pointer; }
.tab[aria-current="page"], .tab.on { background: var(--teal); border-color: var(--teal); color: var(--white); }

/* ---------- Formulaires ---------- */
.btn { display: inline-block; cursor: pointer; border: 1px solid #D9D3C6; background: var(--white); color: var(--ink); border-radius: 8px; padding: 8px 14px; font-weight: 600; text-decoration: none; font-size: 13.5px; }
.btn:hover { background: var(--bg-5); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: var(--white); }
.btn-primary:hover { background: #0B4A4A; }
.btn-danger { border-color: #E5B4A6; color: var(--red-txt); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-4); }
.field input, .field select, .field textarea { border: 1px solid #CFC8B9; border-radius: 8px; padding: 8px 10px; background: var(--white); }
.field .hint { font-size: 12px; color: var(--ink-2); }
.inline-form { display: inline; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { margin-bottom: 0; }

/* ---------- Aide contextuelle (panneau latéral) ---------- */
.aide-btn { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--teal); background: var(--white); color: var(--teal); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; vertical-align: middle; }
.aide-btn:hover { background: var(--teal); color: var(--white); }
.panneau { position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 100vw; background: var(--white); border-left: 1px solid var(--line); box-shadow: -12px 0 32px rgba(27,36,48,0.12); padding: 24px 22px; overflow-y: auto; z-index: 50; transform: translateX(105%); transition: transform .18s ease; }
.panneau.ouvert { transform: none; }
.panneau h3 { font-size: 20px; margin-bottom: 8px; }
.panneau .fermer { position: absolute; top: 12px; right: 14px; border: 0; background: transparent; font-size: 24px; cursor: pointer; color: var(--ink-2); }
.panneau dl { margin: 12px 0; }
.panneau dt { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; color: var(--ink-2); text-transform: uppercase; margin-top: 12px; }
.panneau dd { margin: 4px 0 0; }
.cellule-info { display: grid; grid-template-columns: 1.4fr 1fr 1fr 3fr; gap: 20px; align-items: start; }
.cellule-info .lab { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; color: var(--ink-2); text-transform: uppercase; display: block; }
.cellule-info .val { font-family: var(--serif); font-weight: 600; font-size: 26px; line-height: 1.1; }

/* ---------- Graphique (SVG) ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--sans); font-size: 12px; fill: var(--ink-4); }
.chart .bar-reel { fill: var(--teal); }
.chart .bar-fc { fill: url(#hachure); }
.chart .ebitda { font-weight: 600; }
.chart .ebitda-neg { fill: var(--red); }
.chart .axe { stroke: var(--line); }

/* ---------- Connexion ---------- */
.nu { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: 100%; max-width: 420px; background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login .brand { color: var(--ink); padding: 0 0 6px; }
.login .brand-logo { width: 240px; }
.secret-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; letter-spacing: 0.08em; background: var(--bg-2); padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; user-select: all; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { width: 200px; }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; padding: 12px 16px; }
  .brand-sub, .nav-h { display: none; }
  .brand-logo { width: 140px; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .main { padding: 16px; }
  .kpis { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: 110px repeat(12, minmax(0, 1fr)); font-size: 10px; }
  .st { font-size: 0; }
  .cellule-info { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .aide-btn, .panneau, .no-print, .tabs { display: none !important; }
  body { background: var(--white); }
  .main { padding: 0; }
  .card { break-inside: avoid; }
}

/* ---------- Points de contrôle ---------- */
.point { display: grid; grid-template-columns: 96px 1fr 170px; gap: 16px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line-2); }
.point a { text-align: right; font-weight: 600; font-size: 13px; }
@media (max-width: 760px) { .point { grid-template-columns: 1fr; } .point a { text-align: left; } }

/* ---------- Entités ---------- */
.decomp { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px 18px; font-size: 14px; }
.chip { padding: 4px 10px; border-radius: 8px; background: var(--bg-2); }
.chip-teal { background: var(--teal); color: var(--white); }
.tag-reel { background: var(--teal); color: var(--white); }
table.comptes { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 12.5px; }
table.comptes td { padding: 3px 6px; border-top: 1px solid var(--line-2); }
table.comptes td:last-child { text-align: right; }
.pnl tr.tot td.c.neg .cell, .pnl tr.sub td.c.neg .cell, .pnl td.s.neg { color: var(--red); }
.pnl .cell-fixe { display: block; padding: 5px 5px; text-align: right; cursor: default; }
.flux-h { font-family: var(--sans); font-size: 14px; font-weight: 600; margin: 14px 0 6px; }

/* ---------- Import et clôture ---------- */
.steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.step { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); text-decoration: none; color: var(--ink); font-size: 13px; font-weight: 500; }
.step b { font-family: var(--serif); font-size: 18px; color: var(--ink-3); }
.step.on { border-color: var(--teal); background: var(--teal-3); }
.step.on b { color: var(--teal); }
.step-detail p { margin: 6px 0; max-width: 90ch; }
.actions { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; border-top: 1px solid var(--line-2); }
.st-act { padding: 0; }
.st-btn { all: unset; cursor: pointer; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; text-decoration: none; color: inherit; }
.st-btn:hover { background: rgba(0,0,0,0.08); border-radius: 5px; }
.btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.ctrl-act { text-align: right; }
.rouvrir { margin-top: 12px; }
.rouvrir summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.rouvrir form { margin-top: 10px; }
@media (max-width: 1100px) { .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tbl-ctrl td, .tbl-ctrl th { text-align: left; }
.tbl-ctrl td.msg { max-width: 60ch; font-size: 13px; }
.tbl-ctrl td.ctrl-act { text-align: right; white-space: nowrap; }

/* ---------- Paramètres ---------- */
fieldset.fam { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 4px; margin: 0 0 12px; }
fieldset.fam legend { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0 6px; }
fieldset.fam.masque { display: none; }
.grid-mois { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
tr.inactive td { opacity: .55; }
.tbl-ctrl td.ctrl-act a { margin-right: 8px; }
.in-num { width: 90px; text-align: right; border: 1px solid #CFC8B9; border-radius: 6px; padding: 4px 6px; background: var(--white); }
.in-num[readonly] { background: var(--bg-5); border-color: var(--line); }
.form-col { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; min-width: 260px; }
.form-col select, .form-col input { border: 1px solid #CFC8B9; border-radius: 6px; padding: 5px 8px; background: var(--white); }
details > summary { cursor: pointer; color: var(--teal); font-weight: 600; font-size: 13px; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Frais de gestion ---------- */
.steps4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.step-static { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-5); }
.step-static b { font-size: 11px; letter-spacing: 0.1em; color: var(--ink-3); }
.comp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.comp { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 10px; border: 1px solid; }
.comp-ok { background: #F3F8F4; border-color: #CFE3D5; }
.comp-ko { background: #FFFBF2; border-color: var(--amber-line); }
@media (max-width: 1100px) { .steps4, .comp-grid { grid-template-columns: 1fr 1fr; } }
.form-col-wide { max-width: 420px; }
.side-foot .lien-compte { color: var(--white); text-decoration: none; }
.side-foot .lien-compte:hover { text-decoration: underline; }
.exact-etat { display: block; font-size: 12px; margin-bottom: 8px; }
.exact-etat::before { content: '●'; margin-right: 6px; }
.exact-etat.ok::before { color: #6FCF97; } .exact-etat.ko::before { color: #F2994A; }
.exports { display: flex; gap: 8px; }
.print-only { display: none; }
@media print { .print-only { display: block; } .pnl { min-width: 0; font-size: 9px; } .tbl-scroll { overflow: visible; } }
.form-col-wide2 { max-width: 760px; }
.form-col-wide2 textarea { width: 100%; }

.qr { width: 240px; max-width: 100%; margin: 4px auto; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.qr-manuel { margin: 4px 0; }

/* ---------- Journal d'erreurs ---------- */
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--red-bg); color: var(--red-txt); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
pre.trace { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; font-size: 12px; overflow: auto; max-height: 320px; white-space: pre-wrap; word-break: break-all; }
.lien-probleme { display: block; margin-top: 4px; font-size: 12px; }

/* ---------- Exercice (années récupérées) ---------- */
.side-exercice { margin: 10px 10px 0; display: flex; flex-direction: column; gap: 4px; }
.side-exercice label { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.side-exercice select { font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.08); color: inherit; }
.side-exercice select option { color: #1B2430; }
.banniere-exercice { margin-bottom: 14px; }

/* ---------- Analyse Direction : graphiques, tuiles, santé ---------- */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 15px; height: 15px; flex: none; vertical-align: -3px; }
.duo { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; align-items: stretch; }
.duo-egal { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .duo, .duo-egal, .trio { grid-template-columns: 1fr; } }
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chart-scroll .chart-mensuel { min-width: 780px; }

/* état des mois */
.mois-strip { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.mois-case { height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; }
.mois-reel { background: var(--teal); color: var(--white); }
.mois-prov { background: var(--white); border: 2px dashed var(--amber); color: var(--amber-txt); font-weight: 600; }
.mois-fc { background: repeating-linear-gradient(135deg, var(--teal-1) 0 5px, var(--teal-2) 5px 10px); border: 1px solid #5FA09B; color: var(--teal-txt); }
@media (max-width: 760px) { .mois-case { font-size: 11px; height: 30px; } }
.legende { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13px; color: var(--ink-2); align-items: center; }
.legende span { display: inline-flex; align-items: center; gap: 8px; }
.lg { width: 16px; height: 16px; border-radius: 4px; display: inline-block; flex: none; }
.lg-reel { background: var(--teal); }
.lg-prov { background: var(--teal-1); border: 2px dashed var(--amber); }
.lg-fc { background: repeating-linear-gradient(135deg, var(--teal-1) 0 4px, var(--teal-2) 4px 8px); border: 1px solid #5FA09B; }
.lg-neg { background: var(--red); }
.lg-n1 { background: #C9C2B2; }
.lg-ligne { width: 24px; height: 0; border-top: 2px dashed #5A6470; border-radius: 0; }

/* tuiles */
.kpi-a { position: relative; gap: 8px; }
.kpi-a .k-value { font-size: 38px; }
.kpi-a .k-pied { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
.tendance, .jauge { width: 132px; height: auto; flex: none; display: block; }
.tendance-reel { fill: none; stroke: var(--teal); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.tendance-fc { fill: none; stroke: #5FA09B; stroke-width: 2; stroke-dasharray: 3 3; stroke-linecap: round; }
.tendance-aire { fill: rgba(15, 92, 92, 0.10); stroke: none; }
.tendance-point { fill: var(--white); stroke: var(--teal); stroke-width: 2.2; }
.jauge-fond { fill: var(--bg-3); } .jauge-risque { fill: #E9C0B3; } .jauge-val { fill: var(--teal); } .jauge-val-bas { fill: var(--red); }
.jauge-repere { stroke: var(--ink); stroke-width: 2; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; padding: 2px 9px 2px 7px; border-radius: 999px; white-space: nowrap; }
.delta-up { background: var(--teal-4); color: var(--teal-txt); }
.delta-down { background: var(--red-bg); color: var(--red-txt); }
.delta-flat { background: var(--bg-4); color: var(--ink-4); }

/* graphiques */
.chart .grille { stroke: var(--line-2); stroke-width: 1; }
.chart .zero { stroke: var(--line-4); stroke-width: 1.4; }
.chart .graduation { font-size: 11px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart .titre-panneau { font-size: 12px; font-weight: 600; fill: var(--ink-4); letter-spacing: 0.02em; }
.chart .val { font-size: 11.5px; fill: var(--ink-4); font-variant-numeric: tabular-nums; }
.chart .val-neg { fill: var(--red-txt); }
.chart .val-fort { font-size: 12.5px; font-weight: 600; fill: var(--ink); }
.chart .mois-lib { font-size: 12.5px; font-weight: 500; fill: var(--ink-4); }
.chart .sous-lib { font-size: 12px; fill: var(--ink-2); }
.chart .bar { transition: opacity 0.15s ease; }
.chart .b-reel { fill: var(--teal); }
.chart .b-prov { fill: var(--teal-1); stroke: var(--amber); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .b-fc { fill: url(#g-h-teal); stroke: #7FB3AE; stroke-width: 1; }
.chart .b-neg { fill: var(--red); }
.chart .b-fc-neg { fill: url(#g-h-red); stroke: #D98D78; stroke-width: 1; }
.chart .b-n1 { fill: #C9C2B2; }
.chart .n1-ligne { fill: none; stroke: #5A6470; stroke-width: 2; stroke-dasharray: 5 4; stroke-linejoin: round; }
.chart .n1-point { fill: var(--white); stroke: #5A6470; stroke-width: 2; }
.chart .n1-tick { stroke: #3F4752; stroke-width: 2.6; stroke-linecap: round; }
.chart .n1-marque { fill: #3F4752; }
.chart .zone { fill: transparent; }
.chart .zone:hover, .chart .zone:focus { fill: rgba(15, 92, 92, 0.07); outline: none; }
.chart .zone:focus-visible { stroke: var(--teal); stroke-width: 2; }
.chart .zone-perte { fill: var(--red-bg); } .chart .zone-rentable { fill: var(--teal-4); }
.chart .zone-lib { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.chart .zone-lib-perte { fill: var(--red-txt); } .chart .zone-lib-ok { fill: var(--teal-txt); }
.chart .cible { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.chart-comparaison, .chart-repartition, .chart-ecarts { max-width: 560px; }
@media (prefers-reduced-motion: no-preference) {
  .chart-mensuel .bar, .chart-trimestres .bar { transform-box: fill-box; transform-origin: 50% 100%; animation: pousse 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .chart-mensuel .bar-neg { transform-origin: 50% 0; }
  .chart-comparaison .bar, .chart-repartition .bar, .chart-ecarts .bar, .chart-seuil .bar { transform-box: fill-box; transform-origin: 0 50%; animation: poussex 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
}
@keyframes pousse { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes poussex { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* infobulle des graphiques */
.tip { position: fixed; z-index: 40; max-width: 300px; padding: 9px 12px; border-radius: 10px; background: var(--ink); color: var(--white); font-size: 12.5px; line-height: 1.5; white-space: pre-line; pointer-events: none; opacity: 0; transition: opacity 0.12s ease; box-shadow: 0 6px 20px rgba(27, 36, 48, 0.25); }
.tip.visible { opacity: 1; }
.tip strong { display: block; font-weight: 600; }

/* verdict, formule du seuil, santé */
.verdict { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.5; }
.verdict .ico { width: 20px; height: 20px; margin-top: 1px; }
.verdict-ambitieux { background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber-txt); }
.verdict-ok { background: var(--teal-4); border: 1px solid var(--teal-1); color: var(--teal-txt); }
.verdict-info { background: var(--blue-bg); color: var(--blue-txt); }
.formule { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.f-bloc { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; background: var(--bg-5); border: 1px solid var(--line); border-radius: 10px; }
.f-bloc span { font-size: 12px; color: var(--ink-2); }
.f-bloc strong { font-family: var(--serif); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.f-bloc-fort { background: var(--teal); border-color: var(--teal); }
.f-bloc-fort span, .f-bloc-fort strong { color: var(--white); }
.f-op { font-size: 22px; color: var(--ink-3); font-weight: 300; }
.sante { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px 3px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.sante-critique { background: var(--red-bg); color: var(--red-txt); }
.sante-vigilance { background: var(--amber-bg); color: var(--amber-txt); }
.sante-solide { background: var(--teal-4); color: var(--teal-txt); }
.sante-non_evalue, .sante-total { background: var(--bg-4); color: var(--ink-4); }
.tbl-sante td, .tbl-sante th { vertical-align: middle; }
.tbl-sante .precision { font-size: 12px; color: var(--ink-2); font-weight: 400; margin-left: 4px; }
.tbl-sante tr.groupe td { background: var(--bg-5); font-weight: 600; border-top: 2px solid var(--line-3); }
.marge-sante { width: 168px; height: auto; display: block; }
.ms-crit { fill: #F0CFC5; } .ms-vig { fill: #F4E2B8; } .ms-sol { fill: #CFE3E0; }
.ms-zero { stroke: var(--line-4); stroke-width: 1; stroke-dasharray: 2 2; }
.ms-repere { fill: var(--ink); } .ms-trait { stroke: var(--ink); stroke-width: 2.4; }
.alerte-liste .point { grid-template-columns: 34px 1fr 150px; }
.alerte-liste .point .ico { width: 22px; height: 22px; margin-top: 2px; }
.alerte-liste .ic-bad { color: var(--red); } .alerte-liste .ic-warn { color: var(--amber); } .alerte-liste .ic-info { color: var(--blue-txt); }
@media (max-width: 760px) { .alerte-liste .point { grid-template-columns: 30px 1fr; } .alerte-liste .point a { grid-column: 2; } }
details.valeurs { margin-top: 4px; }
details.valeurs summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--teal); padding: 6px 0; }
details.valeurs summary:hover { text-decoration: underline; }
.kpi-a, .card { transition: box-shadow 0.15s ease; }
.kpi-a:hover { box-shadow: 0 2px 10px rgba(27, 36, 48, 0.07); }
@media print {
  .tip { display: none; }
  .chart-scroll { overflow: visible; }
  .chart-scroll .chart-mensuel { min-width: 0; }
  .chart .bar { animation: none !important; }
  details.valeurs { display: block; }
}
.chart .b-hachure { fill: url(#g-h-gris); stroke: #C9C2B2; stroke-width: 1; }
.flex-marge { display: flex; align-items: center; gap: 10px; }
.flex-marge strong { min-width: 48px; text-align: right; }

/* contraste : texte blanc sur les barres teal ; puces qui passent à la ligne au lieu de déborder */
.chart-repartition .b-reel + .val-fort, .chart-seuil .b-reel + .val-fort { fill: var(--white); }
.delta { white-space: normal; max-width: 100%; line-height: 1.3; }
.codes-secours { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.codes-secours code { display: block; padding: 8px 12px; background: var(--bg-5); border: 1px dashed var(--line-4); border-radius: 8px; font-size: 15px; letter-spacing: 0.06em; text-align: center; user-select: all; }

/* Analyse Direction : écart à la référence */
.tbl .precision { display: block; font-size: 12px; color: var(--ink-2); font-weight: 400; margin-top: 2px; }
.sous-titre { font-size: 14px; font-weight: 600; margin: 18px 0 8px; color: var(--ink); }
.chart-ecarts-composes { width: 100%; height: auto; max-width: 720px; }

/* Analyse Direction : trésorerie */
.chart-tresorerie { width: 100%; height: auto; max-width: 760px; }
.chart .b-dernier { stroke: var(--ink); stroke-width: 1.5; }
.chart-repartition .b-neg + .val-fort { fill: var(--white); }
.tbl-treso td { white-space: nowrap; padding-left: 8px; padding-right: 8px; }
.tbl-treso th { padding-left: 8px; padding-right: 8px; letter-spacing: 0.02em; font-size: 11px; }
#tresorerie .kpis { margin: 4px 0 10px; }

/* Connexion : cases « Se souvenir de moi » et « Ne plus me demander le code » (case un peu plus grande, texte aligné à côté de la case, y compris à la ligne) */
.case-choix { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 16px; }
.case-choix input[type="checkbox"] { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--teal); cursor: pointer; }
.case-choix > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.case-choix label { font-size: 14px; line-height: 1.35; cursor: pointer; }
.case-choix .muted { line-height: 1.4; }
