:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e3e6ea;
  --text: #1c2430;
  --muted: #6b7684;
  --primary: #e8590c;
  --primary-dark: #c44a08;
  --ai: #6741d9;
  --danger: #c92a2a;
  --side: #1f2733;
  --side-text: #c9d1dc;
  --radius: 8px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
h1, h2, h3 { margin: 0 0 8px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 16px; }

#app { display: flex; height: 100vh; }

/* Sidebar */
#sidebar { width: 230px; flex-shrink: 0; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 14px; gap: 10px; }
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.brand b { color: var(--on-accent); font-size: 17px; display: block; }
.brand small { font-size: 11px; }
.logo { width: 34px; height: 34px; border-radius: 8px; background: var(--primary); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.side-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .6; margin-top: 8px; }
#project-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
#project-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#project-list li:hover { background: rgba(255,255,255,.06); }
#project-list li.active { background: rgba(232,89,12,.2); color: var(--on-accent); }
#project-list li small { display: block; opacity: .6; font-size: 11px; }
.side-bottom { display: flex; flex-direction: column; gap: 8px; }
.side-bottom .btn.ghost { color: var(--side-text); border-color: rgba(255,255,255,.15); }
.ai-status { font-size: 11px; opacity: .8; }
.ai-status.on::before { content: "● "; color: #51cf66; }
.ai-status.off::before { content: "● "; color: var(--danger); }

/* Buttons & fields */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-accent); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ai { background: var(--ai); border-color: var(--ai); color: var(--on-accent); }
.btn.ai:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: wait; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; background: var(--surface); }
textarea { width: 100%; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea { color: var(--text); font-size: 14px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

/* Main */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.home { padding: 40px; max-width: 1000px; overflow: auto; }
.home h1 { font-size: 26px; }
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 24px 0; }
.steps div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.steps b { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--on-accent); display: grid; place-items: center; font-size: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; cursor: pointer; }
.card:hover { border-color: var(--primary); }
.card .amount { font-size: 18px; font-weight: 700; margin-top: 8px; }

