
/* ── RESET & VARS ── */
*{box-sizing:border-box;margin:0;padding:0}
:root{
  color-scheme:dark;
  --bg:#0b1220;--bg2:#111a2b;--bg3:#182338;--bg4:#243149;
  --border:rgba(148,163,184,.13);--border2:rgba(148,163,184,.24);
  --text1:#f5f7ff;--text2:#b5c0d4;--text3:#8190aa;
  --accent:#3157c8;--accent2:#5b8cff;--accent-g:rgba(91,140,255,.16);
  --teal:#2dd4bf;--teal-bg:rgba(45,212,191,.13);
  --amber:#f59e0b;--amber-bg:rgba(245,158,11,.14);
  --red:#f05252;--red-bg:rgba(240,82,82,.14);
  --green:#34d178;--green-bg:rgba(52,209,120,.13);
  --blue:#60a5fa;--blue-bg:rgba(96,165,250,.14);
  --purple:#a78bfa;--purple-bg:rgba(167,139,250,.14);
  --shadow:0 12px 30px rgba(0,0,0,.18);
  --r:10px;--r2:14px;--sw:220px;--th:56px;
}

/* Correctif fort V55 : aperçu/PDF des états en paysage réellement en 297mm */
.doc-sheet.batch-sheet{
  width:297mm!important;
  min-width:297mm!important;
  max-width:297mm!important;
  height:auto!important;
  min-height:210mm!important;
  overflow:visible!important;
  display:block!important;
}
.doc-sheet.batch-sheet .batch-list-report{
  width:297mm!important;
  max-width:297mm!important;
  min-height:210mm!important;
  box-sizing:border-box!important;
}
.doc-viewer:has(.doc-sheet.batch-sheet){
  justify-content:flex-start!important;
  align-items:flex-start!important;
  padding-left:24px!important;
  padding-right:24px!important;
}
.doc-viewer:has(.doc-sheet.batch-sheet) .doc-actions{
  width:297mm!important;
  min-width:297mm!important;
  max-width:297mm!important;
}
.batch-list-report.batch-list-purchases{
  padding:10mm 9mm!important;
}
.batch-list-report.batch-list-purchases .batch-list-head{
  margin-bottom:10px!important;
  padding-bottom:10px!important;
}
.batch-list-report.batch-list-purchases .batch-list-head h1{
  font-size:20px!important;
}
.batch-list-report.batch-list-purchases .doc-table{
  width:100%!important;
  max-width:100%!important;
  table-layout:fixed!important;
}
.batch-list-report.batch-list-purchases .doc-table th,
.batch-list-report.batch-list-purchases .doc-table td{
  white-space:normal!important;
  overflow-wrap:anywhere!important;
  word-break:normal!important;
  font-size:9.4px!important;
  line-height:1.32!important;
}
.smartb-pdf-landscape .pdf-export-sheet,
.smartb-pdf-landscape .doc-sheet.batch-sheet{
  width:297mm!important;
  min-width:297mm!important;
  max-width:297mm!important;
  height:auto!important;
  min-height:210mm!important;
  max-height:none!important;
  overflow:visible!important;
}
.smartb-pdf-landscape .batch-list-report,
.smartb-pdf-landscape .batch-list-report.batch-list-purchases{
  height:auto!important;
  min-height:210mm!important;
  max-height:none!important;
  overflow:visible!important;
}
.smartb-pdf-landscape .batch-list-report tr{
  break-inside:avoid!important;
  page-break-inside:avoid!important;
}
.smartb-pdf-landscape .batch-list-report thead{
  display:table-header-group!important;
}

/* Correctif final V56 : ne jamais couper les états PDF paysage */
.smartb-pdf-landscape,
.smartb-pdf-landscape .pdf-export-sheet,
.smartb-pdf-landscape .doc-sheet.batch-sheet,
.smartb-pdf-landscape .batch-list-report,
.smartb-pdf-landscape .batch-list-report.batch-list-purchases{
  height:auto!important;
  max-height:none!important;
  overflow:visible!important;
}

.doc-currency-summary{
  width:360px;
  max-width:calc(100% - 36px);
  margin:8px 18px 14px auto;
  padding:10px 12px;
  border:1px solid #dbe7ff;
  border-left:4px solid var(--doc-accent,#1a3fa8);
  border-radius:10px;
  background:linear-gradient(135deg,#f8fbff 0%,#eef5ff 100%);
  box-shadow:0 4px 14px rgba(15,23,42,.06);
  break-inside:avoid;
}
.doc-currency-title{
  font-size:9px;
  line-height:1;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-weight:800;
  color:#1a3fa8;
  margin-bottom:8px;
}
.doc-currency-grid{
  display:grid;
  grid-template-columns:1.15fr .75fr 1fr;
  gap:8px;
}
.doc-currency-grid div{
  padding:7px 8px;
  border-radius:8px;
  background:#fff;
  border:1px solid rgba(26,63,168,.1);
}
.doc-currency-grid span{
  display:block;
  font-size:8px;
  color:#64748b;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
  margin-bottom:3px;
}
.doc-currency-grid strong{
  display:block;
  color:#0f172a;
  font-size:11px;
  line-height:1.15;
  white-space:nowrap;
}

.ff-devise-summary-cards{
  padding:0 14px 14px;
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(230px,1fr));
  gap:12px;
}
.ff-devise-card{
  position:relative;
  overflow:hidden;
  padding:14px 16px;
  border-radius:16px;
  background:var(--ff-dev-bg,#eef2ff);
  border:1px solid color-mix(in srgb,var(--ff-dev-accent,#6366f1) 26%,transparent);
  box-shadow:0 12px 26px rgba(15,23,42,.08);
}
.ff-devise-card:before{
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width:5px;
  background:linear-gradient(180deg,var(--ff-dev-main,#4338ca),var(--ff-dev-accent,#6366f1));
}
.ff-devise-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:8px;
}
.ff-devise-top span{
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--ff-dev-main,#4338ca);
}
.ff-devise-top strong{
  font-size:11px;
  color:#fff;
  background:var(--ff-dev-main,#4338ca);
  border-radius:999px;
  padding:4px 8px;
  white-space:nowrap;
}
.ff-devise-amount{
  color:var(--ff-dev-main,#4338ca);
  font-size:26px;
  line-height:1.05;
  font-weight:950;
  letter-spacing:-.04em;
}
.ff-devise-amount small{
  font-size:13px;
  letter-spacing:0;
}
.ff-devise-bottom{
  margin-top:10px;
  padding-top:9px;
  border-top:1px solid rgba(15,23,42,.08);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}
.ff-devise-bottom span{
  color:#64748b;
  font-size:11px;
  font-weight:700;
}
.ff-devise-bottom strong{
  color:#0f172a;
  font-size:13px;
  font-weight:900;
  white-space:nowrap;
}
/* ── THÈME CLAIR ── */
[data-theme="light"]{
  color-scheme:light;
  --bg:#f2f5fa;--bg2:#ffffff;--bg3:#f7f9fc;--bg4:#e8edf5;
  --border:rgba(30,41,59,.10);--border2:rgba(30,41,59,.18);
  --text1:#101828;--text2:#475467;--text3:#667085;
  --accent:#1a3fa8;--accent2:#245dcc;--accent-g:rgba(36,93,204,.10);
  --teal:#0f8f83;--teal-bg:rgba(15,143,131,.10);
  --amber:#b76e00;--amber-bg:rgba(217,119,6,.11);
  --red:#c93636;--red-bg:rgba(201,54,54,.10);
  --green:#168647;--green-bg:rgba(22,134,71,.10);
  --blue:#245dcc;--blue-bg:rgba(36,93,204,.10);
  --purple:#7048b8;--purple-bg:rgba(112,72,184,.10);
  --shadow:0 10px 28px rgba(31,42,68,.08);
}
[data-theme="light"] body,[data-theme="light"] html{background:var(--bg)}
[data-theme="light"] .finput,[data-theme="light"] .fselect,[data-theme="light"] .ftextarea{background:#fff;color:#0f172a;border-color:rgba(0,0,0,0.15)}
[data-theme="light"] .linput{background:#f8fafc;color:#0f172a}
[data-theme="light"] #sidebar{background:linear-gradient(180deg,#173b91 0%,#102b6d 100%)}
[data-theme="light"] .nl{color:rgba(255,255,255,0.5)}
[data-theme="light"] .ni{color:rgba(255,255,255,0.80)}
[data-theme="light"] .ni svg{stroke:rgba(255,255,255,0.80)}
[data-theme="light"] .ni:hover{background:rgba(255,255,255,0.15);color:#fff}
[data-theme="light"] .ni:hover svg{stroke:#fff}
[data-theme="light"] .ni.active{background:rgba(255,255,255,0.22);color:#fff}
[data-theme="light"] .ni.active svg{stroke:#fff}
[data-theme="light"] .ni.active::before{background:#ff6b5f}
[data-theme="light"] .logo-txt{color:#fff}
[data-theme="light"] .nl{color:rgba(255,255,255,0.45);letter-spacing:.1em}
[data-theme="light"] .nl.module-principal{color:#9cc5ff}
[data-theme="light"] .nl.module-commerce{color:#86efdf}
[data-theme="light"] .nl.module-achats{color:#d8b4fe}
[data-theme="light"] .nl.module-stock{color:#ffd27d}
[data-theme="light"] #nav-group-finance>.nav-parent{color:#9ff0bd;background:rgba(52,209,120,.12)}
[data-theme="light"] #nav-group-tresorerie>.nav-parent{color:#86efdf}
[data-theme="light"] #nav-group-recouvrement>.nav-parent{color:#ffd27d}
[data-theme="light"] .uname,[data-theme="light"] .urole{color:rgba(255,255,255,0.9)}
[data-theme="light"] .ucard:hover{background:rgba(255,255,255,0.12)}
[data-theme="light"] #topbar{background:#fff;border-color:rgba(0,0,0,0.08)}
[data-theme="light"] #page-title{color:#0f172a}
[data-theme="light"] .search{background:#f1f5f9;border-color:rgba(0,0,0,0.1)}
[data-theme="light"] .search input{color:#0f172a}
[data-theme="light"] .btn-ghost{background:#f1f5f9;color:#475569;border-color:rgba(0,0,0,0.1)}
[data-theme="light"] .btn-ghost:hover{background:#e2e8f0;color:#0f172a}
[data-theme="light"] .kcard{background:#fff;border-color:rgba(0,0,0,0.08)}
[data-theme="light"] .panel{background:#fff;border-color:rgba(0,0,0,0.08)}
[data-theme="light"] thead th{background:#f8fafc;color:#64748b}
[data-theme="light"] tbody td{color:#475569}
[data-theme="light"] tbody tr:hover td{background:#f1f5f9;color:#0f172a}
[data-theme="light"] .mbox{background:#fff;border-color:rgba(0,0,0,0.1)}
[data-theme="light"] .mh{border-color:rgba(0,0,0,0.08)}
[data-theme="light"] .form-wrap,[data-theme="light"] .faction{background:#fff}
[data-theme="light"] .faction{border-color:rgba(0,0,0,0.08)}
[data-theme="light"] .totaux{background:#f8fafc}
[data-theme="light"] .trow{border-color:rgba(0,0,0,0.06);color:#475569}
[data-theme="light"] #toast{background:#fff;box-shadow:0 8px 30px rgba(0,0,0,0.12);color:#0f172a;border-color:rgba(0,0,0,0.1)}
[data-theme="light"] #login-page{background:linear-gradient(135deg,#e8f0fe,#f0f4f8)}
[data-theme="light"] .login-box{background:#fff;box-shadow:0 20px 60px rgba(0,0,0,0.1)}
[data-theme="light"] .login-err{background:rgba(220,38,38,0.08)}
[data-theme="light"] .empty{color:#94a3b8}
[data-theme="light"] .ptrack,[data-theme="light"] .btrack{background:#e2e8f0}
[data-theme="light"] .loading{color:#94a3b8}
[data-theme="light"] .alert-item:hover{background:#f8fafc}
[data-theme="light"] .pcard{background:#fff;border-color:rgba(0,0,0,0.08)}
[data-theme="light"] .pcol{background:#f8fafc}

html,body{height:100%;overflow:hidden;font-family:'Inter',system-ui,sans-serif;background:var(--bg);color:var(--text1);font-size:13px}
::-webkit-scrollbar{width:4px;height:4px}
::-webkit-scrollbar-thumb{background:var(--bg4);border-radius:4px}

/* ── LAYOUT ── */
#app{display:flex;height:100vh}
#sidebar{width:var(--sw);background:linear-gradient(180deg,var(--bg2),#0d1627);border-right:1px solid var(--border);display:flex;flex-direction:column;flex-shrink:0}
#main{flex:1;display:flex;flex-direction:column;overflow:hidden;min-width:0}
#content{flex:1;overflow-y:auto;padding:20px}

/* ── SIDEBAR ── */
#logo{padding:16px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:9px}
.logo-ic{width:30px;height:30px;border-radius:8px;background:linear-gradient(135deg,#1a3fa8,#2563eb);display:flex;align-items:center;justify-content:center;flex-shrink:0}
.logo-ic svg{width:16px;height:16px;stroke:#fff;fill:none}
.logo-txt{font-size:14px;font-weight:700;letter-spacing:-.3px}
.logo-txt span{color:var(--accent2)}
#nav{padding:8px;flex:1;overflow-y:auto}
.nl{font-size:9px;font-weight:700;color:var(--text3);text-transform:uppercase;letter-spacing:.11em;padding:12px 8px 5px}
.nl::before{content:'';display:inline-block;width:5px;height:5px;border-radius:50%;background:currentColor;margin-right:6px;vertical-align:1px}
.nl.module-principal{color:var(--blue)}
.nl.module-commerce{color:var(--teal)}
.nl.module-achats{color:var(--purple)}
.nl.module-stock{color:var(--amber)}
.ni{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:8px;cursor:pointer;color:var(--text2);transition:all .15s;margin-bottom:1px;font-size:12.5px;position:relative}
.ni:hover{background:var(--bg3);color:var(--text1)}
.ni.active{background:var(--accent-g);color:var(--accent2);font-weight:500}
.ni.active::before{content:'';position:absolute;left:0;top:50%;transform:translateY(-50%);width:3px;height:16px;background:var(--accent);border-radius:0 3px 3px 0}
.ni svg{width:16px;height:16px;stroke:currentColor;fill:none;flex-shrink:0}
.nav-parent{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:8px;cursor:pointer;color:var(--text1);font-size:12.5px;font-weight:650;margin-top:2px}
.nav-parent:hover{background:var(--bg3)}
.nav-parent svg{width:16px;height:16px;stroke:currentColor;fill:none;flex-shrink:0}
.nav-arrow{margin-left:auto;font-size:14px;color:var(--text3);transition:transform .18s}
.nav-group.open>.nav-parent .nav-arrow{transform:rotate(90deg)}
.nav-children{display:none;padding-left:8px;border-left:1px solid var(--border);margin-left:10px}
.nav-group.open>.nav-children{display:block}
.nav-group.level-2>.nav-parent{color:var(--text2);font-size:12px;padding-left:8px}
.nav-group.level-2>.nav-children{margin-left:8px}
#nav-group-finance{margin-top:11px;padding-top:7px;border-top:1px solid var(--border)}
#nav-group-finance>.nav-parent{color:var(--green);background:var(--green-bg)}
#nav-group-finance>.nav-parent:hover{box-shadow:inset 0 0 0 1px rgba(52,209,120,.18)}
#nav-group-tresorerie>.nav-parent{color:var(--teal)}
#nav-group-recouvrement>.nav-parent{color:var(--amber)}
#nav-group-factures-vente>.nav-parent{color:var(--teal)}
#nav-group-factures-achats>.nav-parent{color:var(--purple)}
.nbadge{margin-left:auto;font-size:9px;font-weight:600;padding:1px 6px;border-radius:20px}
.nbadge.r{background:rgba(229,57,53,0.25);color:#ff8a80}
.nbadge.a{background:rgba(255,181,71,0.25);color:#ffd54f}
[data-theme="light"] .nbadge.r{background:rgba(229,57,53,0.3);color:#ffcdd2}
[data-theme="light"] .nbadge.a{background:rgba(255,181,71,0.3);color:#fff9c4}
#sb-foot{padding:10px;border-top:1px solid var(--border)}
.ucard{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:8px;cursor:pointer}
.ucard:hover{background:var(--bg3)}
.uav{width:28px;height:28px;border-radius:50%;background:linear-gradient(135deg,#1a3fa8,#2563eb);display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#fff;flex-shrink:0}
.uname{font-size:12px;font-weight:600}
.urole{font-size:10px;color:var(--text3)}

/* ── TOPBAR ── */
#topbar{height:var(--th);background:var(--bg2);border-bottom:1px solid var(--border);padding:0 20px;display:flex;align-items:center;gap:12px;flex-shrink:0}
#page-title{font-size:15px;font-weight:700;flex:1;letter-spacing:-.3px}
.search{display:flex;align-items:center;gap:6px;background:var(--bg3);border:1px solid var(--border2);border-radius:8px;padding:6px 11px;width:190px;transition:border-color .15s,box-shadow .15s}
.search:focus-within{border-color:var(--accent2);box-shadow:0 0 0 3px var(--accent-g)}
.search svg{width:14px;height:14px;stroke:var(--text3);fill:none;flex-shrink:0}
.search input{border:none;background:transparent;outline:none;font-size:12px;color:var(--text1);width:100%;font-family:inherit}
.search input::placeholder{color:var(--text3)}
#data-filters-bar{align-items:center;gap:10px;flex-wrap:wrap;background:var(--bg2);border:1px solid var(--border);border-radius:var(--r2);padding:11px 13px;margin-bottom:14px;box-shadow:var(--shadow)}
.filter-bar-label{font-size:10px;font-weight:750;color:var(--text3);text-transform:uppercase;letter-spacing:.07em;white-space:nowrap}
#data-filters-bar .search{width:min(340px,100%);flex:1 1 240px}
#date-filters{flex:1 1 auto;flex-wrap:wrap}
.date-filter-label{font-size:10px;font-weight:650;color:var(--text3);text-transform:uppercase}
#filter-date-from,#filter-date-to{padding:7px 9px;font-size:11px;border-radius:7px;border:1px solid var(--border2);background:var(--bg3);color:var(--text1);font-family:inherit;outline:none}
#filter-date-from:focus,#filter-date-to:focus{border-color:var(--accent2);box-shadow:0 0 0 3px var(--accent-g)}
#filter-result-count{font-size:10px;color:var(--text3);min-width:65px;margin-left:auto}
#table-summary{padding:9px 14px;margin:-5px 0 14px;background:var(--accent-g);border:1px solid rgba(91,140,255,.18);border-radius:9px;font-size:12px;color:var(--text2)}
.btn{display:inline-flex;align-items:center;gap:5px;padding:7px 13px;border-radius:8px;font-size:12px;font-weight:600;cursor:pointer;border:none;font-family:inherit;transition:all .15s}
.btn:focus-visible,.ni:focus-visible,.nav-parent:focus-visible{outline:2px solid var(--accent2);outline-offset:2px}
.btn svg{width:14px;height:14px;stroke:currentColor;fill:none}
.btn-primary{background:linear-gradient(135deg,#1a3fa8,#3478e5);color:#fff;box-shadow:0 5px 14px rgba(26,63,168,.24)}
.btn-primary:hover{filter:brightness(1.08);transform:translateY(-1px)}
.btn-ghost{background:var(--bg3);color:var(--text2);border:1px solid var(--border2)}
.btn-ghost:hover{background:var(--bg4);color:var(--text1)}
.btn.refreshing svg{animation:spin .65s linear infinite}
.btn-sm{padding:5px 10px;font-size:11px}
.btn-danger{background:var(--red-bg);color:var(--red);border:1px solid rgba(255,92,124,.2)}

/* ── PAGES ── */
.page{display:none}
.page.active{display:block}

/* ── KPI ── */
.kgrid{display:grid;gap:12px;margin-bottom:18px}
.k4{grid-template-columns:repeat(4,1fr)}
.k3{grid-template-columns:repeat(3,1fr)}
.kcard{background:var(--bg2);border:1px solid var(--border);border-radius:var(--r2);padding:14px 16px;position:relative;overflow:hidden;box-shadow:var(--shadow)}
.kcard::after{content:'';position:absolute;top:0;right:0;width:50px;height:50px;border-radius:0 0 0 50px;opacity:.07}
.kcard.ac::after{background:var(--accent)}
.kcard.tl::after{background:var(--teal)}
.kcard.am::after{background:var(--amber)}
.kcard.rd::after{background:var(--red)}
.kcard.gn::after{background:var(--green)}
.klabel{font-size:10px;color:var(--text3);font-weight:500;text-transform:uppercase;letter-spacing:.04em;margin-bottom:5px}
.kval{font-size:21px;font-weight:700;letter-spacing:-.5px}
.kdelta{font-size:10px;margin-top:3px;color:var(--text3)}
.kdelta.up{color:var(--green)}
.kdelta.dn{color:var(--red)}

/* ── PANELS ── */
.panel{background:var(--bg2);border:1px solid var(--border);border-radius:var(--r2);overflow:hidden;margin-bottom:14px;box-shadow:var(--shadow)}
.ph{padding:12px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:8px}
.pt{font-size:12px;font-weight:600}
.pl{font-size:11px;color:var(--accent2);cursor:pointer}
.pl:hover{text-decoration:underline}
.g2{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:14px}
.g32{display:grid;grid-template-columns:3fr 2fr;gap:14px;margin-bottom:14px}
.g21{display:grid;grid-template-columns:2fr 1fr;gap:14px;margin-bottom:14px}
.gcol{display:flex;flex-direction:column;gap:14px}

/* ── TABLES ── */
.tw{overflow-x:auto}
table{width:100%;border-collapse:collapse;min-width:480px}
thead th{padding:8px 14px;text-align:left;font-size:10px;font-weight:600;color:var(--text3);text-transform:uppercase;letter-spacing:.05em;border-bottom:1px solid var(--border);background:var(--bg3);white-space:nowrap}
tbody td{padding:9px 14px;border-bottom:1px solid var(--border);color:var(--text2);font-size:12px}
tbody tr:last-child td{border-bottom:none}
tbody tr:hover td{background:var(--accent-g);color:var(--text1);cursor:pointer}
td strong{color:var(--text1);font-weight:600}
.tc{text-align:center}
.tr{text-align:right}

/* ── BADGES ── */
.bj{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;border-radius:20px;font-size:10px;font-weight:650;white-space:nowrap;border:1px solid transparent}
.bj::before{content:'';width:5px;height:5px;border-radius:50%;background:currentColor;flex:0 0 auto}
.bj.g{background:var(--green-bg);color:var(--green);border-color:rgba(52,209,120,.18)}
.bj.r{background:var(--red-bg);color:var(--red);border-color:rgba(240,82,82,.18)}
.bj.a{background:var(--amber-bg);color:var(--amber);border-color:rgba(245,158,11,.20)}
.bj.b{background:var(--blue-bg);color:var(--blue);border-color:rgba(96,165,250,.18)}
.bj.p{background:var(--purple-bg);color:var(--purple);border-color:rgba(167,139,250,.18)}
.bj.t{background:var(--teal-bg);color:var(--teal);border-color:rgba(45,212,191,.18)}
.bj.s{background:var(--bg4);color:var(--text2)}
.attachment-drop{border:1px dashed var(--border2);border-radius:10px;padding:12px;background:var(--bg3);transition:border-color .15s,background .15s}
.attachment-drop:focus-within{border-color:var(--accent2);background:var(--accent-g)}
.attachment-help{font-size:10px;color:var(--text3);margin-top:5px}
.attachment-list{display:flex;flex-direction:column;gap:8px}
.attachment-item{display:grid;grid-template-columns:36px minmax(0,1fr) auto;gap:10px;align-items:center;padding:10px;border:1px solid var(--border);border-radius:10px;background:var(--bg3)}
.attachment-icon{width:36px;height:36px;border-radius:9px;background:var(--red-bg);color:var(--red);display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:800}
.attachment-item.image .attachment-icon{background:var(--purple-bg);color:var(--purple)}
.attachment-name{font-size:11px;font-weight:700;color:var(--text1);overflow-wrap:anywhere}
.attachment-meta{font-size:9px;color:var(--text3);margin-top:3px}
.attachment-actions{display:flex;gap:5px;flex-wrap:wrap;justify-content:flex-end}
.attachment-badge{display:inline-flex;align-items:center;gap:4px;color:var(--accent2);font-size:10px;font-weight:700}

/* ── CAISSE / POINT DE VENTE ── */
.pos-layout{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(340px,.8fr);gap:16px;align-items:start}
.pos-panel{border-color:var(--border2)}
.pos-catalogue-head{padding:14px 16px;background:linear-gradient(135deg,var(--bg2),var(--bg3))}
.pos-title-wrap{display:flex;align-items:center;gap:10px}
.pos-title-icon{width:34px;height:34px;border-radius:10px;background:var(--accent-g);color:var(--accent2);display:flex;align-items:center;justify-content:center}
.pos-title-icon svg{width:18px;height:18px;stroke:currentColor;fill:none}
.pos-subtitle{font-size:10px;color:var(--text3);margin-top:2px}
.pos-tools{display:flex;gap:8px;align-items:center}
.pos-tools .fselect{width:190px}
.pos-search-wrap{position:relative;width:260px}
.pos-search-wrap svg{position:absolute;left:11px;top:50%;transform:translateY(-50%);width:15px;height:15px;stroke:var(--text3);fill:none;pointer-events:none}
.pos-search-wrap .finput{padding-left:34px}
.pos-results{padding:9px 16px;border-bottom:1px solid var(--border);font-size:10px;color:var(--text3);display:flex;justify-content:space-between;background:var(--bg2)}
#caisse-articles{display:grid;grid-template-columns:repeat(auto-fill,minmax(175px,1fr));gap:12px;padding:14px;max-height:590px;overflow:auto}
.pos-product{--pos-card:#3157c8;--pos-card2:#5b8cff;position:relative;text-align:left;padding:0;border:1px solid color-mix(in srgb,var(--pos-card) 38%,var(--border));border-radius:14px;background:linear-gradient(155deg,color-mix(in srgb,var(--pos-card) 12%,var(--bg2)) 0%,var(--bg2) 62%);color:var(--text1);cursor:pointer;overflow:hidden;min-height:190px;transition:transform .16s,border-color .16s,box-shadow .16s}
.pos-product:hover{transform:translateY(-3px);border-color:var(--pos-card2);box-shadow:0 13px 26px color-mix(in srgb,var(--pos-card) 25%,transparent)}
.pos-product:active{transform:scale(.98)}
.pos-product:disabled{cursor:not-allowed;opacity:.58;filter:saturate(.45)}
.pos-product:disabled:hover{transform:none;border-color:var(--border);box-shadow:none}
.pos-product.tone-0{--pos-card:#2563eb;--pos-card2:#60a5fa}
.pos-product.tone-1{--pos-card:#0d9488;--pos-card2:#2dd4bf}
.pos-product.tone-2{--pos-card:#7c3aed;--pos-card2:#a78bfa}
.pos-product.tone-3{--pos-card:#ea580c;--pos-card2:#fb923c}
.pos-product.tone-4{--pos-card:#db2777;--pos-card2:#f472b6}
.pos-product.tone-5{--pos-card:#16a34a;--pos-card2:#4ade80}
.pos-product.tone-6{--pos-card:#ca8a04;--pos-card2:#facc15}
.pos-product.tone-7{--pos-card:#0891b2;--pos-card2:#22d3ee}
.pos-product-visual{height:82px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,var(--pos-card),var(--pos-card2));position:relative;overflow:hidden}
.pos-product-visual::before,.pos-product-visual::after{content:'';position:absolute;border-radius:50%;background:rgba(255,255,255,.14)}
.pos-product-visual::before{width:74px;height:74px;right:-20px;top:-30px}
.pos-product-visual::after{width:46px;height:46px;left:-14px;bottom:-22px}
.pos-product-initials{width:48px;height:48px;border-radius:15px;background:rgba(255,255,255,.94);border:1px solid rgba(255,255,255,.65);display:flex;align-items:center;justify-content:center;font-size:15px;font-weight:850;color:var(--pos-card);box-shadow:0 7px 18px rgba(0,0,0,.18);z-index:1}
.pos-product-type{position:absolute;top:8px;left:8px;padding:3px 7px;border-radius:20px;background:rgba(11,18,32,.54);color:#fff;font-size:9px;font-weight:750;backdrop-filter:blur(5px);z-index:1}
.pos-product-body{padding:12px}
.pos-product-ref{font-size:9px;color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pos-product-name{font-size:12px;font-weight:750;line-height:1.35;margin:5px 0 9px;min-height:33px}
.pos-product-footer{display:flex;align-items:flex-end;justify-content:space-between;gap:7px}
.pos-product-price{font-size:15px;font-weight:850;color:var(--pos-card2);letter-spacing:-.3px}
[data-theme="light"] .pos-product-price{color:var(--pos-card)}
.pos-product-price small{display:block;font-size:8px;font-weight:600;color:var(--text3);letter-spacing:0;margin-top:1px}
.pos-stock{font-size:9px;font-weight:700;padding:3px 6px;border-radius:20px;background:var(--green-bg);color:var(--green);white-space:nowrap}
.pos-stock.low{background:var(--amber-bg);color:var(--amber)}
.pos-stock.out{background:var(--red-bg);color:var(--red)}
.pos-stock.service{background:var(--purple-bg);color:var(--purple)}
.pos-cart-panel{position:sticky;top:0}
.pos-cart-head{background:linear-gradient(135deg,var(--accent-g),var(--bg2))}
.pos-cart-title{display:flex;align-items:center;gap:8px}
.pos-cart-count{min-width:22px;height:22px;padding:0 6px;border-radius:20px;background:var(--accent2);color:#fff;display:inline-flex;align-items:center;justify-content:center;font-size:10px;font-weight:800}
.pos-cart-content{padding:13px}
#caisse-panier{margin-top:12px;max-height:330px;overflow:auto;padding-right:3px}
.pos-cart-line{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:9px;padding:10px;margin-bottom:8px;border:1px solid var(--border);border-radius:10px;background:var(--bg3)}
.pos-cart-name{font-size:11px;font-weight:700;color:var(--text1);line-height:1.35}
.pos-cart-meta{font-size:9px;color:var(--text3);margin-top:4px}
.pos-cart-line-total{font-size:11px;font-weight:800;color:var(--accent2);margin-top:5px}
.pos-qty{display:flex;align-items:center;gap:5px;align-self:center}
.pos-qty button{width:28px;height:28px;padding:0;justify-content:center;border-radius:8px}
.pos-qty-value{min-width:26px;text-align:center;font-size:12px;font-weight:800}
.pos-totals{border:1px solid var(--border);border-radius:12px;margin-top:12px;padding:11px 12px;background:var(--bg3)}
.pos-total-row{display:flex;justify-content:space-between;font-size:11px;color:var(--text2);margin-bottom:6px}
.pos-total-main{display:flex;justify-content:space-between;align-items:end;margin-top:9px;padding-top:10px;border-top:1px solid var(--border)}
.pos-total-main span{font-size:12px;font-weight:700}
.pos-total-main strong{font-size:23px;color:var(--accent2);letter-spacing:-.7px}
.pos-payment{margin-top:13px}
.pos-checkout{width:100%;justify-content:center;margin-top:12px;padding:13px;font-size:13px}
.pos-checkout svg{width:17px;height:17px}
.pos-fullscreen-btn{white-space:nowrap}
.pos-fullscreen-btn svg{width:15px;height:15px}
body.pos-fullscreen #sidebar,body.pos-fullscreen #topbar,body.pos-fullscreen #mobile-nav-backdrop{display:none!important}
body.pos-fullscreen #main{width:100vw;height:100dvh}
body.pos-fullscreen #content{padding:10px;height:100dvh;overflow:hidden}
body.pos-fullscreen #page-caisse{display:flex!important;flex-direction:column;height:calc(100dvh - 20px)}
body.pos-fullscreen #page-caisse>.pos-layout{flex:1;min-height:0;grid-template-columns:minmax(0,1.8fr) minmax(350px,.75fr)}
body.pos-fullscreen #page-caisse>.panel:last-child{display:none}
body.pos-fullscreen .pos-panel{height:100%;margin:0;display:flex;flex-direction:column}
body.pos-fullscreen #caisse-articles{max-height:none;flex:1;grid-template-columns:repeat(auto-fill,minmax(180px,1fr))}
body.pos-fullscreen .pos-cart-content{display:flex;flex-direction:column;flex:1;min-height:0}
body.pos-fullscreen #caisse-panier{flex:1;max-height:none}
body.pos-fullscreen .pos-cart-panel{top:0}

/* ── FORMS ── */
.form-wrap{padding:16px 18px}
.fgrid{display:grid;grid-template-columns:1fr 1fr;gap:13px}
.fg{display:flex;flex-direction:column;gap:5px}
.fg.full{grid-column:span 2}
.flabel{font-size:10px;font-weight:600;color:var(--text3);text-transform:uppercase;letter-spacing:.04em}
.finput,.fselect,.ftextarea{background:var(--bg3);border:1px solid var(--border2);border-radius:7px;padding:8px 11px;font-size:12.5px;color:var(--text1);font-family:inherit;outline:none;transition:border-color .15s;width:100%}
.finput:focus,.fselect:focus,.ftextarea:focus{border-color:var(--accent)}
.finput::placeholder{color:var(--text3)}
.fselect option{background:var(--bg3)}
.ftextarea{resize:vertical;min-height:70px}
.faction{padding:12px 18px;border-top:1px solid var(--border);display:flex;justify-content:flex-end;gap:8px}
.fsep{font-size:11px;font-weight:600;color:var(--text3);text-transform:uppercase;letter-spacing:.06em;padding:12px 0 8px;border-top:1px solid var(--border);margin-top:8px;grid-column:span 2}
.fsep:first-child{border-top:none;padding-top:0}

/* ── LINES TABLE ── */
.ltable{width:100%;border-collapse:collapse}
.ltable th{padding:6px 10px;font-size:10px;font-weight:600;color:var(--text3);text-transform:uppercase;border-bottom:1px solid var(--border);background:var(--bg3)}
.ltable td{padding:6px 8px;border-bottom:1px solid var(--border)}
.linput{background:var(--bg3);border:1px solid var(--border);border-radius:5px;padding:5px 7px;font-size:12px;color:var(--text1);font-family:inherit;outline:none;width:100%}
.linput:focus{border-color:var(--accent)}
.linput.sm{width:70px}
.linput.md{width:110px}

/* ── TOTAUX ── */
.totaux{background:var(--bg3);border-radius:8px;padding:12px 14px;margin:10px 18px}
.trow{display:flex;justify-content:space-between;font-size:12px;padding:4px 0;border-bottom:1px solid var(--border);color:var(--text2)}
.trow:last-child{border-bottom:none;font-size:14px;font-weight:700;color:var(--text1);padding-top:8px}
.trow span:last-child{font-weight:500;color:var(--text1)}
.trow:last-child span:last-child{color:var(--accent2)}

/* ── MODAL ── */
.mo{display:none;position:fixed;inset:0;background:rgba(0,0,0,.65);z-index:10000;align-items:center;justify-content:center;padding:16px}
.mo.open{display:flex}
.mbox{background:var(--bg2);border:1px solid var(--border2);border-radius:16px;width:100%;max-height:90vh;overflow-y:auto;box-shadow:0 24px 60px rgba(0,0,0,.5)}
.mbox.sm{max-width:440px}
.mbox.md{max-width:620px}
.mbox.lg{max-width:860px}
#modal-ff .purchase-invoice-modal{max-width:1120px;max-height:94vh;display:flex;flex-direction:column;overflow:hidden}
#modal-ff .purchase-invoice-modal .form-wrap{overflow:auto;max-height:calc(94vh - 116px);padding:18px 20px}
#modal-ff .purchase-invoice-modal .fgrid{grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
#modal-ff .purchase-invoice-modal .fg.full{grid-column:1/-1}
#modal-ff .purchase-invoice-modal .ltable{min-width:820px}
#modal-ff .purchase-invoice-modal .faction{position:sticky;bottom:0;z-index:2;border-top:1px solid var(--border);background:var(--bg2)}
@media(max-width:1100px){
  #modal-ff .purchase-invoice-modal .fgrid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:640px){
  #modal-ff .purchase-invoice-modal .fgrid{grid-template-columns:1fr}
  #modal-ff .purchase-invoice-modal{max-height:100dvh}
  #modal-ff .purchase-invoice-modal .form-wrap{max-height:calc(100dvh - 110px)}
}
.mh{padding:14px 18px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.mt{font-size:14px;font-weight:700}
.mx{cursor:pointer;color:var(--text3);font-size:22px;line-height:1}
.mx:hover{color:var(--text1)}

/* ── TOAST ── */
#toast{position:fixed;bottom:22px;right:22px;z-index:2000;background:var(--bg2);border:1px solid var(--border2);border-radius:9px;padding:11px 16px;font-size:12px;display:flex;align-items:center;gap:7px;transform:translateY(60px);opacity:0;transition:all .3s;pointer-events:none;box-shadow:0 8px 30px rgba(0,0,0,.4)}
#toast.show{transform:translateY(0);opacity:1}
#toast svg{width:16px;height:16px;stroke:var(--green);fill:none;flex-shrink:0}

/* ── TRAITEMENT DES FACTURES PAR LOT ── */
.invoice-batch-bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 14px;border-bottom:1px solid var(--border);background:var(--bg3)}
.invoice-batch-select{display:flex;align-items:center;gap:7px;margin-right:auto;font-size:11px;color:var(--text2);cursor:pointer}
.invoice-batch-select input,.invoice-row-check{width:16px;height:16px;accent-color:var(--accent);cursor:pointer}
.invoice-batch-count{min-width:190px;padding:5px 10px;border-radius:20px;background:var(--accent-g);color:var(--accent2);font-size:10px;font-weight:700;text-align:center}
.invoice-batch-bar .btn{white-space:nowrap}
.doc-sheet.batch-sheet{display:block;overflow:visible;width:297mm;min-height:210mm;page:batchLandscape}
.doc-sheet.rec-sheet{display:block;overflow:visible;height:auto;min-height:297mm;width:210mm;max-width:210mm}
.doc-sheet.rec-sheet .rec-print-doc{min-height:297mm}
.batch-document-page{width:100%;min-height:210mm;display:flex;flex-direction:column;position:relative;background:#fff;page-break-after:always;break-after:page}
.batch-document-page:last-child{page-break-after:auto;break-after:auto}
.batch-list-report{padding:14mm 12mm;box-sizing:border-box;min-height:210mm;background:#fff}
.batch-list-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-start;padding-bottom:14px;margin-bottom:18px;border-bottom:3px solid #1a3fa8}
.batch-list-head h1{margin:0 0 6px;color:#1a3fa8;font-size:22px}
.batch-list-head p{margin:2px 0;color:#555;font-size:10px}
.batch-list-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:8px;margin:14px 0}
.batch-list-kpi{padding:10px;border:1px solid #dce3f0;border-radius:6px;background:#f7f9ff}
.batch-list-kpi span{display:block;color:#666;font-size:9px;text-transform:uppercase;margin-bottom:4px}
.batch-list-kpi strong{font-size:13px;color:#1a3fa8}
.batch-list-currency-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:8px;margin:0 0 12px}
.batch-list-currency-card{padding:9px 10px;border:1px solid #b9d7ff;border-radius:8px;background:linear-gradient(135deg,#eff6ff,#eefdf8)}
.batch-list-currency-card span{display:block;color:#3157c8;font-size:9px;font-weight:800;text-transform:uppercase;margin-bottom:3px}
.batch-list-currency-card strong{display:block;color:#0f766e;font-size:14px}
.batch-list-currency-card small{display:block;color:#64748b;font-size:9px;margin-top:3px}
.batch-list-purchases .doc-table{table-layout:fixed;width:100%}
.batch-list-purchases .doc-table th,.batch-list-purchases .doc-table td{font-size:9.4px;padding:6px 7px;line-height:1.32;white-space:normal;overflow-wrap:anywhere;word-break:normal}
.batch-list-purchases .doc-table th:nth-child(1),.batch-list-purchases .doc-table td:nth-child(1){width:4%}
.batch-list-purchases .doc-table th:nth-child(2),.batch-list-purchases .doc-table td:nth-child(2){width:12%}
.batch-list-purchases .doc-table th:nth-child(3),.batch-list-purchases .doc-table td:nth-child(3){width:13%}
.batch-list-purchases .doc-table th:nth-child(4),.batch-list-purchases .doc-table td:nth-child(4){width:20%}
.batch-list-purchases .doc-table th:nth-child(5),.batch-list-purchases .doc-table td:nth-child(5){width:16%}
.batch-list-purchases .doc-table th:nth-child(6),.batch-list-purchases .doc-table td:nth-child(6){width:14%}
.batch-list-purchases .doc-table th:nth-child(7),.batch-list-purchases .doc-table td:nth-child(7){width:14%}
.batch-list-purchases .doc-table th:nth-child(8),.batch-list-purchases .doc-table td:nth-child(8){width:7%}
.batch-list-purchases .doc-table th.tr,.batch-list-purchases .doc-table td.tr{text-align:right}
.batch-list-purchases .compact-money{font-variant-numeric:tabular-nums;white-space:normal!important}
.batch-list-purchases .compact-money small{color:#64748b;font-size:7.8px;font-weight:700;text-transform:uppercase}
.batch-list-purchases .wrap-cell{white-space:normal!important;overflow-wrap:anywhere}

/* ── COMMISSIONS COMMERCIALES ── */
.commission-hero{padding:18px;background:linear-gradient(135deg,rgba(49,87,200,.18),rgba(45,212,191,.10));border:1px solid rgba(91,140,255,.18);border-radius:14px;margin-bottom:14px}
.commission-hero-top{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}
.commission-hero h2{font-size:18px;margin:0 0 5px;color:var(--text1)}
.commission-hero p{font-size:11px;color:var(--text2);margin:0;max-width:650px;line-height:1.6}
.commission-filters{display:flex;align-items:end;gap:8px;flex-wrap:wrap;margin-top:15px}
.commission-filters .fg{margin:0;min-width:160px}
.commission-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px;margin:14px 0}
.commission-card{background:var(--bg2);border:1px solid var(--border);border-radius:14px;padding:15px;box-shadow:var(--shadow)}
.commission-card-head{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
.commission-avatar{width:38px;height:38px;border-radius:11px;background:linear-gradient(135deg,var(--accent),var(--teal));color:#fff;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:12px}
.commission-name{font-weight:750;color:var(--text1);margin-bottom:2px}.commission-rule{font-size:10px;color:var(--text3)}
.commission-amount{font-size:22px;font-weight:850;color:var(--accent2);margin:14px 0 3px}
.commission-caption{font-size:10px;color:var(--text3)}
.commission-progress{height:7px;border-radius:10px;background:var(--bg4);overflow:hidden;margin:11px 0 6px}
.commission-progress span{display:block;height:100%;background:linear-gradient(90deg,var(--accent2),var(--teal));border-radius:10px}
.commission-meta{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-top:12px}
.commission-meta div{background:var(--bg3);padding:7px;border-radius:8px}.commission-meta small{display:block;font-size:8px;color:var(--text3);text-transform:uppercase}.commission-meta strong{display:block;font-size:11px;margin-top:3px;color:var(--text1)}
.commission-card-actions{display:flex;gap:6px;margin-top:12px;flex-wrap:wrap}
.commission-status{display:inline-flex;padding:4px 8px;border-radius:20px;font-size:9px;font-weight:750}
.commission-status.provisoire{background:var(--amber-bg);color:var(--amber)}.commission-status.validee{background:var(--blue-bg);color:var(--blue)}.commission-status.payee{background:var(--green-bg);color:var(--green)}

/* ── ALERTS ── */
.alert-item{display:flex;align-items:center;gap:9px;padding:9px 14px;border-bottom:1px solid var(--border);transition:background .12s}
.alert-item:hover{background:var(--bg3)}
.alert-item:last-child{border-bottom:none}
.alert-dot{width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.alert-dot svg{width:13px;height:13px;stroke:currentColor;fill:none}

/* ── PROGRESS ── */
.plist{padding:14px 16px}
.prow{margin-bottom:13px}
.prow:last-child{margin-bottom:0}
.ph2{display:flex;justify-content:space-between;margin-bottom:5px}
.plabel{font-size:11px;color:var(--text2)}
.ppct{font-size:10px;font-weight:600;color:var(--text1)}
.ptrack{height:5px;background:var(--bg3);border-radius:3px;overflow:hidden}
.pfill{height:100%;border-radius:3px;transition:width .5s ease}

/* ── BAR CHART ── */
.blist{padding:14px 16px}
.brow{display:flex;align-items:center;gap:8px;margin-bottom:9px}
.brow:last-child{margin-bottom:0}
.bname{font-size:10px;color:var(--text2);width:80px;flex-shrink:0;text-align:right}
.btrack{flex:1;height:6px;background:var(--bg3);border-radius:3px;overflow:hidden}
.bfill{height:100%;border-radius:3px;transition:width .6s ease}
.bval{font-size:10px;color:var(--text3);width:70px;text-align:right;flex-shrink:0}

/* ── ACTIVITY ── */
.alist{padding:4px 0}
.aitem{display:flex;align-items:flex-start;gap:9px;padding:9px 14px;border-bottom:1px solid var(--border)}
.aitem:last-child{border-bottom:none}
.aic{width:28px;height:28px;border-radius:7px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.aic svg{width:13px;height:13px;stroke:currentColor;fill:none}
.aic.b{background:var(--blue-bg);color:var(--blue)}
.aic.g{background:var(--green-bg);color:var(--green)}
.aic.a{background:var(--amber-bg);color:var(--amber)}
.aic.r{background:var(--red-bg);color:var(--red)}
.atxt{font-size:11px;color:var(--text2);line-height:1.5}
.atime{font-size:10px;color:var(--text3);margin-top:1px}

/* ── PIPELINE ── */
.pipeline{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:14px}
.pcol{background:var(--bg3);border-radius:var(--r);padding:10px}
.pcolh{font-size:10px;font-weight:600;margin-bottom:8px;padding-bottom:6px;border-bottom:1px solid var(--border)}
.pcard{background:var(--bg2);border:1px solid var(--border);border-radius:7px;padding:9px;margin-bottom:7px;cursor:pointer;transition:border-color .15s}
.pcard:hover{border-color:var(--accent)}
.pcclient{font-size:11px;font-weight:600;margin-bottom:3px}
.pcamt{font-size:13px;font-weight:700;color:var(--accent2)}
.pcdate{font-size:10px;color:var(--text3);margin-top:3px}

/* ── LOADING ── */
.loading{display:flex;align-items:center;justify-content:center;padding:40px;color:var(--text3);font-size:12px;gap:8px}
.spin{width:16px;height:16px;border:2px solid var(--border2);border-top-color:var(--accent);border-radius:50%;animation:spin .6s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ── LOGIN PAGE ── */
#session-loader{position:fixed;inset:0;z-index:10001;background:var(--bg);display:flex;align-items:center;justify-content:center;transition:opacity .18s}
#session-loader.hidden{opacity:0;pointer-events:none}
.session-loader-box{text-align:center}
.session-loader-logo{width:58px;height:58px;margin:0 auto 14px;border-radius:16px;background:linear-gradient(135deg,#1a3fa8,#3478e5);display:flex;align-items:flex-end;justify-content:center;gap:4px;padding:13px;box-shadow:0 14px 35px rgba(26,63,168,.28)}
.session-loader-logo span{width:7px;border-radius:3px 3px 1px 1px;background:#fff;animation:sessionBars .9s ease-in-out infinite alternate}
.session-loader-logo span:nth-child(1){height:14px}
.session-loader-logo span:nth-child(2){height:24px;animation-delay:.15s}
.session-loader-logo span:nth-child(3){height:32px;background:#ff6b5f;animation-delay:.3s}
.session-loader-text{font-size:12px;font-weight:650;color:var(--text2)}
.session-loader-sub{font-size:10px;color:var(--text3);margin-top:4px}
@keyframes sessionBars{to{transform:translateY(-4px);opacity:.72}}
#login-page{display:none;position:fixed;inset:0;background:var(--bg);z-index:9999;align-items:center;justify-content:center}
#login-page.show{display:flex}
.login-box{background:var(--bg2);border:1px solid var(--border2);border-radius:20px;padding:36px;width:380px}
.login-logo{text-align:center;margin-bottom:28px}
.login-logo-ic{width:52px;height:52px;border-radius:13px;background:linear-gradient(135deg,#1a3fa8,#2563eb);display:flex;align-items:center;justify-content:center;margin:0 auto 10px}
.login-logo-ic svg{width:26px;height:26px;stroke:#fff;fill:none}
.login-title{font-size:22px;font-weight:700;letter-spacing:-.5px}
.login-sub{font-size:12px;color:var(--text3);margin-top:4px}
.login-err{background:var(--red-bg);color:var(--red);border-radius:7px;padding:8px 12px;font-size:12px;margin-bottom:12px;display:none}
.login-err.show{display:block}

/* ── EMPTY STATE ── */
.empty{text-align:center;padding:40px 20px;color:var(--text3)}
.empty svg{width:40px;height:40px;stroke:var(--text3);fill:none;margin:0 auto 10px;display:block;opacity:.4}
.empty p{font-size:12px}

/* ── RESPONSIVE ── */
@media(max-width:900px){
  body{overscroll-behavior:none}
  #sidebar{position:fixed;left:0;top:0;bottom:0;width:min(86vw,330px);z-index:10020;transform:translateX(-105%);transition:transform .22s ease;box-shadow:18px 0 45px rgba(0,0,0,.35)}
  body.mobile-nav-open #sidebar{transform:translateX(0)}
  body.mobile-nav-open{overflow:hidden}
  #mobile-nav-backdrop{display:none;position:fixed;inset:0;background:rgba(0,0,0,.58);z-index:10010}
  body.mobile-nav-open #mobile-nav-backdrop{display:block}
  .nl,.ni span,.nbadge,.uname,.urole,.logo-txt{display:initial}
  .ni{justify-content:flex-start;padding:10px}
  .nav-parent{padding:11px 10px}
  #sb-foot{padding-bottom:calc(10px + env(safe-area-inset-bottom))}
  #topbar{height:auto;min-height:58px;padding:9px 12px;gap:7px;flex-wrap:wrap}
  #mobile-menu-btn{display:inline-flex!important;flex:0 0 auto}
  #page-title{font-size:14px;min-width:120px}
  #topbar>.btn:not(#mobile-menu-btn):not(#btn-theme):not(#btn-new){font-size:0;padding:8px}
  #topbar>.btn:not(#mobile-menu-btn):not(#btn-theme):not(#btn-new) svg{width:17px;height:17px}
  #btn-new{padding:8px 10px}
  #content{padding:12px;padding-bottom:calc(18px + env(safe-area-inset-bottom))}
  #data-filters-bar{padding:10px;margin-bottom:12px;gap:8px}
  .filter-bar-label{width:100%}
  #data-filters-bar .search{width:100%;flex-basis:100%}
  #date-filters{width:100%;flex-basis:100%}
  #filter-result-count{margin-left:0}
  .k4,.k3{grid-template-columns:1fr 1fr}
  .g2,.g32,.g21{grid-template-columns:1fr}
  .pipeline{grid-template-columns:1fr 1fr}
  .panel{border-radius:11px}
  .ph{padding:11px 12px;gap:8px;align-items:flex-start;flex-wrap:wrap}
  .ph>div{max-width:100%;display:flex;flex-wrap:wrap;gap:6px}
  .btn{min-height:38px}
  .finput,.fselect,.ftextarea{font-size:16px;min-height:43px}
  .fgrid{grid-template-columns:1fr}
  .fg.full{grid-column:auto}
  .mo{padding:0;align-items:flex-end}
  .mbox,.mbox.sm,.mbox.md,.mbox.lg{max-width:none;width:100%;max-height:94dvh;border-radius:18px 18px 0 0;padding-bottom:env(safe-area-inset-bottom)}
  .mh{position:sticky;top:0;z-index:2;background:var(--bg2)}
  .faction{position:sticky;bottom:0;z-index:2;background:var(--bg2);padding-bottom:calc(12px + env(safe-area-inset-bottom));flex-wrap:wrap}
  .faction .btn{flex:1;justify-content:center}
  .pos-layout{grid-template-columns:1fr}
  body.pos-fullscreen #content{overflow:auto}
  body.pos-fullscreen #page-caisse{height:auto;min-height:calc(100dvh - 20px)}
  body.pos-fullscreen #page-caisse>.pos-layout{grid-template-columns:1fr}
  body.pos-fullscreen .pos-panel{height:auto}
  .pos-cart-panel{position:relative;top:auto}
  .pos-catalogue-head{align-items:flex-start}
  .pos-tools{width:100%;flex-wrap:wrap}
  .pos-tools .fselect,.pos-search-wrap{width:100%}
  #caisse-articles{max-height:52dvh!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;padding:10px!important}
  #caisse-panier{max-height:38dvh!important}
  .doc-viewer{padding:8px 4px}
  .doc-sheet{transform-origin:top center}
  .ltable{display:block;max-width:100%;overflow-x:auto;white-space:nowrap;-webkit-overflow-scrolling:touch}
}

@media(max-width:640px){
  .k4,.k3,.pipeline{grid-template-columns:1fr}
  .kgrid{gap:8px;margin-bottom:12px}
  .kcard{padding:12px}
  .kval{font-size:20px}
  .tw{overflow:visible;padding:8px}
  .tw table.mobile-cards,.tw table.mobile-cards tbody,.tw table.mobile-cards tr,.tw table.mobile-cards td{display:block;width:100%}
  .tw table.mobile-cards thead{display:none}
  .tw table.mobile-cards tr{background:var(--bg2);border:1px solid var(--border2);border-left:3px solid var(--accent);border-radius:10px;padding:8px 10px;margin-bottom:9px;box-shadow:0 6px 18px rgba(0,0,0,.08)}
  .tw table.mobile-cards td{border:none;padding:7px 0;text-align:right;display:flex;justify-content:space-between;gap:14px;align-items:flex-start;white-space:normal;overflow-wrap:anywhere}
  .tw table.mobile-cards td::before{content:attr(data-label);font-size:10px;text-transform:uppercase;letter-spacing:.04em;color:var(--text3);font-weight:700;text-align:left;flex:0 0 38%}
  .tw table.mobile-cards td[colspan]{display:block;text-align:center}
  .tw table.mobile-cards td[colspan]::before{display:none}
  .tw table.mobile-cards td:last-child:empty{display:none}
  .tw table.mobile-cards .btn{min-height:34px;padding:6px 9px}
  .mode-filter-bar{overflow-x:auto;flex-wrap:nowrap!important}
  .mode-filter-bar .btn,.mode-filter-btn{white-space:nowrap}
  .login-box{width:calc(100% - 24px);padding:24px 18px;border-radius:16px}
  #caisse-articles{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  .pos-product{min-height:175px}
  .pos-product-visual{height:66px}
  .pos-product-body{padding:15px 9px 9px}
  .pos-product-price{font-size:13px}
  .pos-product-footer{align-items:flex-start;flex-direction:column}
  .pos-cart-content{padding:10px}
  #table-summary{padding:8px 12px!important}
  #date-filters{grid-template-columns:auto minmax(0,1fr)}
  #date-filters .btn{grid-column:1 / -1;justify-content:center}
  #filter-result-count{grid-column:1 / -1;text-align:center;min-width:0}
  #filter-date-from,#filter-date-to{width:100%;min-height:40px;font-size:14px}
}

@media(max-width:390px){
  #btn-new #btn-label{display:none}
  #btn-new{width:38px;padding:8px;justify-content:center}
  #page-title{min-width:95px;font-size:13px}
}

@media(orientation:landscape) and (max-height:520px){
  #sidebar{width:min(72vw,320px)}
  .mbox,.mbox.sm,.mbox.md,.mbox.lg{max-height:100dvh;border-radius:0}
  #caisse-articles{max-height:55dvh!important}
}

/* ══════════════════════════════════════
   VIEWER & IMPRESSION
══════════════════════════════════════ */
.doc-viewer{
  position:fixed;inset:0;
  background:rgba(0,0,0,.85);
  z-index:99998 !important;display:none;
  align-items:flex-start;justify-content:center;
  padding:24px 16px;overflow-y:auto;
}
.doc-viewer.open{display:flex}

/* Boutons actions */
.doc-actions{
  position:sticky;top:0;
  background:var(--bg2);
  border-radius:10px;
  padding:10px 16px;
  margin-bottom:14px;
  display:flex;gap:8px;align-items:center;
  z-index:10;
  border:1px solid var(--border2);
  width:210mm;
  box-sizing:border-box;
}
.doc-actions span{font-size:13px;font-weight:600;flex:1;color:var(--text1)}

/* Feuille A4 */
.doc-sheet{
  background:#ffffff !important;
  color:#1a1a1a !important;
  color-scheme:light !important;
  /* Redéfinir toutes les variables CSS pour forcer le mode clair */
  --bg:#ffffff;
  --bg2:#ffffff;
  --bg3:#f7f9ff;
  --bg4:var(--doc-accent-light,#f0f4ff);
  --border:rgba(0,0,0,0.08);
  --border2:rgba(0,0,0,0.15);
  --text1:#1a1a1a;
  --text2:#333333;
  --text3:#666666;
  --accent:var(--doc-accent,#1a3fa8);
  --accent2:#2563eb;
  --accent-g:rgba(26,63,168,.10);
  --green:#16a34a;
  --green-bg:rgba(22,163,74,.10);
  --red:#dc2626;
  --red-bg:rgba(220,38,38,.10);
  --amber:#d97706;
  --amber-bg:rgba(217,119,6,.10);
  --teal:#0d9488;
  --teal-bg:rgba(13,148,136,.10);
  --blue:#2563eb;
  --blue-bg:rgba(37,99,235,.10);
  --purple:#7c3aed;
  --purple-bg:rgba(124,58,237,.10);
  max-width:210mm;width:100%;
  min-height:297mm;
  height:297mm;
  box-shadow:0 8px 40px rgba(0,0,0,.35);
  border-radius:3px;
  font-family:'Inter',Arial,sans-serif;
  font-size:11px;
  display:flex;
  flex-direction:column;
  position:relative;
  overflow:visible;
  border-top:3px solid var(--doc-accent,#1a3fa8);
  -webkit-print-color-adjust:exact !important;
  print-color-adjust:exact !important;
}

.rec-print-doc{padding:18mm 14mm;background:#fff;color:#111;min-height:297mm;font-family:Arial,sans-serif}
.rec-print-head{display:flex;justify-content:space-between;gap:16px;border-bottom:3px solid #1a3fa8;padding-bottom:10px;margin-bottom:14px}
.rec-print-head h2{margin:0;color:#1a3fa8;font-size:24px;text-transform:uppercase;letter-spacing:.02em}
.rec-print-head p{margin:4px 0 0;color:#64748b;font-size:12px}
.rec-print-date{text-align:right;font-size:11px;color:#64748b}
.rec-kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:12px 0 16px}
.rec-kpi{border-radius:10px;background:#eef4ff;border:1px solid #dbe6ff;padding:10px}
.rec-kpi span{display:block;font-size:9px;text-transform:uppercase;color:#475569;font-weight:700;margin-bottom:5px}
.rec-kpi strong{display:block;color:#1a3fa8;font-size:15px}
.rec-print-doc h3{margin:18px 0 8px;color:#0f172a;font-size:14px}
.rec-print-table{width:100%;border-collapse:collapse;font-size:10px;margin-bottom:14px}
.rec-print-table th{background:#1a3fa8;color:#fff;text-align:left;padding:7px;border:1px solid #1a3fa8}
.rec-print-table td{padding:7px;border:1px solid #d8dee9;vertical-align:top}
.rec-print-table tbody tr:nth-child(even){background:#f7f9fd}
.rec-print-table tr,.rec-kpi,.rec-print-head{break-inside:avoid;page-break-inside:avoid}
.rec-print-table thead{display:table-header-group}
.doc-page-number{font-size:9px;color:#64748b;text-align:right;margin:2px 0 3px;font-weight:700}
.rec-print-paged{padding:0!important;background:#f1f5f9}
.rec-report-page{width:210mm;min-height:297mm;margin:0 auto 12px;padding:12mm 12mm 18mm;background:#fff;color:#111;box-sizing:border-box;position:relative;page-break-after:always;break-after:page}
.rec-report-page:last-child{page-break-after:auto;break-after:auto}
.rec-print-doc,.rec-report-page{overflow:hidden}
.rec-print-table{table-layout:fixed}
.rec-print-table th,.rec-print-table td{white-space:normal;word-break:normal;overflow-wrap:anywhere;max-width:0}

/* Export PDF direct */
.smartb-pdf-export{background:#fff;color:#111;-webkit-print-color-adjust:exact;print-color-adjust:exact}
body.smartb-pdf-generating .smartb-pdf-export{box-shadow:none!important;clip-path:none!important;background:#fff!important}
.smartb-pdf-export *{box-sizing:border-box}
.smartb-pdf-export .pdf-export-sheet{box-shadow:none!important;border-radius:0!important}
.smartb-pdf-export .doc-actions,.smartb-pdf-export .doc-viewer{display:none!important}
.smartb-pdf-export .doc-table,.smartb-pdf-export .rec-print-table{width:100%!important}
.smartb-pdf-export .doc-table th,.smartb-pdf-export .doc-table td,
.smartb-pdf-export .rec-print-table th,.smartb-pdf-export .rec-print-table td{overflow-wrap:anywhere!important;word-break:normal!important}
.smartb-pdf-landscape .batch-list-report{width:297mm!important;min-height:210mm!important;padding:8mm 7mm!important;overflow:hidden!important}
.smartb-pdf-landscape .batch-list-head{margin-bottom:8px!important;padding-bottom:8px!important}
.smartb-pdf-landscape .batch-list-head h1{font-size:18px!important}
.smartb-pdf-landscape .batch-list-summary{grid-template-columns:repeat(auto-fit,minmax(95px,1fr))!important;gap:5px!important;margin:8px 0!important}
.smartb-pdf-landscape .batch-list-kpi{padding:6px!important}
.smartb-pdf-landscape .batch-list-currency-summary{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))!important;gap:5px!important;margin-bottom:7px!important}
.smartb-pdf-landscape .doc-table{table-layout:fixed!important}
.smartb-pdf-landscape .doc-table th,.smartb-pdf-landscape .doc-table td{font-size:7.2px!important;padding:3px 4px!important;line-height:1.2!important;white-space:normal!important}
.smartb-pdf-landscape .doc-table th.tr,.smartb-pdf-landscape .doc-table td.tr{white-space:nowrap!important;text-align:right!important}
.smartb-pdf-portrait .rec-print-doc{width:210mm!important;max-width:210mm!important;padding:0!important;overflow:hidden!important}
.smartb-pdf-portrait .rec-report-page{width:210mm!important;max-width:210mm!important;margin:0!important;padding:12mm 10mm 16mm!important;overflow:hidden!important}
.smartb-pdf-portrait .rec-print-table{table-layout:fixed!important;font-size:9px!important}
.smartb-pdf-portrait .rec-print-table th,.smartb-pdf-portrait .rec-print-table td{padding:5px!important;font-size:8.5px!important;line-height:1.25!important}
.rec-page-footer{position:absolute;left:12mm;right:12mm;bottom:7mm;text-align:right;border-top:1px solid #d8dee9;padding-top:4px;font-size:10px;color:#64748b;font-weight:700}

/* ─── EN-TÊTE ─── */
.doc-header{
  padding:14px 18px 10px;
  border-bottom:none;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  background:#fff;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
.doc-logo-zone{display:flex;align-items:center;gap:14px;flex-shrink:0;max-width:55%}
.doc-logo-img{width:80px;height:80px;object-fit:contain;display:block}
.doc-company{font-size:10px;color:#444;line-height:1.75;max-width:200px}
.doc-company strong{font-size:13px;font-weight:800;color:var(--doc-accent,#1a3fa8);display:block;margin-bottom:2px}
.doc-title-zone{text-align:right;flex-shrink:0}
.doc-type{font-size:22px;font-weight:900;color:var(--doc-accent,#1a3fa8);text-transform:uppercase;letter-spacing:2px;line-height:1}
.doc-number{font-size:14px;font-weight:700;color:#e53935;margin-top:5px}
.doc-date{font-size:10px;color:#666;margin-top:3px;line-height:1.6}
.doc-status{display:inline-block;margin-top:5px;padding:3px 12px;border-radius:20px;font-size:9px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.doc-status.payee,.doc-status.livre,.doc-status.receptionne{background:#dcfce7;color:#166534}
.doc-status.envoyee,.doc-status.envoye,.doc-status.confirme{background:#dbeafe;color:#1e40af}
.doc-status.brouillon{background:#f1f5f9;color:#475569}
.doc-status.retard,.doc-status.annulee,.doc-status.annule{background:#fee2e2;color:#991b1b}
.doc-status.partielle,.doc-status.en_attente{background:#fef3c7;color:#92400e}
.doc-status.accepte,.doc-status.transforme{background:#d1fae5;color:#065f46}

/* ─── META CLIENT / INFO ─── */
.doc-meta{
  padding:10px 18px;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  
}
.doc-client-box{
  background:var(--doc-accent-light,#f0f4ff);
  border-left:4px solid var(--doc-accent,#1a3fa8);
  border-radius:0 6px 6px 0;
  padding:9px 12px;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
.doc-client-box *,
.doc-info-box *{background:transparent!important}
.doc-client-box h4{
  font-size:8px;font-weight:800;color:var(--doc-accent,#1a3fa8);
  text-transform:uppercase;letter-spacing:.12em;
  margin-bottom:5px;
}
.doc-client-box p{font-size:11px;line-height:1.8;color:#222;margin:0}
.doc-info-box{
  display:flex;flex-direction:column;
  justify-content:center;gap:4px;
  text-align:right;
}
.doc-info-row{display:flex;justify-content:flex-end;gap:6px;font-size:10px;line-height:1.6}
.doc-info-row span:first-child{color:#888}
.doc-info-row span:last-child{font-weight:700;color:#111}

/* ─── CORPS / LIGNES ─── */
.doc-body{padding:10px 18px 6px;flex:0 0 auto}
.doc-table{
  width:100%;
  border-collapse:collapse;
  margin-bottom:10px;
  table-layout:fixed;
}
.doc-table col.c-des{width:38%}
.doc-table col.c-qte{width:8%}
.doc-table col.c-unit{width:8%}
.doc-table col.c-pu{width:12%}
.doc-table col.c-rem{width:8%}
.doc-table col.c-tva{width:8%}
.doc-table col.c-ht{width:9%}
.doc-table col.c-ttc{width:9%}
.doc-table thead tr{
  background:var(--doc-accent,#1a3fa8);
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
.doc-table thead th{
  padding:7px 8px;
  font-size:9px;font-weight:700;
  color:#fff;
  text-align:left;
  text-transform:uppercase;
  letter-spacing:.06em;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
.doc-table thead th.tr{text-align:right}
.doc-table tbody tr:nth-child(even){
  background:#f7f9ff;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
.doc-table tbody td{
  padding:5px 8px;
  font-size:10.5px;
  color:#222;
  border-bottom:1px solid #eee;
  vertical-align:top;
  word-break:break-word;
}
.doc-table tbody td.tr{text-align:right}
.doc-table tbody td.num{font-weight:700;color:#111}
.doc-table tfoot td{
  padding:7px 8px;
  font-size:10px;
  font-weight:600;
  color:#555;
  background:var(--doc-accent-light,#f0f4ff);
  border-top:2px solid var(--doc-accent,#1a3fa8);
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
.doc-table tfoot td.tr{text-align:right;font-weight:800;color:var(--doc-accent,#1a3fa8)}

/* ─── TOTAUX ─── */
.doc-totaux{
  display:flex;
  justify-content:flex-end;
  padding:0 18px;
  margin-bottom:10px;
}
.doc-totaux-box{
  width:260px;
  border:1px solid #dce3f0;
  border-radius:8px;
  overflow:hidden;
  box-shadow:0 2px 8px rgba(26,63,168,.08);
}
.doc-total-row{
  display:flex;justify-content:space-between;
  padding:6px 14px;
  font-size:11px;
  border-bottom:1px solid #eee;
}
.doc-total-row > span,
.doc-total-row strong,
.doc-total-row b{
  background:transparent!important;
  background-color:transparent!important;
  box-shadow:none!important;
  color:inherit!important;
}
.doc-total-row:last-child{
  border-bottom:none;
  background:var(--doc-accent,#1a3fa8);
  color:#fff;
  font-size:13px;font-weight:800;
  padding:9px 14px;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
.doc-total-row.tva{
  background:#f5f7ff;color:#555;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
.doc-total-row.remise{
  background:#fff8f0;color:#92400e;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
.doc-total-row.paye{
  background:#dcfce7;color:#166534;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
.doc-total-row.solde{
  background:#fee2e2;color:#991b1b;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}

/* ─── PRIX EN LETTRES ─── */
.doc-lettres-box{
  margin:0 20px 12px;
  padding:9px 14px;
  background:#f8f9ff;
  border:1px solid #e0e4f0;
  border-radius:6px;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
.doc-lettres-label{
  font-size:8.5px;color:#888;
  text-transform:uppercase;letter-spacing:.07em;
  margin-bottom:3px;
}
.doc-lettres-text{
  font-size:11.5px;font-weight:700;
  color:var(--doc-accent,#1a3fa8);font-style:italic;
}

/* ─── PAIEMENTS ─── */
.doc-paiements{padding:0 18px 8px}
.doc-paiements h4{
  font-size:8.5px;font-weight:800;color:var(--doc-accent,#1a3fa8);
  text-transform:uppercase;letter-spacing:.1em;
  margin-bottom:6px;
}
.doc-paiements table{width:100%;border-collapse:collapse;font-size:10px}
.doc-paiements th{
  background:#f1f5f9;padding:5px 9px;
  font-size:9px;color:#475569;text-align:left;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
.doc-paiements td{padding:5px 9px;border-bottom:1px solid #f1f5f9}

/* ─── NOTES ─── */
.doc-notes{padding:0 18px 8px}
.doc-notes h4{
  font-size:8.5px;font-weight:700;color:#888;
  text-transform:uppercase;letter-spacing:.08em;
  margin-bottom:4px;
}
.doc-notes p{font-size:10.5px;color:#555;line-height:1.7;margin:0}

/* ─── FILIGRANE AVOIR ─── */
.doc-watermark{
  position:absolute;top:50%;left:50%;
  transform:translate(-50%,-50%) rotate(-30deg);
  font-size:80px;font-weight:900;
  color:rgba(229,57,53,0.05);
  pointer-events:none;text-transform:uppercase;
  white-space:nowrap;user-select:none;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}

/* ─── FOOTER ─── */
.doc-footer{
  border-top:2px solid var(--doc-accent,#1a3fa8);
  padding:7px 18px;
  margin-top:auto;
  text-align:center;
  font-size:9px;
  color:#555;
  line-height:1.6;
  background:#fff;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
.doc-footer-line{
  display:block;
  word-wrap:break-word;
}



/* ─── STAMP (désactivé) ─── */
.doc-stamp,.doc-stamp-box{display:none}

/* ══════════════════════════════════════
   ISOLATION TOTALE DU DOCUMENT
   Le document est TOUJOURS blanc,
   peu importe le thème de l'app
══════════════════════════════════════ */
.doc-sheet,
.doc-sheet *,
[data-theme="light"] .doc-sheet,
[data-theme="light"] .doc-sheet *,
[data-theme="dark"] .doc-sheet,
[data-theme="dark"] .doc-sheet * {
  font-family: 'Inter', Arial, sans-serif !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

/* Fond blanc forcé sur la feuille */
.doc-sheet {
  background: #ffffff !important;
  color: #1a1a1a !important;
}

/* Tous les textes du document en couleurs fixes */
.doc-sheet .doc-company,
.doc-sheet .doc-client-box p,
.doc-sheet .doc-info-row,
.doc-sheet .doc-table tbody td,
.doc-sheet .doc-notes p,
.doc-sheet .doc-footer-left,
.doc-sheet .doc-footer-right,
.doc-sheet .doc-paiements td {
  color: #333333 !important;
  background: transparent !important;
}

/* Titres et accents bleus fixes */
.doc-sheet .doc-company strong,
.doc-sheet .doc-type,
.doc-sheet .doc-client-box h4,
.doc-sheet .doc-lettres-text {
  color: var(--doc-accent,#1a3fa8) !important;
}

/* Numéro rouge */
.doc-sheet .doc-number { color: #e53935 !important; }

/* Dates et labels gris */
.doc-sheet .doc-date,
.doc-sheet .doc-info-row span:first-child,
.doc-sheet .doc-lettres-label,
.doc-sheet .doc-notes h4,
.doc-sheet .doc-paiements h4 { color: #666666 !important; }

/* En-tête bleu */
.doc-sheet .doc-header {
  background: #ffffff !important;
  border-bottom:none !important;
}

/* Bandeau client */
.doc-sheet .doc-client-box {
  background: var(--doc-accent-light,#f0f4ff) !important;
  border-left: 4px solid var(--doc-accent,#1a3fa8) !important;
}

/* Tableau - en-tête bleu */
.doc-sheet .doc-table thead tr { background: var(--doc-accent,#1a3fa8) !important; }
.doc-sheet .doc-table thead th { color: #ffffff !important; background: var(--doc-accent,#1a3fa8) !important; }
.doc-sheet .doc-table tbody tr:nth-child(even) { background: #f7f9ff !important; }
.doc-sheet .doc-table tbody tr { background: #ffffff !important; }
.doc-sheet .doc-table tbody tr:nth-child(even) { background: #f7f9ff !important; }
.doc-sheet .doc-table tbody td { color: #222222 !important; border-bottom: 1px solid #eeeeee !important; }
.doc-sheet .doc-table tbody td.num { color: #111111 !important; font-weight: 700 !important; }
.doc-sheet .doc-table tfoot td { background: var(--doc-accent-light,#f0f4ff) !important; border-top: 2px solid var(--doc-accent,#1a3fa8) !important; }
.doc-sheet .doc-table tfoot td.tr { color: var(--doc-accent,#1a3fa8) !important; }

/* Totaux */
.doc-sheet .doc-totaux-box { border: 1px solid #dce3f0 !important; background: #ffffff !important; }
.doc-sheet .doc-total-row { background: #ffffff !important; color: #333333 !important; border-bottom: 1px solid #eeeeee !important; }
.doc-sheet .doc-total-row:last-child { background: var(--doc-accent,#1a3fa8) !important; color: #ffffff !important; }
.doc-sheet .doc-total-row.tva { background: #f5f7ff !important; color: #555555 !important; }
.doc-sheet .doc-total-row.remise { background: #fff8f0 !important; color: #92400e !important; }
.doc-sheet .doc-total-row.paye { background: #dcfce7 !important; color: #166534 !important; }
.doc-sheet .doc-total-row.solde { background: #fee2e2 !important; color: #991b1b !important; }
.doc-sheet .doc-total-row > span,
.doc-sheet .doc-total-row strong,
.doc-sheet .doc-total-row b {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  color: inherit !important;
}

/* Prix en lettres */
.doc-sheet .doc-lettres-box {
  background: #f8f9ff !important;
  border: 1px solid #e0e4f0 !important;
}

/* Footer */
.doc-sheet .doc-footer {
  background: var(--doc-accent-light,#f0f4ff) !important;
  border-top: 2px solid var(--doc-accent,#1a3fa8) !important;
}
.doc-sheet .doc-footer-left,
.doc-sheet .doc-footer-right { color: #555555 !important; }

/* Badges statut */
.doc-sheet .doc-status.payee,
.doc-sheet .doc-status.livre,
.doc-sheet .doc-status.receptionne { background: #dcfce7 !important; color: #166534 !important; }
.doc-sheet .doc-status.envoyee,
.doc-sheet .doc-status.envoye,
.doc-sheet .doc-status.confirme { background: #dbeafe !important; color: #1e40af !important; }
.doc-sheet .doc-status.brouillon { background: #f1f5f9 !important; color: #475569 !important; }
.doc-sheet .doc-status.retard,
.doc-sheet .doc-status.annulee,
.doc-sheet .doc-status.annule { background: #fee2e2 !important; color: #991b1b !important; }
.doc-sheet .doc-status.partielle,
.doc-sheet .doc-status.en_attente { background: #fef3c7 !important; color: #92400e !important; }
.doc-sheet .doc-status.accepte,
.doc-sheet .doc-status.transforme { background: #d1fae5 !important; color: #065f46 !important; }

/* Paiements table */
.doc-sheet .doc-paiements th { background: #f1f5f9 !important; color: #475569 !important; }
.doc-sheet .doc-paiements td { border-bottom: 1px solid #f1f5f9 !important; color: #333 !important; }

/* Meta section */
.doc-sheet .doc-meta { border-bottom: none !important; background: #ffffff !important; }

@media print{
  @page{
    margin:0;
    size:A4 portrait;
  }
  @page batchLandscape{
    margin:10mm;
    size:A4 landscape;
  }

  html, body{
    margin:0!important;
    padding:0!important;
    width:auto!important;
    min-height:auto!important;
    background:#fff!important;
  }

  /* Masquer toute l'interface, ne montrer que le document */
  body *{visibility:hidden!important}
  #doc-sheet, #doc-sheet *{visibility:visible!important}

  /* Fond blanc partout (supprime l'overlay noir du viewer) */
  html, body, #app, .doc-viewer, .doc-viewer *, .main, .content, .page{
    background:#fff!important;
    background-color:#fff!important;
  }

  /* Le viewer : conteneur neutre, en flux normal */
  .doc-viewer{
    position:static!important; display:block!important;
    inset:auto!important; padding:0!important; margin:0!important;
    width:auto!important; height:auto!important; min-height:0!important;
    background:#fff!important;
  }

  /* LE DOCUMENT : occupe la zone imprimable, sans déborder, en flux normal */
  #doc-sheet{
    position:static!important;
    display:flex!important;
    flex-direction:column!important;
    width:210mm!important;
    max-width:210mm!important;
    min-width:210mm!important;
    height:297mm!important;
    min-height:297mm!important;
    margin:0!important;
    padding:10mm 10mm 8mm!important;
    border-top:3px solid var(--doc-accent,#1a3fa8)!important;
    box-shadow:none!important;
    border-radius:0!important;
    background:#fff!important;
    overflow:visible!important;
    box-sizing:border-box!important;
    -webkit-print-color-adjust:exact!important;
    print-color-adjust:exact!important;
  }
  /* Tout le contenu reste dans la largeur */
  #doc-sheet *{ max-width:100%!important; box-sizing:border-box!important; }
  #doc-sheet.batch-sheet{
    width:277mm!important;
    max-width:277mm!important;
    min-width:277mm!important;
    min-height:190mm!important;
    page:batchLandscape;
  }

  /* Tableau : pleine largeur, pas de débordement */
  .doc-table{ width:100%!important; table-layout:auto!important; }
  .doc-table th, .doc-table td{ word-break:break-word!important; overflow-wrap:anywhere!important; }

  /* Barre d'outils masquée */
  .doc-actions{ display:none!important; visibility:hidden!important; }

  /* Couleurs forcées (fonds colorés) */
  .doc-header{ border-bottom:none!important; background:#fff!important; }
  .dh{ flex-shrink:0!important; }
  .dh-logo-img2,
  .dh .doc-logo-img2{
    max-width:78px!important;
    max-height:42px!important;
    width:auto!important;
    height:auto!important;
    margin:0!important;
    object-fit:contain!important;
  }
  .dh-left:has(.doc-logo-img2){
    flex-direction:row!important;
    align-items:center!important;
    gap:10px!important;
  }
  .dh-soc-nom{ font-size:15px!important; line-height:1.15!important; }
  .dh-soc-info{ font-size:8.5px!important; line-height:1.35!important; margin-top:2px!important; }
  .dh-grand-titre{ font-size:24px!important; line-height:1!important; }
  .dh-moderne .dh-topbar{
    height:4px!important;
    display:block!important;
    background:var(--doc-accent,#1a3fa8)!important;
    margin:-10mm -10mm 8mm!important;
  }
  .dh-moderne .dh-mod-head{ padding:10px 18px 9px!important; align-items:center!important; }
  .dh-classique .dh-band,
  .dh-corporate .dh-band-gris,
  .dh-premium .dh-prem-band{ padding:12px 18px!important; }
  .dh-tech .dh-tech-top,
  .dh-confiance .dh-conf-top,
  .dh-energie .dh-en-top,
  .dh-geo-top{ padding:4px 18px 8px!important; }
  .doc-meta{ padding-top:8px!important; padding-bottom:8px!important; }
  .doc-body{ padding-top:8px!important; padding-bottom:4px!important; }
  .doc-table{ margin-bottom:8px!important; }
  .doc-table thead th{ padding:5px 7px!important; font-size:8px!important; }
  .doc-table tbody td{ padding:4px 7px!important; font-size:9.5px!important; }
  .doc-totaux{ margin-bottom:8px!important; }
  .doc-footer-line{ font-size:8.2px!important; line-height:1.35!important; }
  .doc-table thead tr{ background:var(--doc-accent,#1a3fa8)!important; }
  .doc-table thead th{ color:#fff!important; }
  .doc-table tbody tr:nth-child(even){ background:#f7f9ff!important; }
  .doc-table tbody td{ border-bottom:1px solid #eee!important; }
  .doc-total-row:last-child{ background:var(--doc-accent,#1a3fa8)!important; color:#fff!important; }
  .doc-total-row.tva{ background:#f5f7ff!important; }
  .doc-client-box{ background:var(--doc-accent-light,#f0f4ff)!important; border-left:4px solid var(--doc-accent,#1a3fa8)!important; }
  .doc-footer{ background:var(--doc-accent-light,#f0f4ff)!important; border-top:2px solid var(--doc-accent,#1a3fa8)!important; margin-top:auto!important; position:static!important; flex-shrink:0!important; padding:4px 8px!important; min-height:9mm!important; }
  #doc-sheet > .doc-footer{ margin-top:auto!important; }
  .doc-lettres-box{ background:#f8f9ff!important; border:1px solid #e0e4f0!important; }
  .doc-client-box *,
  .doc-info-box *,
  .doc-lettres-box *,
  .dh-meta-tbl *,
  .dh-meta-client *{ background:transparent!important; }

  /* Annuler les traits hérités sur le bloc N°/Date/Échéance */
  .dh-meta-tbl td{ border-bottom:none!important; border-top:none!important; }

  /* Sauts de page propres */
  .doc-header,
  .dh,
  .dh-band,
  .dh-band-gris,
  .dh-mod-head,
  .dh-prem-band,
  .dh-mn-top,
  .dh-tech-top,
  .dh-conf-top,
  .dh-sig-top{
    page-break-inside:avoid!important;
    break-inside:avoid!important;
    overflow:visible!important;
  }
  .doc-meta{ page-break-inside:avoid; }
  .doc-totaux{ page-break-inside:avoid; }
  .doc-table tr{ page-break-inside:avoid; }
  .batch-document-page{
    width:277mm!important;
    min-height:190mm!important;
    page:batchLandscape;
    page-break-after:always!important;
    break-after:page!important;
  }
  .batch-document-page:last-child{
    page-break-after:auto!important;
    break-after:auto!important;
  }
}

/* ─── MODAL CONFIRMATION ─── */
.confirm-overlay{position:fixed;inset:0;background:rgba(0,0,0,.65);z-index:9999;display:none;align-items:center;justify-content:center}
.confirm-overlay.open{display:flex!important}
.confirm-box{background:var(--bg2);border:1px solid var(--border2);border-radius:14px;padding:28px 24px;width:360px;max-width:90vw;text-align:center;box-shadow:0 20px 60px rgba(0,0,0,.5)}
.confirm-icon{width:52px;height:52px;border-radius:50%;margin:0 auto 16px;display:flex;align-items:center;justify-content:center}
.confirm-title{font-size:16px;font-weight:700;color:var(--text1);margin-bottom:8px}
.confirm-msg{font-size:12px;color:var(--text2);line-height:1.6;margin-bottom:20px}
.confirm-actions{display:flex;gap:8px;justify-content:center}
.btn-danger{background:#e53935!important;color:#fff!important;border:none!important;padding:8px 20px;border-radius:7px;cursor:pointer;font-size:13px;font-weight:600}
.btn-danger:hover{background:#c62828!important}

.tab-content{display:none;width:100%}

/* ── Cartes statistiques de filtre ── */
#table-summary{padding:0!important;margin:-4px 0 14px!important;background:transparent!important;border:none!important}
.stat-cards-row{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
  gap:12px;
  width:100%;
  align-items:stretch;
  justify-content:center;
}
.stat-card{
  display:flex;flex-direction:column;justify-content:center;
  border-radius:12px;
  padding:12px 18px;
  min-width:0;
  width:100%;
  box-shadow:0 3px 10px rgba(0,0,0,0.12);
  transition:transform .15s,box-shadow .15s;
  color:#fff;
}
.stat-card:hover{transform:translateY(-2px);box-shadow:0 8px 20px rgba(0,0,0,0.2)}
.stat-card-label{
  font-size:11px;font-weight:600;
  color:rgba(255,255,255,0.85);
  text-transform:uppercase;letter-spacing:.05em;margin-bottom:4px;
}
.stat-card-value{
  font-size:20px;font-weight:800;line-height:1.1;
  color:#fff;
  white-space:nowrap;
}
@media(max-width:768px){
  .stat-cards-row{grid-template-columns:repeat(auto-fit,minmax(125px,1fr));gap:8px}
  .stat-card{padding:10px 12px}
  .stat-card-value{font-size:15px}
}
@media(max-width:420px){
  .stat-cards-row{grid-template-columns:1fr 1fr}
}

/* ── Dropdown recherche article dans les lignes ── */
.article-dropdown{
  position:absolute;top:100%;left:0;right:0;z-index:200;
  background:var(--bg2);border:1px solid var(--border);border-radius:8px;
  max-height:260px;overflow-y:auto;
  box-shadow:0 8px 20px rgba(0,0,0,0.2);margin-top:2px;
  min-width:280px;
}
.article-dropdown-item{
  padding:8px 12px;cursor:pointer;font-size:13px;
  border-bottom:1px solid var(--border);
}
.article-dropdown-item:hover{background:var(--accent-g)}
.article-dropdown-new{
  padding:10px 12px;cursor:pointer;font-size:13px;font-weight:600;
  color:var(--accent2);background:var(--accent-g);
  text-align:center;position:sticky;bottom:0;
  border-top:2px solid var(--accent2);
}
.article-dropdown-new:hover{background:var(--accent2);color:#fff}

/* ── Menu d'actions déroulant ── */
.action-menu-wrap{position:relative;display:inline-block}
.action-menu-btn{
  background:transparent;border:1px solid var(--border);
  border-radius:8px;width:34px;height:30px;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  color:var(--text2);transition:all .15s;
}
.action-menu-btn:hover{background:var(--accent-g);color:var(--accent2);border-color:var(--accent2)}
.action-menu-dropdown{
  position:absolute;right:0;top:100%;z-index:500;
  background:var(--bg2);border:1px solid var(--border);
  border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,0.18);
  min-width:180px;padding:6px;margin-top:4px;
  display:none;
}
.action-menu-dropdown.open{display:block;animation:menuFade .12s ease}
@keyframes menuFade{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
.action-menu-item{
  display:flex;align-items:center;gap:10px;width:100%;
  padding:9px 12px;border:none;background:transparent;
  border-radius:7px;cursor:pointer;font-size:13px;
  text-align:left;transition:background .12s;
  font-family:inherit;
}
.action-menu-item:hover{background:var(--accent-g)}
.action-menu-item svg{flex-shrink:0;opacity:.8}

/* ── Filtres par mode de paiement ── */
.mode-filter-btn{
  padding:6px 14px;border:1px solid var(--border);
  background:var(--bg2);color:var(--text2);
  border-radius:20px;cursor:pointer;font-size:12px;font-weight:600;
  transition:all .15s;font-family:inherit;
}
.mode-filter-btn:hover{border-color:var(--accent2);color:var(--accent2)}
.mode-filter-btn.active{
  background:var(--accent2);color:#fff;border-color:var(--accent2);
}
.commercial-mode .commercial-assignment-field{display:none!important}
.commercial-mode input[readonly].linput{background:rgba(148,163,184,.12);cursor:not-allowed}

/* ═══ OPTIMISATION AFFICHAGE TABLEAUX (densité + largeur) ═══ */
/* Cible uniquement les tableaux de données dans .tw, pas l'impression */
.tw table{
  min-width:0;            /* supprime la largeur mini de 480px */
  width:100%;
  table-layout:auto;
}
.tw thead th{
  padding:7px 8px;        /* padding réduit pour gagner de la place */
  font-size:10px;
  white-space:nowrap;     /* les titres restent sur une ligne */
}
.tw tbody td{
  padding:6px 8px;        /* padding réduit pour densifier */
  font-size:11.5px;
  vertical-align:middle;
  white-space:nowrap;     /* montants, dates, statuts restent lisibles sur une ligne */
}
/* Les colonnes de texte long peuvent revenir à la ligne au lieu d'élargir */
.tw tbody td.wrap, .tw thead th.wrap{
  white-space:normal;
  overflow-wrap:anywhere;
}
/* La colonne Actions reste compacte */
.tw td:last-child{
  white-space:nowrap;
  width:1%;               /* prend le minimum de place */
}
/* Sur grands écrans, colonnes plus confortables et mieux réparties */
@media (min-width:1200px){
  .tw thead th{padding:11px 16px;font-size:11px}
  .tw tbody td{padding:11px 16px;font-size:13px}
}
@media (min-width:1600px){
  .tw thead th{padding:13px 20px;font-size:11.5px}
  .tw tbody td{padding:13px 20px;font-size:13.5px}
}
/* La table remplit toujours toute la largeur disponible */
.tw table{width:100% !important}
/* Le scroll horizontal reste disponible en filet de sécurité pour les très larges tableaux */
.tw{overflow-x:auto;-webkit-overflow-scrolling:touch}

/* Indice visuel de défilement horizontal sur les tableaux qui débordent */
.tw{position:relative}
.tw::after{
  content:'';
  position:sticky;
  top:0; right:0;
  float:right;
  width:24px; height:100%;
  pointer-events:none;
  background:linear-gradient(to right, transparent, var(--bg2));
  opacity:0; transition:opacity .2s;
}
.tw.has-scroll::after{opacity:1}

/* La colonne nom (Client/Fournisseur) absorbe l'espace libre sur grand écran */
#tbl-devis tbody td:nth-child(3),
#tbl-devis thead th:nth-child(3),
#tbl-commandes tbody td:nth-child(3),
#tbl-commandes thead th:nth-child(3),
#tbl-bls tbody td:nth-child(3),
#tbl-bls thead th:nth-child(3),
#tbl-factures tbody td:nth-child(4),
#tbl-factures thead th:nth-child(4),
#tbl-achats tbody td:nth-child(3),
#tbl-achats thead th:nth-child(3),
#tbl-clients tbody td:nth-child(2),
#tbl-clients thead th:nth-child(2),
#tbl-fournisseurs tbody td:nth-child(2),
#tbl-fournisseurs thead th:nth-child(2){
  width:auto;
  min-width:200px;
  white-space:normal;       /* le nom long peut revenir à la ligne */
  overflow-wrap:anywhere;
}

/* ═══ MENU D'ACTIONS — ancré au bouton, jamais coupé, reste dans le tableau ═══ */
.action-menu-dropdown{
  position:absolute;
  top:calc(100% + 4px);
  right:0;
  left:auto;
  z-index:1000;
  display:none;
}
.action-menu-dropdown.open{
  display:block;
  box-shadow:0 10px 28px rgba(0,0,0,0.30);
}
/* Ouverture vers le haut quand pas de place en bas (dernières lignes) */
.action-menu-dropdown.open.drop-up{
  top:auto;
  bottom:calc(100% + 4px);
}
/* Quand un menu est ouvert, le conteneur du tableau ne coupe plus le débordement vertical */
.tw.menu-active{
  overflow:visible;
}

/* Quand un menu d'actions est ouvert, le panneau parent ne coupe plus le menu */
.panel.menu-active{
  overflow:visible;
}

/* ═══ Panneaux de rapport pliables ═══ */
.collapsible-head{cursor:pointer;user-select:none;display:flex;align-items:center;justify-content:space-between}
.collapsible-head:hover{background:var(--accent-g)}
.collapse-arrow{transition:transform .25s ease;font-size:12px;color:var(--text3);margin-left:8px}
.collapsible-panel[data-collapsed="true"] .collapse-arrow{transform:rotate(-90deg)}
.collapsible-body{overflow:hidden;transition:max-height .3s ease;max-height:4000px}
.collapsible-panel[data-collapsed="true"] .collapsible-body{max-height:0}

/* ═══ Onglets écran Mouvements stock ═══ */
.stock-tabs{display:flex;align-items:center;gap:4px;border-bottom:2px solid var(--border);margin-bottom:14px;padding:0 4px;flex-wrap:wrap}
.stock-tab-btn{background:none;border:none;padding:10px 16px;cursor:pointer;font-size:13px;font-weight:600;color:var(--text3);border-bottom:2px solid transparent;margin-bottom:-2px;transition:color .15s,border-color .15s;display:flex;align-items:center;gap:6px}
.stock-tab-btn:hover{color:var(--text1)}
.stock-tab-btn.active{color:var(--accent2);border-bottom-color:var(--accent2)}
.stock-tab-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--amber);color:#fff;font-size:11px;font-weight:700}
.stock-tab-badge:empty{display:none}
.stock-tab-pane{width:100%}


/* ═══ Styles additionnels ═══ */
'
    + 'body{font-family:Arial,sans-serif;padding:30px;color:#222;font-size:13px}'
    + '.head{display:flex;justify-content:space-between;align-items:center;border-bottom:3px solid #1a3fa8;padding-bottom:15px;margin-bottom:20px}'
    + '.head img{max-width:220px;max-height:80px}'
    + '.title-zone{text-align:right}'
    + '.title-zone h1{color:#1a3fa8;margin:0;font-size:26px}'
    + '.title-zone .num{color:#e53935;font-weight:700;font-size:16px;margin-top:4px}'
    + '.title-zone .date{color:#666;font-size:12px;margin-top:2px}'
    + 'table{width:100%;border-collapse:collapse;margin-top:15px}'
    + 'th{background:#1a3fa8;color:#fff;padding:9px 8px;text-align:left;font-size:12px}'
    + 'th:nth-child(4),th:nth-child(5),th:nth-child(7){text-align:center}'
    + 'th:nth-child(6),th:nth-child(8){text-align:right}'
    + 'td{padding:7px 8px;border-bottom:1px solid #eee}'
    + 'tr:nth-child(even){background:#f8f9ff}'
    + '.summary{margin-top:20px;padding:14px;background:#f0f4ff;border-radius:8px;display:flex;justify-content:space-around;text-align:center}'
    + '.summary .item .label{font-size:11px;color:#666;text-transform:uppercase}'
    + '.summary .item .value{font-size:20px;font-weight:800;color:#1a3fa8;margin-top:3px}'
    + '.signatures{margin-top:50px;display:flex;justify-content:space-between}'
    + '.signatures .sig{width:40%;text-align:center;border-top:1px solid #999;padding-top:6px;font-size:12px;color:#666}'
    + '@media print{body{padding:15px}}'
    + '

/* ═══════════ MODÈLES DE DOCUMENTS PERSONNALISABLES ═══════════ */
.doc-soc-nom{font-size:18px;font-weight:800;letter-spacing:.3px;line-height:1.1}
.doc-soc-info{font-size:10.5px;color:#777;margin-top:5px;line-height:1.6}
.doc-logo-img2{max-width:200px;max-height:80px;width:auto;height:auto;object-fit:contain;display:block;margin-bottom:8px}
.doc-type-big{font-size:30px;font-weight:800;letter-spacing:1px;line-height:1;color:#2a2a2a!important}
.doc-type-thin{font-size:22px;font-weight:300;letter-spacing:3px}

/* Modèle BANDEAU */
.doc-header-bandeau{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:20px 24px!important;border-bottom:none!important}
.doc-header-bandeau .doc-soc-nom{color:#fff}
.doc-header-bandeau .doc-type{color:#fff!important}
.doc-header-bandeau .doc-number,.doc-header-bandeau .doc-date{color:rgba(255,255,255,.9)}
.doc-bandeau-soc{flex:1}
.doc-title-bandeau{text-align:right}

/* Modèle MODERNE */
.doc-header-moderne{display:block;border-bottom:none!important;padding-bottom:0!important}
.doc-moderne-top{display:flex;gap:14px;align-items:flex-start;margin-bottom:18px}
.doc-moderne-bar{width:4px;min-height:48px;border-radius:2px;flex-shrink:0}
.doc-moderne-meta{display:flex;justify-content:space-between;align-items:flex-end;padding-bottom:16px}
.doc-moderne-dates{text-align:right;font-size:11px;color:#777;line-height:1.7}

/* Modèle MINIMAL */
.doc-header-minimal{display:flex;justify-content:space-between;align-items:flex-start;border-bottom:1px solid #e5e5e5!important;padding-bottom:16px!important}

/* Message personnalisé en pied */
.doc-footer-message{font-size:10px;color:#666;text-align:center;padding:6px 0;font-style:italic;border-bottom:1px solid #eee;margin-bottom:6px}

@media print {
  .doc-header-bandeau{background:var(--doc-accent,#1a3fa8)!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .doc-moderne-bar{background:var(--doc-accent,#1a3fa8)!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
}


/* ═══════════ PAGE PERSONNALISATION DOCUMENTS ═══════════ */
.doc-perso-layout{display:grid;grid-template-columns:340px 1fr;gap:20px;align-items:start}
.doc-perso-controls{position:sticky;top:0}
.dp-section-title{font-size:12px;text-transform:uppercase;letter-spacing:.05em;color:var(--text3);margin:18px 0 10px;font-weight:700}
.dp-section-title:first-child{margin-top:0}
.dp-models{display:flex;flex-direction:column;gap:8px}
.dp-model{display:flex;flex-direction:column;padding:10px 12px;border:1.5px solid var(--border);border-radius:8px;cursor:pointer;transition:all .15s;position:relative}
.dp-model:hover{border-color:var(--accent)}
.dp-model input{position:absolute;opacity:0}
.dp-model input:checked ~ .dp-model-name{color:var(--accent)}
.dp-model:has(input:checked){border-color:var(--accent);background:var(--accent-g)}
.dp-model-name{font-weight:600;font-size:13px}
.dp-model-desc{font-size:11px;color:var(--text3);margin-top:2px}
.dp-colors{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.dp-color{width:30px;height:30px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px var(--border);cursor:pointer;transition:transform .12s}
.dp-color:hover{transform:scale(1.12)}
.dp-color-picker{width:34px;height:34px;padding:0;border:1px dashed var(--border);border-radius:8px;cursor:pointer;background:none}
.dp-check{display:flex;align-items:center;gap:9px;padding:7px 0;font-size:13px;cursor:pointer}
.dp-check input{width:16px;height:16px;cursor:pointer}
.dp-preview-label{font-size:12px;text-transform:uppercase;letter-spacing:.05em;color:var(--text3);margin-bottom:10px;font-weight:700}
.dp-preview-frame{background:#e8e8ec;border-radius:10px;padding:24px;overflow:auto;max-height:calc(100vh - 160px)}
.dp-preview-frame .doc-sheet{margin:0 auto;background:#fff;box-shadow:0 2px 12px rgba(0,0,0,.12);color:#1a1a1a;color-scheme:light;transform-origin:top center}
.dp-saved-box{border:1px solid var(--border);background:var(--bg3);border-radius:10px;padding:12px;margin-bottom:14px}
.dp-model-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:10px 0}
.dp-model-actions .btn{justify-content:center}
@media(max-width:900px){.doc-perso-layout{grid-template-columns:1fr}.doc-perso-controls{position:static}}


/* ═══════════ STYLES DU NUMÉRO DE DOCUMENT ═══════════ */
/* Tailles */
.doc-num-discret{font-size:11px;opacity:.85}
.doc-num-normal{font-size:14px;font-weight:600}
.doc-num-grand{font-size:20px;font-weight:800}
/* Cadres */
.doc-num-cadre-fin{display:inline-block;border:1px solid #ccc;border-radius:4px;padding:3px 10px;margin:2px 0}
.doc-num-cadre-colore{display:inline-block;border:1.5px solid var(--doc-accent,#1a3fa8);color:var(--doc-accent,#1a3fa8);border-radius:4px;padding:3px 10px;margin:2px 0}
.doc-num-cadre-fond{display:inline-block;background:var(--doc-accent,#1a3fa8);color:#fff!important;border-radius:4px;padding:4px 12px;margin:2px 0;-webkit-print-color-adjust:exact;print-color-adjust:exact}

/* Positions prédéfinies du bloc numéro dans la zone titre */
.doc-sheet[data-num-position="haut-gauche"] .doc-title-zone{text-align:left}
.doc-sheet[data-num-position="centre"] .doc-title-zone{text-align:center}
.doc-sheet[data-num-position="sous-titre"] .doc-number{margin-top:8px;display:block}

/* Mode LIBRE : le numéro est positionné en absolu dans l'en-tête */
.doc-sheet[data-num-mode="libre"] .doc-header{position:relative}
.doc-sheet[data-num-mode="libre"] .doc-number{
  position:absolute;
  left:var(--num-x,70%);
  top:var(--num-y,10%);
  z-index:5;
  cursor:move;
}


/* ═══════════ RIB & CONDITIONS GÉNÉRALES ═══════════ */
.doc-cg-bloc{margin:14px 0 8px;padding:10px 14px;background:var(--doc-accent-light,#f6f8fc);border-radius:6px;font-size:9px;color:#555;line-height:1.5}
.doc-cg-titre{font-weight:700;font-size:9px;text-transform:uppercase;letter-spacing:.04em;color:var(--doc-accent,#1a3fa8);margin-bottom:4px}
.doc-cg-texte{font-size:9px;color:#666}
.doc-rib-bloc{font-size:10px;color:#444;padding:6px 0;text-align:center}
.doc-rib-label{color:var(--doc-accent,#1a3fa8);font-weight:600}


/* ═══════════ CONTRÔLES SUPPLÉMENTAIRES PERSONNALISATION ═══════════ */
.dp-preview-bar{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.dp-num-mode{display:flex;flex-direction:column;gap:6px;margin-bottom:10px}
.dp-radio-inline{display:flex;align-items:center;gap:8px;font-size:13px;cursor:pointer}
.dp-mini-label{display:block;font-size:11px;color:var(--text3);margin:8px 0 3px;font-weight:600}
.dp-hint{font-size:11px;color:var(--text3);background:var(--accent-g);padding:8px 10px;border-radius:6px;line-height:1.4}
.dp-color-none{display:flex;align-items:center;justify-content:center;background:#fff;color:#999;font-size:12px}
#dp-police{margin-bottom:4px}


/* ═══════════ TITRE/NUMÉRO EN FACE DU CLIENT ═══════════ */





.doc-header-logo-seul{justify-content:flex-start}
.doc-header-logo-seul .doc-logo-zone{text-align:left}


/* ═══════════════════════════════════════════════════════
   12 MODÈLES DE DOCUMENTS — couleur via --dh-accent
   ═══════════════════════════════════════════════════════ */
.dh{font-family:inherit}
.dh-soc{display:block}
.dh-soc-nom{font-size:18px;font-weight:800;letter-spacing:.3px;color:#1a1a1a}
.dh-soc-info{font-size:10px;color:#777;line-height:1.6;margin-top:4px}
.dh-logo-img2,.dh .doc-logo-img2{max-width:160px;max-height:64px;object-fit:contain;display:block;margin-bottom:6px}
.dh-left:has(.doc-logo-img2){
  flex-direction:row;
  align-items:center;
  gap:12px;
}
.dh-left:has(.doc-logo-img2) .doc-logo-img2{
  flex:0 0 auto;
  margin-bottom:0;
}
.dh-logo-carre{width:54px;height:54px;border-radius:10px;background:var(--dh-accent,#1a3fa8);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:20px;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.dh-grand-titre{font-size:30px;font-weight:800;letter-spacing:1.5px;color:var(--dh-accent,#1a3fa8);text-transform:uppercase;text-align:right;line-height:1}
.dh-meta{margin-top:8px;min-width:180px}
.dh-meta-type{display:none}
.dh-meta-tbl{font-size:11px;color:#444;width:100%;border-collapse:collapse}
.dh-meta-tbl td{padding:2px 0}
.dh-meta-tbl td:first-child{color:#999;padding-right:14px}
.dh-meta-tbl td:last-child{text-align:right;font-weight:700;color:#222}
.dh-left{display:flex;flex-direction:column;gap:2px}

/* 01 CLASSIQUE */
.dh-classique .dh-band{background:var(--dh-accent-light,#f0f4ff);padding:24px 26px;display:flex;justify-content:space-between;align-items:flex-start;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.dh-classique .dh-right{text-align:right}

/* 02 MINIMALISTE NOIR */
.dh-minimal-noir{padding:22px 4px 0}
.dh-minimal-noir .dh-mn-top{display:flex;justify-content:space-between;align-items:flex-start;padding-bottom:16px;border-bottom:2px solid #1a1a1a}
.dh-minimal-noir .dh-mn-titre{font-size:26px;font-weight:800;letter-spacing:3px;color:#1a1a1a;text-transform:uppercase;margin-top:14px}

/* 03 CORPORATE GRIS */
.dh-corporate .dh-band-gris{background:#f3f4f6;border-left:4px solid var(--dh-accent,#64748b);padding:22px 26px;display:flex;justify-content:space-between;align-items:flex-start;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.dh-corporate .dh-right{text-align:right}

/* 04 MODERNE TURQUOISE */
.dh-moderne .dh-topbar{height:8px;background:var(--dh-accent,#14b8a6);-webkit-print-color-adjust:exact;print-color-adjust:exact}
.dh-moderne .dh-mod-head{display:flex;justify-content:space-between;align-items:center;padding:20px 24px}
.dh-moderne .dh-mod-head .dh-left{flex-direction:row;align-items:center;gap:14px}
.dh-mod-num{font-size:13px;font-weight:600;color:#666;margin-top:4px}

/* 05 SIDEBAR BLEU NUIT — layout en colonne géré au niveau du document */
.dh-sidebar{padding:24px;display:flex;justify-content:space-between;align-items:flex-start}
.dh-side-titre{font-size:34px}

/* 06 PREMIUM OR */
.dh-premium .dh-prem-band{background:#1a1a1a;padding:24px 26px;display:flex;justify-content:space-between;align-items:flex-start;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.dh-premium .dh-prem-titre{font-size:30px;font-weight:800;letter-spacing:1.5px;color:var(--dh-accent,#c9a227);text-transform:uppercase;text-align:right}
.dh-prem-sub{font-size:9px;letter-spacing:3px;color:#bbb;font-weight:400;margin-top:3px}
.dh-premium .dh-prem-meta{display:flex;justify-content:flex-end;padding:14px 26px 0}

/* 07 TECH VIOLET */
.dh-tech .dh-tech-top{display:flex;justify-content:space-between;align-items:flex-start;padding:6px 4px 14px}
.dh-tech-badge{background:var(--dh-accent,#7c3aed);color:#fff;font-size:9px;font-weight:700;letter-spacing:1px;padding:5px 12px;border-radius:4px;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.dh-tech .dh-tech-titre{display:flex;justify-content:space-between;align-items:flex-end;border-top:3px solid var(--dh-accent,#7c3aed);padding-top:12px}

/* 08 ÉNERGIE ORANGE */
.dh-energie .dh-en-top{display:flex;justify-content:space-between;align-items:flex-start;padding:6px 4px 10px}
.dh-energie .dh-en-titre{font-size:32px;font-weight:800;color:var(--dh-accent,#ea580c);text-transform:uppercase;letter-spacing:1px;border-bottom:4px solid var(--dh-accent,#ea580c);padding-bottom:8px;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.dh-energie .dh-en-meta{display:flex;justify-content:flex-end;padding-top:10px}

/* 09 VERT CONFIANCE */
.dh-confiance .dh-conf-top{display:flex;justify-content:space-between;align-items:flex-start;padding:6px 4px 14px}
.dh-conf-badge{background:var(--dh-accent,#16a34a);color:#fff;font-size:9px;font-weight:700;letter-spacing:.5px;padding:5px 12px;border-radius:20px;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.dh-confiance .dh-conf-titre{display:flex;justify-content:space-between;align-items:flex-end;border-top:2px solid var(--dh-accent,#16a34a);padding-top:12px}

/* 10 COMPACT PRO */
.dh-compact .dh-comp-row{display:flex;justify-content:space-between;align-items:center;background:var(--dh-accent-light,#f0f4ff);padding:14px 20px;border-radius:6px;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.dh-comp-titre{text-align:right;font-size:20px;font-weight:800;color:var(--dh-accent,#1a3fa8);text-transform:uppercase}
.dh-comp-num{font-size:11px;font-weight:400;color:#666;margin-top:2px}

/* 11 GÉOMÉTRIQUE ROUGE */
.dh-geo{position:relative;overflow:hidden;padding-top:6px}
.dh-geo-corner{position:absolute;top:0;right:0;width:120px;height:120px;background:var(--dh-accent,#dc2626);clip-path:polygon(100% 0,0 0,100% 100%);opacity:.12;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.dh-geo-top{display:flex;justify-content:space-between;align-items:flex-start;padding:6px 4px 14px;position:relative}
.dh-geo .dh-grand-titre{color:var(--dh-accent,#dc2626)}
.dh-geo-meta{display:flex;justify-content:flex-end;border-top:3px solid var(--dh-accent,#dc2626);padding-top:10px}

/* 12 SIGNATURE SMART BUSINESS */
.dh-signature .dh-sig-top{display:flex;justify-content:space-between;align-items:center;padding:8px 4px 16px;border-bottom:3px double var(--dh-accent,#1a3fa8)}
.dh-signature .dh-sig-top .dh-left{flex-direction:row;align-items:center;gap:14px}
.dh-sig-sub{font-size:9px;letter-spacing:3px;color:#999;font-weight:400;margin-top:3px;text-align:right}
.dh-signature .dh-sig-meta{display:flex;justify-content:flex-end;padding-top:12px}

/* Impression : forcer les couleurs de fond */
@media print {
  .dh-classique .dh-band,.dh-corporate .dh-band-gris,.dh-moderne .dh-topbar,
  .dh-premium .dh-prem-band,.dh-tech-badge,.dh-conf-badge,.dh-compact .dh-comp-row,
  .dh-geo-corner,.dh-logo-carre,.dh-energie .dh-en-titre{
    -webkit-print-color-adjust:exact!important;print-color-adjust:exact!important;
  }
}


/* Grille des 12 modèles dans la personnalisation */
.dp-models-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px}
.dp-models-grid .dp-model{padding:8px 10px}
.dp-models-grid .dp-model-name{font-size:12px}
.dp-models-grid .dp-model-desc{font-size:10px}


/* ═══ Titre/numéro en face du client (option) — propre, sans traits ═══ */
.dh-meta-client{text-align:right}
.dh-meta-titre-client{font-size:22px;font-weight:800;text-transform:uppercase;letter-spacing:1px;color:var(--doc-accent,#1a3fa8);margin-bottom:8px}
.dh-meta-client .dh-meta-tbl{margin-left:auto;width:auto}
.dh-meta-client .dh-meta-tbl td{padding:2px 0;font-size:11px}
.dh-meta-client .dh-meta-tbl td:first-child{color:#999;padding-right:16px;text-align:left}
.dh-meta-client .dh-meta-tbl td:last-child{text-align:right;font-weight:700;color:#222}


/* ═══ Annuler les traits hérités sur les tableaux N°/Date/Échéance ═══ */
.doc-sheet .dh-meta-tbl td,
.doc-sheet .dh-meta-client .dh-meta-tbl td,
.dh-meta-tbl td,
.dh-meta-tbl tbody td {
  border-bottom: none !important;
  border-top: none !important;
}


/* ═══ Resserrer le bloc N°/Date/Échéance (libellé + valeur rapprochés) ═══ */
.dh-meta{
  display:inline-block!important;
  width:auto!important;
  min-width:0!important;
  max-width:max-content!important;
  margin-left:auto;
}
.dh-meta-tbl{
  display:inline-table!important;
  width:auto!important;
  min-width:0!important;
  max-width:max-content!important;
  margin-left:auto!important;
  table-layout:auto!important;
  border-collapse:collapse!important;
}
.dh-meta-tbl td{
  width:auto!important;
  max-width:none!important;
  padding-top:2px!important;
  padding-bottom:2px!important;
}
.dh-meta-tbl td:first-child{
  padding-right:8px!important;
  white-space:nowrap!important;
  text-align:left!important;
}
.dh-meta-tbl td:first-child:after{
  content:" :";
}
.dh-meta-tbl td:last-child{
  white-space:nowrap!important;
  text-align:left!important;
  font-weight:800!important;
}
.doc-info-box .dh-meta-client{
  display:inline-block!important;
  width:auto!important;
  max-width:max-content!important;
  text-align:left!important;
  margin-left:auto!important;
}

/* Mode matricielle / sans cadre : impression économique noir et blanc */
.doc-sheet[data-matricielle="1"],
.doc-sheet[data-matricielle="1"] *{
  color:#000!important;
  background:transparent!important;
  box-shadow:none!important;
  text-shadow:none!important;
  -webkit-print-color-adjust:economy!important;
  print-color-adjust:economy!important;
}
.doc-sheet[data-matricielle="1"]{
  border-radius:0!important;
  font-family:"Courier New", Courier, monospace!important;
}
.doc-sheet[data-matricielle="1"][data-matricielle-fond-blanc="1"]{
  background:#fff!important;
  background-color:#fff!important;
}
.doc-sheet[data-matricielle="1"] .dh-band,
.doc-sheet[data-matricielle="1"] .dh-band-gris,
.doc-sheet[data-matricielle="1"] .dh-prem-band,
.doc-sheet[data-matricielle="1"] .dh-comp-row,
.doc-sheet[data-matricielle="1"] .doc-client-box,
.doc-sheet[data-matricielle="1"] .doc-lettres-box,
.doc-sheet[data-matricielle="1"] .doc-totaux-box,
.doc-sheet[data-matricielle="1"] .doc-footer{
  border:none!important;
  border-radius:0!important;
}
.doc-sheet[data-matricielle="1"] .doc-table thead tr,
.doc-sheet[data-matricielle="1"] .doc-table thead th{
  background:transparent!important;
  color:#000!important;
}
.doc-sheet[data-matricielle="1"] .doc-table{
  border-top:1px solid #000!important;
}
.doc-sheet[data-matricielle="1"] .doc-table th,
.doc-sheet[data-matricielle="1"] .doc-table td{
  border-bottom:1px solid #999!important;
}
.doc-sheet[data-matricielle="1"] .doc-total-row{
  border-bottom:1px solid #999!important;
}
.doc-sheet[data-matricielle="1"] .doc-logo-img2,
.doc-sheet[data-matricielle="1"] .doc-logo-img{
  filter:grayscale(1)!important;
}

/* Correctif impression v10 : l'impression doit refléter la visionneuse.
   On neutralise les anciennes règles print trop agressives qui compactaient
   le logo, forçaient la pleine page et changeaient la mise en page. */
@page{
  size:A4 portrait;
  margin:10mm;
}
@media print{
  html,body{
    margin:0!important;
    padding:0!important;
    background:#fff!important;
  }
  body *{visibility:hidden!important}
  #doc-sheet,#doc-sheet *{visibility:visible!important}
  .doc-viewer{
    position:static!important;
    display:block!important;
    inset:auto!important;
    width:auto!important;
    height:auto!important;
    min-height:0!important;
    padding:0!important;
    margin:0!important;
    background:#fff!important;
  }
  .doc-actions{
    display:none!important;
    visibility:hidden!important;
  }
  #doc-sheet{
    position:static!important;
    display:flex!important;
    flex-direction:column!important;
    width:190mm!important;
    max-width:190mm!important;
    min-width:190mm!important;
    height:277mm!important;
    min-height:277mm!important;
    padding:0!important;
    margin:0!important;
    border-top:3px solid var(--doc-accent,#1a3fa8)!important;
    border-radius:0!important;
    box-shadow:none!important;
    overflow:hidden!important;
    background:#fff!important;
    box-sizing:border-box!important;
    -webkit-print-color-adjust:exact!important;
    print-color-adjust:exact!important;
  }
  #doc-sheet *{
    box-sizing:border-box!important;
  }
  .dh-logo-img2,
  .dh .doc-logo-img2{
    max-width:160px!important;
    max-height:64px!important;
    width:auto!important;
    height:auto!important;
    object-fit:contain!important;
    display:block!important;
    margin-bottom:6px!important;
  }
  .dh-left:has(.doc-logo-img2){
    flex-direction:row!important;
    align-items:center!important;
    gap:12px!important;
  }
  .dh-soc-nom{
    font-size:18px!important;
    line-height:1.2!important;
  }
  .dh-soc-info{
    font-size:10px!important;
    line-height:1.45!important;
    margin-top:4px!important;
  }
  .dh-grand-titre{
    font-size:30px!important;
    line-height:1!important;
  }
  .dh-moderne .dh-topbar{
    height:8px!important;
    margin:0!important;
    display:block!important;
    background:var(--doc-accent,#1a3fa8)!important;
  }
  .dh-moderne .dh-mod-head{
    padding:20px 24px!important;
    align-items:center!important;
  }
  .dh-classique .dh-band{
    padding:24px 26px!important;
  }
  .dh-corporate .dh-band-gris,
  .dh-premium .dh-prem-band{
    padding:22px 26px!important;
  }
  .doc-meta{
    padding:10px 18px!important;
  }
  .doc-body{
    padding:10px 18px 6px!important;
    flex:0 0 auto!important;
  }
  .doc-table{
    width:100%!important;
    margin-bottom:10px!important;
    table-layout:fixed!important;
  }
  .doc-table thead th{
    padding:7px 8px!important;
    font-size:9px!important;
  }
  .doc-table tbody td{
    padding:5px 8px!important;
    font-size:10.5px!important;
  }
  .doc-totaux{
    margin-bottom:10px!important;
  }
  .doc-footer{
    margin-top:auto!important;
    flex-shrink:0!important;
    position:static!important;
    padding:7px 18px!important;
    min-height:auto!important;
    background:var(--doc-accent-light,#f0f4ff)!important;
    border-top:2px solid var(--doc-accent,#1a3fa8)!important;
  }
  .doc-footer-line{
    font-size:8.5px!important;
    line-height:1.45!important;
  }
  .doc-currency-summary{
    width:330px!important;
    margin:6px 18px 10px auto!important;
    padding:8px 10px!important;
    box-shadow:none!important;
    border-color:#cfe0ff!important;
    background:#f8fbff!important;
  }
  .doc-currency-title{
    font-size:8px!important;
    margin-bottom:6px!important;
  }
  .doc-currency-grid{
    gap:6px!important;
  }
  .doc-currency-grid div{
    padding:5px 6px!important;
  }
  .doc-currency-grid span{
    font-size:7px!important;
  }
  .doc-currency-grid strong{
    font-size:9px!important;
  }
}

/* Correctif final V55 : priorité maximale pour les états paysage */
.doc-sheet.batch-sheet{
  width:297mm!important;
  min-width:297mm!important;
  max-width:297mm!important;
  height:auto!important;
  min-height:210mm!important;
  overflow:visible!important;
  display:block!important;
}
.doc-sheet.batch-sheet .batch-list-report{
  width:297mm!important;
  max-width:297mm!important;
  min-height:210mm!important;
  box-sizing:border-box!important;
}
.doc-viewer:has(.doc-sheet.batch-sheet){
  justify-content:flex-start!important;
  align-items:flex-start!important;
  padding-left:24px!important;
  padding-right:24px!important;
}
.doc-viewer:has(.doc-sheet.batch-sheet) .doc-actions{
  width:297mm!important;
  min-width:297mm!important;
  max-width:297mm!important;
}
.batch-list-report.batch-list-purchases{
  padding:10mm 9mm!important;
}
.batch-list-report.batch-list-purchases .batch-list-head{
  margin-bottom:10px!important;
  padding-bottom:10px!important;
}
.batch-list-report.batch-list-purchases .batch-list-head h1{
  font-size:20px!important;
}
.batch-list-report.batch-list-purchases .doc-table{
  width:100%!important;
  max-width:100%!important;
  table-layout:fixed!important;
}
.batch-list-report.batch-list-purchases .doc-table th,
.batch-list-report.batch-list-purchases .doc-table td{
  white-space:normal!important;
  overflow-wrap:anywhere!important;
  word-break:normal!important;
  font-size:9.4px!important;
  line-height:1.32!important;
}
.smartb-pdf-landscape .pdf-export-sheet,
.smartb-pdf-landscape .doc-sheet.batch-sheet{
  width:297mm!important;
  min-width:297mm!important;
  max-width:297mm!important;
  height:auto!important;
  min-height:210mm!important;
}

/* Correctif final V56 : ne jamais couper les états PDF paysage */
.smartb-pdf-landscape,
.smartb-pdf-landscape .pdf-export-sheet,
.smartb-pdf-landscape .doc-sheet.batch-sheet,
.smartb-pdf-landscape .batch-list-report,
.smartb-pdf-landscape .batch-list-report.batch-list-purchases{
  height:auto!important;
  max-height:none!important;
  overflow:visible!important;
}
.smartb-pdf-landscape .batch-list-report tr{
  break-inside:avoid!important;
  page-break-inside:avoid!important;
}
.smartb-pdf-landscape .batch-list-report thead{
  display:table-header-group!important;
}
@media(max-width:900px){
  .cashflow-grid{grid-template-columns:1fr!important}
}

/* V92 — Paramètres : hiérarchie claire, navigation stable et responsive */
#page-parametres{max-width:1480px;margin:0 auto;padding-bottom:40px}
.params-hero{
  position:relative;display:flex;align-items:center;gap:16px;overflow:hidden;
  margin-bottom:16px;padding:22px 24px;border:1px solid rgba(73,112,255,.25);
  border-radius:16px;background:linear-gradient(135deg,rgba(31,65,170,.20),rgba(46,164,180,.09));
  box-shadow:0 10px 30px rgba(3,12,35,.12)
}
.params-hero:after{content:"";position:absolute;right:-70px;top:-90px;width:230px;height:230px;border-radius:50%;background:radial-gradient(circle,rgba(77,137,255,.20),transparent 68%);pointer-events:none}
.params-hero-icon{width:52px;height:52px;flex:0 0 52px;display:flex;align-items:center;justify-content:center;border-radius:14px;color:#fff;background:linear-gradient(135deg,var(--accent2),#18a6b8);box-shadow:0 8px 22px rgba(40,102,220,.28)}
.params-hero-icon svg{width:27px;height:27px;fill:none;stroke:currentColor;stroke-width:1.7}
.params-hero h2{margin:2px 0 5px;font-size:21px;color:var(--text1);letter-spacing:-.02em}
.params-hero p{margin:0;color:var(--text2);font-size:12px;line-height:1.55}
.params-eyebrow{font-size:9px;text-transform:uppercase;letter-spacing:.16em;font-weight:800;color:var(--accent2)}
.params-hero-badge{position:relative;z-index:1;margin-left:auto;display:flex;align-items:center;gap:7px;white-space:nowrap;padding:7px 11px;border:1px solid rgba(34,197,94,.26);border-radius:999px;background:rgba(34,197,94,.09);color:var(--green);font-size:10px;font-weight:700}
.params-hero-badge span{width:7px;height:7px;border-radius:50%;background:var(--green);box-shadow:0 0 0 4px rgba(34,197,94,.12)}
.params-layout{display:flex;gap:14px;flex-wrap:wrap;align-items:flex-start}
.params-tabs{width:100%;display:flex;gap:8px;padding:7px;border:1px solid var(--border);border-radius:13px;background:var(--bg2);box-shadow:0 5px 18px rgba(2,10,30,.08);position:sticky;top:8px;z-index:20}
.params-tabs .tab-btn{flex:1;min-height:42px;display:flex;align-items:center;justify-content:center;gap:8px;border:1px solid transparent;border-radius:9px;background:transparent;color:var(--text2);font-size:12px;font-weight:700;cursor:pointer;transition:.18s ease}
.params-tabs .tab-btn:hover{color:var(--text1);background:var(--bg3);transform:translateY(-1px)}
.params-tabs .tab-btn.active{color:#fff;border-color:rgba(255,255,255,.12);background:linear-gradient(135deg,var(--accent2),#245bc4);box-shadow:0 6px 16px rgba(35,86,190,.24)}
#page-parametres .tab-content{animation:paramsFade .18s ease}
@keyframes paramsFade{from{opacity:.25;transform:translateY(4px)}to{opacity:1;transform:none}}
#page-parametres .panel{border-radius:14px;border-color:var(--border);box-shadow:0 6px 22px rgba(3,12,35,.07);overflow:hidden}
#page-parametres .panel .ph{min-height:48px;background:linear-gradient(180deg,var(--bg2),var(--bg3));border-bottom:1px solid var(--border)}
#page-parametres .panel .pt{font-size:13px;letter-spacing:.01em}
#page-parametres .form-wrap{padding:18px 20px}
#page-parametres .flabel{margin-bottom:6px;color:var(--text2);font-size:10px;letter-spacing:.025em}
#page-parametres .finput,#page-parametres .fselect,#page-parametres .ftextarea{border-radius:8px;transition:border-color .15s,box-shadow .15s,background .15s}
#page-parametres .finput:focus,#page-parametres .fselect:focus,#page-parametres .ftextarea:focus{border-color:var(--accent2);box-shadow:0 0 0 3px rgba(52,105,220,.12);background:var(--bg2)}
#page-parametres #logo-preview-zone{transition:border-color .18s,transform .18s,box-shadow .18s}
#page-parametres #logo-preview-zone:hover{border-color:var(--accent2)!important;transform:translateY(-2px);box-shadow:0 9px 24px rgba(30,78,175,.12)}
.params-savebar{position:sticky;bottom:10px;z-index:15;display:flex;justify-content:flex-end;margin-top:14px;padding:11px 12px;border:1px solid var(--border);border-radius:12px;background:color-mix(in srgb,var(--bg2) 90%,transparent);backdrop-filter:blur(10px);box-shadow:0 8px 26px rgba(2,10,30,.15)}
.params-savebar .btn{min-width:190px;justify-content:center}
#tab-content-numerotation>.g2 .panel{min-width:0}
#tab-content-numerotation [id^="num-"][id$="-rows"]>div:hover{filter:brightness(1.04)}
@media(max-width:900px){
  .params-hero{align-items:flex-start;padding:18px}.params-hero-badge{display:none}
  .params-tabs{position:static;overflow-x:auto;justify-content:flex-start}
  .params-tabs .tab-btn{flex:0 0 auto;min-width:150px;padding:0 16px}
  #page-parametres .g2{grid-template-columns:1fr!important}
  #page-parametres .form-wrap{padding:15px}
  #tab-content-numerotation .panel>div>div[style*="grid-template-columns"]{display:none!important}
  #tab-content-numerotation [id^="num-"][id$="-rows"]>div{grid-template-columns:1fr 90px!important;gap:8px!important;padding:12px!important}
  #tab-content-numerotation [id^="num-"][id$="-rows"]>div>span:nth-child(4){grid-column:1/-1;padding:3px 0!important}
  #tab-content-numerotation [id^="num-"][id$="-rows"]>div>label{grid-column:1/-1;justify-content:flex-start!important;padding:0!important}
}
@media(max-width:560px){
  .params-hero-icon{width:44px;height:44px;flex-basis:44px}.params-hero h2{font-size:17px}.params-hero p{font-size:11px}
  #page-parametres .fgrid{grid-template-columns:1fr!important}
  .params-savebar{bottom:6px}.params-savebar .btn{width:100%;min-width:0}
}

/* V93 — Paramètres sobres, alignés sur le reste de Smart Business */
#page-parametres{max-width:none;margin:0;padding-bottom:24px}
#page-parametres .params-hero{display:none}
#page-parametres .params-layout{display:block}
#page-parametres .params-tabs{
  position:static;display:flex;justify-content:flex-start;gap:0;width:100%;
  margin:0 0 14px;padding:0;border:0;border-bottom:1px solid var(--border);
  border-radius:0;background:transparent;box-shadow:none;overflow-x:auto
}
#page-parametres .params-tabs .tab-btn{
  flex:0 0 auto;min-width:0;min-height:38px;padding:0 18px;margin:0;
  border:0;border-bottom:2px solid transparent;border-radius:0;
  background:transparent;color:var(--text3);box-shadow:none;
  font-size:12px;font-weight:600;transform:none
}
#page-parametres .params-tabs .tab-btn:hover{color:var(--text1);background:transparent;transform:none}
#page-parametres .params-tabs .tab-btn.active{
  color:var(--accent2);border-bottom-color:var(--accent2);
  background:transparent;box-shadow:none
}
#page-parametres .panel{border-radius:10px;border:1px solid var(--border);box-shadow:none;overflow:hidden}
#page-parametres .panel .ph{min-height:43px;padding-left:16px;background:var(--bg2);border-bottom:1px solid var(--border)}
#page-parametres .panel .pt{font-size:12px;font-weight:700}
#page-parametres .form-wrap{padding:16px}
#page-parametres .flabel{margin-bottom:5px;font-size:10px;color:var(--text2);letter-spacing:0}
#page-parametres .finput,#page-parametres .fselect,#page-parametres .ftextarea{border-radius:6px;box-shadow:none}
#page-parametres .finput:focus,#page-parametres .fselect:focus,#page-parametres .ftextarea:focus{border-color:var(--accent2);box-shadow:0 0 0 2px rgba(52,105,220,.08)}
#page-parametres #logo-preview-zone:hover{transform:none;box-shadow:none;border-color:var(--accent2)!important}
#page-parametres .params-savebar{
  position:static;display:flex;justify-content:flex-end;margin-top:12px;padding:0;
  border:0;border-radius:0;background:transparent;backdrop-filter:none;box-shadow:none
}
#page-parametres .params-savebar .btn{min-width:0}
@media(max-width:700px){
  #page-parametres .params-tabs .tab-btn{padding:0 12px}
  #page-parametres .params-tabs .tab-btn svg{display:none}
  #page-parametres .params-savebar .btn{width:100%}
}