.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.project-head { display: flex; flex-direction: column; min-width: 220px; }
.title-input { border: none; font-size: 17px; font-weight: 700; padding: 2px 4px; }
.sub-input { border: none; font-size: 12px; color: var(--muted); padding: 2px 4px; }
.title-input:focus, .sub-input:focus { outline: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tabs button { border: none; background: transparent; padding: 8px 14px; border-radius: 6px; cursor: pointer; font: inherit; color: var(--muted); }
.tabs button.active { background: var(--accent-bg); color: var(--primary-dark); font-weight: 600; }
.tab-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* Plan workspace */
.plan-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.plan-bar select { min-width: 180px; }
.scale-badge { font-size: 12px; padding: 4px 8px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); }
.scale-badge.ok { background: var(--good-bg); color: var(--good); }
.workspace { flex: 1; min-height: 0; display: flex; }
.toolbar { width: 56px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding: 8px 0; gap: 4px; }
.toolbar button { width: 42px; height: 42px; border: 1px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; font-size: 18px; position: relative; }
.toolbar button:hover { background: var(--surface-2); }
.toolbar button.active { background: var(--accent-bg); border-color: var(--primary); }
.toolbar button span { position: absolute; bottom: 1px; right: 3px; font-size: 9px; color: var(--muted); }
.toolbar hr { width: 30px; border: none; border-top: 1px solid var(--border); }
.canvas-wrap { flex: 1; position: relative; overflow: hidden; background: var(--surface-3); background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px); background-size: 16px 16px; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.canvas-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.canvas-wrap.drag { outline: 3px dashed var(--primary); outline-offset: -8px; }
.hint { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(28,36,48,.85); color: var(--on-accent); padding: 6px 12px; border-radius: 16px; font-size: 12px; pointer-events: none; white-space: nowrap; }
.hint:empty { display: none; }
.zoom-ctrl { position: absolute; bottom: 12px; right: 12px; display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.zoom-ctrl button { border: none; background: transparent; padding: 6px 10px; cursor: pointer; font: inherit; }
.zoom-ctrl button + button { border-left: 1px solid var(--border); }

.panel { width: 310px; flex-shrink: 0; background: var(--surface); border-left: 1px solid var(--border); overflow: auto; padding: 12px; }
.panel h3:first-child { margin-top: 0; }
.item-list { list-style: none; margin: 0 0 8px; padding: 0; }
.item-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.item-list li:hover { background: var(--surface-2); }
.item-list li.selected { background: var(--accent-bg); }
.item-list .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.item-list .num { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: var(--on-accent); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.item-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-list .qty { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.lot-head { font-size: 11px; font-weight: 700; color: var(--muted); margin: 10px 0 2px; text-transform: uppercase; }
.editor { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 14px; background: var(--surface-2); }
.editor .big { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.empty-note { color: var(--muted); font-size: 12px; padding: 4px 0 8px; }

/* Devis */
.devis-layout { flex: 1; min-height: 0; display: flex; }
.devis-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.devis-actions { display: flex; gap: 8px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
#devis-table { flex: 1; overflow: auto; padding: 16px; }
.devis-side { width: 320px; background: var(--surface); border-left: 1px solid var(--border); padding: 16px; overflow: auto; }
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.grid th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; }
table.grid td { padding: 3px 6px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.grid td input, table.grid td select { width: 100%; border-color: transparent; background: transparent; }
table.grid td input:hover, table.grid td input:focus, table.grid td select:hover { border-color: var(--border); background: var(--surface); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.num input { text-align: right; }
table.grid tr.lot-row td { background: var(--accent-bg); font-weight: 700; padding: 8px; }
table.grid .tag { font-size: 10px; padding: 2px 6px; border-radius: 10px; background: var(--info-bg); color: var(--info); white-space: nowrap; }
table.grid .tag.ia { background: var(--ai-bg); color: var(--ai); }
table.grid .del { border: none; background: none; cursor: pointer; color: var(--muted); }
table.grid .del:hover { color: var(--danger); }
.totals { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; font-variant-numeric: tabular-nums; }
.totals .ttc { font-size: 18px; font-weight: 800; color: var(--primary-dark); border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }
.hyp { background: var(--ai-bg); border-radius: var(--radius); padding: 10px 12px; font-size: 12px; margin-top: 14px; }
.hyp ul { margin: 6px 0 0; padding-left: 18px; }

.biblio-body { flex: 1; overflow: auto; padding: 16px; }

/* Modal & toast */
.modal { position: fixed; inset: 0; background: rgba(15,20,28,.45); display: grid; place-items: center; z-index: 50; }
.modal-box { background: var(--surface); border-radius: 12px; padding: 20px; width: min(560px, 92vw); max-height: 85vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--side); color: var(--on-accent); padding: 10px 16px; border-radius: 8px; z-index: 60; max-width: 80vw; }
.toast.error { background: var(--danger); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Impression */
#print-area { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  #app, .modal, .toast { display: none !important; }
  #print-area { display: block; font-size: 11px; color: #000; }
  #print-area img { max-width: 100%; }
  #print-area table { width: 100%; border-collapse: collapse; }
  #print-area th, #print-area td { border-bottom: 1px solid #ccc; padding: 4px; text-align: left; }
  #print-area .num { text-align: right; }
  #print-area .lot td { background: #f1f3f5; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-area .head { display: flex; justify-content: space-between; margin-bottom: 18px; }
  #print-area .tot { margin-left: auto; width: 260px; margin-top: 12px; }
  #print-area .tot div { display: flex; justify-content: space-between; padding: 2px 0; }
  #print-area .page-break { page-break-before: always; }
}

/* Largeurs minimales du tableau de devis (défilement horizontal sur petit écran) */
#devis-table table.grid { min-width: 880px; }
#devis-table table.grid td:first-child { width: 170px; }
#biblio-table table.grid td:first-child { width: 200px; }
@media (max-width: 1100px) { .devis-side { width: 260px; } }

/* Bibliothèques, devis importés, entreprise */
.filters { display: flex; gap: 8px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); align-items: center; }
.filters input[type=search] { width: 280px; }
.stat { font-size: 11px; color: var(--muted); white-space: nowrap; }
.stat b { color: var(--good); }
.more { text-align: center; padding: 12px; }
.import-preview { max-height: 260px; overflow: auto; margin: 8px 0; border: 1px solid var(--border); border-radius: 6px; }
.import-preview table { border-collapse: collapse; font-size: 12px; width: 100%; }
.import-preview td, .import-preview th { padding: 3px 6px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.import-preview th { background: var(--surface-2); position: sticky; top: 0; }
.import-preview select { font-size: 12px; padding: 2px; }
.map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.modal-box.wide { width: min(1000px, 95vw); }
.entreprise { max-width: 760px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.entreprise .full { grid-column: 1 / -1; }
.logo-preview { max-height: 70px; max-width: 220px; display: block; margin: 4px 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.kpis div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.kpis b { display: block; font-size: 20px; }
.score { font-size: 11px; padding: 1px 6px; border-radius: 8px; background: var(--good-bg); color: var(--good); }
.score.low { background: var(--warn-bg); color: var(--warn); }

/* Déboursé, rentabilité, rapports */
button.link { border: none; background: none; color: var(--info); cursor: pointer; font: inherit; text-decoration: underline dotted; padding: 0; }
input.forced { color: var(--danger); font-weight: 600; }
.neg { color: var(--danger); }
.pos { color: var(--good); }
.fa-row { border-bottom: 1px dashed var(--border); padding: 4px 0; display: flex; flex-direction: column; gap: 4px; }
.fa-row input, .fa-row select { font-size: 12px; padding: 4px 6px; min-width: 0; }
.biblio-grid { min-width: 1500px; }
.biblio-grid td input, .biblio-grid td select { font-size: 12px; }
@media print {
  #print-area.landscape { font-size: 9px; }
  #print-area table.compact td, #print-area table.compact th { padding: 2px 3px; }
  #print-area .cols { display: flex; gap: 24px; margin-top: 16px; }
  #print-area .cols > div { flex: 1; }
  #print-area h3 { margin-top: 14px; }
}
@page paysage { size: A4 landscape; margin: 10mm; }
@media print { #print-area.landscape { page: paysage; } }

/* ===== V3 : connexion, onglets, pilotage, assistant ===== */
.auth { position: fixed; inset: 0; display: grid; place-items: center; background: linear-gradient(135deg, #1f2733, #3b2a1f); z-index: 40; }
.auth-box { background: var(--surface); border-radius: 14px; padding: 28px; width: min(420px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.brand.big b { color: var(--text); font-size: 20px; }
.auth-tabs { margin: 16px 0; }
#app { display: flex; height: 100vh; }
#app.hidden { display: none; }
#side-search { width: 100%; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); color: var(--on-accent); font-size: 12px; }
.me { font-size: 12px; display: flex; justify-content: space-between; gap: 6px; }
.me .link { color: var(--side-text); }
.dot-statut { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; background: var(--muted-2); }
.s-a_verifier { --c: var(--warn); } .s-pret { --c: #1c7ed6; } .s-valide { --c: var(--good); } .s-emis { --c: var(--ai); } .s-revise { --c: var(--muted-2); } .s-brouillon { --c: var(--muted-2); }
.dot-statut { background: var(--c, var(--muted-2)); }
.statut { font-size: 12px; padding: 3px 9px; border-radius: 12px; background: color-mix(in srgb, var(--c, var(--muted-2)) 15%, var(--surface)); color: var(--c, var(--muted)); font-weight: 600; white-space: nowrap; }
.fiab-badge { font-size: 12px; padding: 3px 9px; border-radius: 12px; font-weight: 600; }
.fiab-badge.ok { background: var(--good-bg); color: var(--good); } .fiab-badge.moy { background: var(--warn-bg); color: var(--warn); } .fiab-badge.bas { background: var(--danger-bg); color: var(--danger); }
#project-secteur { max-width: 200px; font-size: 12px; }
.project-tabs { padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border); margin: 0; overflow-x: auto; flex-wrap: nowrap; }
.project-tabs button { white-space: nowrap; border-radius: 0; border-bottom: 2px solid transparent; }
.project-tabs button.active { border-bottom-color: var(--primary); background: transparent; }
.banner { background: var(--accent-bg); border: 1px solid var(--accent-line); color: #8a4b08; padding: 8px 12px; border-radius: 6px; margin: 8px 16px; font-size: 13px; }
.banner.neg { background: var(--danger-bg); border-color: var(--danger-bg-2); color: var(--danger); }
.pane-scroll { overflow: auto; padding: 16px 20px 40px; flex: 1; }
.section-head { display: flex; align-items: center; gap: 8px; margin: 22px 0 8px; flex-wrap: wrap; }
.section-head h3 { margin: 0; }
.row.wrap { flex-wrap: wrap; }
.row > .btn { flex: 0 0 auto; }
.sep { border-top: 1px dashed var(--border); margin: 6px 0; }
.ghost-ai { background: var(--ai-bg) !important; color: var(--ai) !important; border-color: var(--ai-line) !important; }
.tag.ok { background: var(--good-bg); color: var(--good); }
.tag.t1 { background: var(--good-bg); color: var(--good); } .tag.t2 { background: var(--warn-bg); color: var(--warn); } .tag.t3 { background: var(--danger-bg); color: var(--danger); }
.valid { border: 1px solid var(--border); background: var(--surface); border-radius: 50%; width: 20px; height: 20px; font-size: 11px; cursor: pointer; color: var(--muted-2); padding: 0; }
.valid.on { background: var(--good); border-color: var(--good); color: var(--on-accent); }
.qsrc { font-size: 10px; color: var(--muted); }
.qbtn { font-weight: 600; }
tr.row-neg td { background: var(--danger-bg); }
tr.flash td { animation: flash 2s; }
@keyframes flash { from { background: var(--flash); } }
.lot-row[data-lot] { cursor: pointer; }
.caret { display: inline-block; width: 12px; color: var(--muted); }
#devis-filtre { width: 170px; }
.devis-grid { min-width: 1120px; }
.devis-actions { flex-wrap: wrap; }
.hyp.warn { background: var(--accent-bg); }
.qtable { width: 100%; border-collapse: collapse; }
.qtable td, .qtable th { padding: 4px 6px; border-bottom: 1px solid var(--line-soft); text-align: left; font-size: 13px; }
.res-table input, .res-table select { width: 100%; font-size: 12px; padding: 3px 4px; }
.pick { cursor: pointer; } .pick:hover td { background: var(--accent-bg); }
.table-scroll { overflow-x: auto; }
table.risques { min-width: 1400px; }
table.risques textarea, table.risques input, table.risques select { width: 100%; font-size: 12px; }
.matrice { border-collapse: collapse; font-size: 12px; }
.matrice td, .matrice th { width: 34px; height: 30px; text-align: center; }
.matrice td.crit-l, .crit.crit-l { background: var(--good-bg); } .matrice td.crit-m, .crit.crit-m { background: var(--accent-bg); } .matrice td.crit-h, .crit.crit-h { background: var(--danger-bg-2); }
.matrice .axe { font-size: 11px; color: var(--muted); }
.crit { padding: 2px 8px; border-radius: 10px; font-weight: 700; }
.scenarios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.scen.actif { border-color: var(--primary); box-shadow: 0 0 0 2px var(--accent-line); }
.sim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 16px; }
.sim-val { float: right; font-weight: 700; color: var(--text); }
.sim-table { max-width: 720px; margin-top: 10px; }
.tornado { display: grid; grid-template-columns: 140px 1fr 120px; gap: 10px; align-items: center; max-width: 720px; margin: 4px 0; font-size: 13px; }
.tornado .bar { background: var(--surface-2); height: 12px; border-radius: 6px; overflow: hidden; }
.tornado i { display: block; height: 100%; }
.neg-bg { background: var(--danger); } .pos-bg { background: #40c057; }
.workflow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.workflow .step { padding: 4px 10px; border-radius: 14px; background: var(--surface-2); color: var(--muted); }
.workflow .step.on { background: var(--primary); color: var(--on-accent); font-weight: 600; }
.workflow .arrow { color: var(--muted-2); }
.fiab { width: 340px; }
.gauge { --v: 0; width: 120px; height: 120px; border-radius: 50%; margin: 4px auto 10px; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 79%), conic-gradient(var(--primary) calc(var(--v) * 1%), var(--surface-3) 0); }
.gauge b { font-size: 30px; line-height: 1; } .gauge span { font-size: 11px; color: var(--muted); }
.issues { list-style: none; padding: 0; margin: 4px 0 10px; }
.issues li { padding: 4px 8px; border-radius: 4px; font-size: 13px; }
.issues li[data-ligne] { cursor: pointer; } .issues li[data-ligne]:hover { background: var(--surface-2); }
.issues li.erreur { color: var(--danger); }
tr.ajout td { background: var(--good-bg); } tr.suppression td { background: var(--danger-bg); text-decoration: line-through; }
.journal { max-height: 320px; overflow: auto; font-size: 13px; border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; background: var(--surface); }
.journal > div { padding: 3px 0; border-bottom: 1px dashed var(--surface-2); }
.cons { margin-bottom: 14px; }
.cons .import-preview td { white-space: normal; }
.contrat textarea { font-size: 13px; }
.analyse h4 { margin: 12px 0 4px; font-size: 13px; }
.livrables { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.livrable { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; font: inherit; }
.livrable:hover { border-color: var(--primary); background: var(--accent-bg); }
.livrable span { font-size: 12px; color: var(--muted); }
.secret { font-size: 18px; background: var(--surface-2); padding: 10px; border-radius: 6px; user-select: all; }
.assistant { position: fixed; right: 0; top: 0; bottom: 0; width: 420px; background: var(--surface); border-left: 1px solid var(--border); box-shadow: -10px 0 30px rgba(0,0,0,.12); display: flex; flex-direction: column; z-index: 30; }
.assistant header { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
#assistant-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.msg.user { align-self: flex-end; background: var(--primary); color: var(--on-accent); }
.msg.assistant { align-self: flex-start; background: var(--surface-2); }
.msg .action { display: flex; gap: 8px; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; margin-top: 6px; }
.msg .action.fait { opacity: .7; }
.exemples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { border: 1px solid var(--ai-line); background: var(--ai-bg); color: var(--ai); border-radius: 14px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
#assistant-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--border); }
#assistant-form input { flex: 1; }
.spinner.dark { border-color: rgba(0,0,0,.15); border-top-color: var(--ai); }
.home .kpis b { font-size: 22px; }
.card .row { justify-content: space-between; align-items: center; }
@media print {
  #print-area .watermark { color: #c92a2a; border: 1px solid #c92a2a; padding: 4px 8px; display: inline-block; margin-bottom: 8px; font-weight: 700; }
  #print-area tr.sub td { font-size: 8px; color: #555; border-bottom: 1px dotted #ddd; }
  #print-area .neg { color: #c92a2a; }
}
@media (max-width: 1100px) { .scenarios { grid-template-columns: 1fr; } .assistant { width: 100%; } }
