/* ===== MIS Facture — charte commune du PGI MIS ===== */
@font-face { font-family: "Figtree"; font-weight: 400; font-display: swap; src: url(../fonts/figtree-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 500; font-display: swap; src: url(../fonts/figtree-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 600; font-display: swap; src: url(../fonts/figtree-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 700 900; font-display: swap; src: url(../fonts/figtree-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Bricolage"; font-weight: 700; font-display: swap; src: url(../fonts/bricolage-grotesque-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Bricolage"; font-weight: 800; font-display: swap; src: url(../fonts/bricolage-grotesque-latin-800-normal.woff2) format("woff2"); }

:root {
  --bg: #eef0f4; --surface: #ffffff; --surface-2: #f7f8fa; --line: #dde2ea; --line-2: #eef0f4;
  --text: #111827; --muted: #5b6475; --faint: #8a93a3;
  --navy: #0f172a; --accent: #1d4ed8; --accent-bg: #eef3ff; --accent-bd: #9db4f0;
  --brand: #c2410c; --brand-bg: #fff4ed;   /* MIS Facture : orange brûlé */
  --ok: #15803d; --ok-bg: #e9f8ef; --warn: #b45309; --warn-bg: #fdf3e6; --danger: #b91c1c; --danger-bg: #fdecec;
  --debit: #1d4ed8; --debit-bg: #eaf1ff; --credit: #c2410c; --credit-bg: #fff1e8;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,23,42,.05), 0 2px 10px rgba(15,23,42,.05);
  --display: "Bricolage", "Figtree", system-ui, sans-serif;
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { height: 100%; }
body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.4; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }
.spacer { flex: 1; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.sr { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- barre du haut ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 8px 20px; min-height: 60px; background: var(--navy); color: #e2e8f0; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 18px; white-space: nowrap; }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; font-family: "Figtree"; font-size: 11.5px; letter-spacing: .04em; color: #fff; }
.modules { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: #1e293b; }
.modules a, .modules span { padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: #e2e8f0; text-decoration: none; }
.modules .on { background: var(--brand); color: #fff; font-weight: 700; }
.modules .soon { color: #94a3b8; }
.modules .soon small { font-size: 10.5px; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a { color: #cbd5e1; text-decoration: none; padding: 8px 10px; font-size: 14px; border-radius: 8px; font-weight: 600; position: relative; }
.nav a:hover { background: #1e293b; }
.nav a.active { background: #1e293b; color: #fff; box-shadow: inset 0 -2px 0 var(--brand); }
.nav a .badge { position: absolute; top: -4px; right: -4px; background: #fbbf24; color: #451a03; font-size: 10.5px; font-weight: 800; padding: 0 6px; border-radius: 99px; }
.socsel { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 10px; border-radius: 9px; border: 1px solid #334155; background: #1e293b; color: #f1f5f9; font-weight: 600; font-size: 13.5px; }
.socsel select { background: transparent; border: 0; color: #f1f5f9; font-weight: 600; max-width: 180px; cursor: pointer; }
.socsel select option { color: var(--text); }
.socsel .dot { width: 10px; height: 10px; border-radius: 50%; }
.userbox { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: #e2e8f0; white-space: nowrap; font-weight: 600; }
.btn-ghost-dark { background: transparent; border: 1px solid #334155; color: #cbd5e1; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-weight: 500; }
.btn-ghost-dark:hover { background: #1e293b; }
@media (max-width: 900px) { .topbar { position: static; } .modules { display: none; } }

/* ---------- page ---------- */
.page { max-width: 1360px; margin: 0 auto; padding: 22px 24px 48px; display: flex; flex-direction: column; gap: 18px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.kicker { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
h1.title { font-family: var(--display); font-weight: 800; font-size: 28px; margin: 4px 0 0; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.panel > h2, h2.h { margin: 0 0 12px; font-family: var(--display); font-size: 18px; font-weight: 700; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.grid2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- boutons, champs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; text-decoration: none; color: var(--text); white-space: nowrap; }
.btn:hover { border-color: #c3cad6; background: var(--surface-2); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.brand { background: var(--brand); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(194,65,12,.25); }
.btn.ok { background: var(--ok); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(21,128,61,.25); }
.btn.draft { background: #fbbf24; color: #451a03; border-color: transparent; box-shadow: 0 6px 18px rgba(180,83,9,.2); }
.btn.danger { color: var(--danger); }
.btn.big { min-height: 52px; padding: 0 22px; font-size: 16px; font-weight: 800; border-radius: 12px; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary:hover, .btn.brand:hover, .btn.ok:hover, .btn.draft:hover { filter: brightness(1.06); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .field input, .field select, .field textarea { width: 100%; min-height: 42px; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .cell:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,78,216,.14); }
.readonly-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 42px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line); font-weight: 600; }
.hint { font-size: 12.5px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: #166534; }
.chip.warn { background: var(--warn-bg); color: #92400e; }
.chip.err { background: var(--danger-bg); color: #991b1b; }
.chip.info { background: var(--accent-bg); color: var(--accent); }
.jbadge { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; padding: 3px 8px; border-radius: 8px; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .03em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tog { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.tog input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- tableaux ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--surface-2); }
.tbl tr.sub td { background: #f7f8fc; font-weight: 700; font-size: 13px; }
.tbl tr.total td { background: var(--navy); color: #fff; font-weight: 700; }
.tbl tr.group td { padding-top: 16px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); border-bottom: 0; }
.tbl .acc { font-weight: 700; font-variant-numeric: tabular-nums; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- tableau de bord ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.kpi .k { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.kpi .k i { width: 10px; height: 10px; border-radius: 3px; }
.kpi .v { font-family: var(--display); font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .n { font-size: 12.5px; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 210px; border-bottom: 1px solid var(--line); padding-top: 10px; }
.bars .m { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; height: 100%; justify-content: flex-end; }
.bars .pair { display: flex; align-items: flex-end; gap: 3px; height: 100%; }
.bars .b { width: 12px; border-radius: 4px 4px 0 0; min-height: 1px; }
.bars .lab { font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--text); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.todo li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.todo .cnt { min-width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 17px; }

/* ---------- saisie ---------- */
.steps { list-style: none; margin: 0; padding: 14px 18px; display: flex; flex-wrap: wrap; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.steps li { display: flex; align-items: center; gap: 10px; flex: 1 1 170px; font-weight: 600; color: var(--muted); font-size: 14px; }
.steps li b { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #e6e9f2; color: var(--text); flex-shrink: 0; }
.steps li.cur { color: var(--text); }
.steps li.cur b { background: var(--accent); color: #fff; }
.steps li.done { color: var(--text); }
.steps li.done b { background: var(--ok); color: #fff; }
.jtiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.jtile { --c: #475569; display: flex; align-items: center; gap: 14px; min-height: 80px; padding: 12px 14px; border-radius: 16px; border: 2px solid color-mix(in srgb, var(--c) 18%, #fff); background: color-mix(in srgb, var(--c) 9%, #fff); text-align: left; cursor: pointer; }
.jtile .code { width: 54px; height: 54px; border-radius: 14px; background: var(--c); color: #fff; display: grid; place-items: center; font-family: var(--display); font-size: 20px; font-weight: 800; flex-shrink: 0; letter-spacing: .02em; }
.jtile .t { display: flex; flex-direction: column; gap: 2px; }
.jtile .t b { font-size: 16px; }
.jtile .t span { font-size: 12.5px; color: var(--text); }
.jtile:hover { border-color: var(--c); }
.jtile.on { background: var(--c); border-color: var(--c); color: #fff; }
.jtile.on .code { background: var(--surface); color: var(--c); }
.jtile.on .t span { color: #fff; }
.docgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.docgrid .wide { grid-column: span 2; }
@media (max-width: 600px) { .docgrid .wide { grid-column: auto; } }

.lines { min-width: 940px; }
.lhead, .lrow { display: grid; grid-template-columns: 170px minmax(0, 1.4fr) minmax(0, 1fr) 150px 150px 40px; gap: 10px; align-items: center; padding: 8px 16px; }
.lhead { background: var(--surface-2); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lhead .num { text-align: right; }
.lrow { border-bottom: 1px solid var(--line-2); }
.lrow.auto { background: var(--surface-2); }
.band { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); }
.band b { font-family: var(--display); font-size: 15px; letter-spacing: .05em; }
.band span { font-size: 13px; color: var(--text); }
.band.d { background: var(--debit-bg); } .band.d b { color: var(--debit); }
.band.c { background: var(--credit-bg); } .band.c b { color: var(--credit); }
.cell { width: 100%; min-height: 40px; padding: 6px 10px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--surface); }
.cell.acc { font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.cell.amt { text-align: right; font-weight: 700; font-size: 15.5px; font-variant-numeric: tabular-nums; }
.cell.amt.computed { background: var(--accent-bg); border-color: var(--accent-bd); color: #1e3a8a; }
.accname { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.accname b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.accname small { font-size: 12px; color: var(--accent); font-weight: 600; }
.accname.unknown b { color: var(--danger); }
.accname.vague b { color: var(--muted); font-weight: 500; }
.autoamt { display: flex; align-items: center; justify-content: flex-end; min-height: 40px; padding: 0 10px; border-radius: 9px; background: var(--accent-bg); border: 1px dashed var(--accent-bd); font-weight: 700; font-size: 15.5px; color: #1e3a8a; font-variant-numeric: tabular-nums; }
.autotag { display: inline-flex; margin-left: 8px; font-size: 10.5px; font-weight: 800; color: var(--accent); background: #dbe5ff; padding: 1px 7px; border-radius: 99px; vertical-align: 1px; }
.lockacc { display: flex; align-items: center; gap: 8px; padding: 0 10px; font-weight: 800; color: #1e3a8a; }
.rm { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.rm:hover { color: var(--danger); border-color: #f5b5b5; }
.addl { margin: 8px 16px 10px; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 11px; border: 2px dashed currentColor; background: var(--surface); font-weight: 700; cursor: pointer; }
.addl.d { color: var(--debit); } .addl.c { color: var(--credit); }
.totbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 20px; background: var(--navy); color: #fff; }
.totbar .t { display: flex; flex-wrap: wrap; gap: 26px; font-size: 14px; font-variant-numeric: tabular-nums; }
.totbar strong { font-size: 18px; margin-left: 6px; }
.eq { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 800; }
.eq.ok { background: #34d399; color: #052e1f; }
.eq.ko { background: #fca5a5; color: #450a0a; }
.actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.kbd { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
kbd { font-family: inherit; font-size: 12px; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; }

/* liste de suggestions de comptes */
.ac-box { position: fixed; z-index: 60; width: 380px; max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 36px rgba(15,23,42,.18); padding: 6px; }
.ac-box .opt { display: flex; gap: 10px; align-items: baseline; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.ac-box .opt b { min-width: 86px; font-variant-numeric: tabular-nums; }
.ac-box .opt small { margin-left: auto; color: var(--accent); font-weight: 700; font-size: 11.5px; }
.ac-box .opt.sel, .ac-box .opt:hover { background: var(--accent-bg); }
.ac-box .new { color: var(--brand); font-weight: 700; }
.ac-box .foot { padding: 7px 10px 4px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line-2); margin-top: 4px; }

/* ---------- onglets ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs button, .tabs a { min-height: 40px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--text); display: inline-flex; align-items: center; }
.tabs .on { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 700; }
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.filters .field { flex: 1 1 150px; }

/* ---------- fenêtre modale ---------- */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(15,23,42,.5); }
dialog form, dialog .dlg { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
dialog h2 { margin: 0; font-family: var(--display); font-size: 20px; }
dialog .btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ---------- divers ---------- */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #0f172a; color: #f1f5f9; padding: 11px 15px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.3); font-size: 14px; max-width: 440px; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.alert.warn { background: var(--warn-bg); color: #92400e; border: 1px solid #f3d3a5; }
.alert.err { background: var(--danger-bg); color: #991b1b; border: 1px solid #f5b5b5; }
.alert.ok { background: var(--ok-bg); color: #166534; border: 1px solid #a7e3c0; }
.hero { border-radius: var(--radius); padding: 22px; background: #1e3a8a; color: #fff; display: flex; flex-direction: column; gap: 8px; }
.hero .big { font-family: var(--display); font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.hero span { color: #dbe5ff; font-size: 14px; }
.ca3 td.ln { width: 60px; }
.ca3 td.ln span { display: inline-flex; min-width: 38px; justify-content: center; padding: 3px 6px; border-radius: 8px; background: var(--navy); color: #fff; font-size: 13px; font-weight: 800; }
.copy.ghost { visibility: hidden; }
.copy { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--accent); cursor: pointer; display: inline-grid; place-items: center; margin-left: 8px; vertical-align: middle; }
.lines-detail { background: var(--surface-2); }
.lines-detail td { font-size: 13px; padding: 6px 10px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% 0%, #1e3a8a 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, #9a3412 0%, transparent 55%), #0b1120; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--surface); border-radius: 18px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.4); display: flex; flex-direction: column; gap: 12px; }
.login-card .brand { color: var(--text); margin-bottom: 6px; }
.login-card .check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.login-card .err { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------- impression des états ---------- */
.print-head { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: var(--surface); font-size: 10.5pt; }
  .topbar, .modbar, .no-print, .toasts, .filters, .tabs, .head .btns, .creer-row { display: none !important; }
  .page { padding: 0; max-width: none; }
  .panel { border: 0; box-shadow: none; padding: 0; }
  .print-head { display: block; margin-bottom: 8px; }
  .tbl th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tbl tr.total td { background: #222 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tbl td, .tbl th { padding: 4px 6px; }
  .tbl-wrap { overflow: visible; }
}

/* ---------- v0.2 : menus, pointage, saisie au kilomètre ---------- */
.menu-pop { position: absolute; right: 0; top: 46px; z-index: 40; min-width: 320px; max-height: 420px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 36px rgba(15,23,42,.18); padding: 6px; display: flex; flex-direction: column; }
.menu-pop button { display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-weight: 600; }
.menu-pop button:hover { background: var(--accent-bg); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; width: 100%; }
.split { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
.acclist { display: flex; flex-direction: column; max-height: 70vh; overflow: auto; }
.acclist button { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line-2); background: var(--surface); text-align: left; cursor: pointer; }
.acclist button:hover { background: var(--surface-2); }
.acclist button.on { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
.acclist b { font-variant-numeric: tabular-nums; }
.acclist small { display: block; color: var(--muted); font-size: 12px; }
.selbar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; padding: 12px 18px; background: var(--navy); color: #fff; }
.selbar .t { display: flex; gap: 20px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.lettre { display: inline-flex; min-width: 30px; justify-content: center; padding: 2px 8px; border-radius: 7px; background: #dcfce7; color: #166534; font-weight: 800; font-size: 12.5px; }
.tbl tr.sel td { background: #eef3ff; }
.tbl input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.cand { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cand button { font-size: 12.5px; padding: 4px 9px; border-radius: 8px; border: 1px solid var(--accent-bd); background: var(--accent-bg); color: #1e3a8a; cursor: pointer; font-weight: 600; }
.amt-pos { color: var(--ok); font-weight: 700; }
.amt-neg { color: var(--danger); font-weight: 700; }
.drop { position: relative; overflow: hidden; border: 2px dashed var(--accent-bd); border-radius: 14px; padding: 22px; text-align: center; background: var(--surface-2); cursor: pointer; }
.drop.over { background: var(--accent-bg); border-color: var(--accent); }
.km { width: 100%; border-collapse: collapse; min-width: 980px; }
.km th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.km td { padding: 4px 6px; border-bottom: 1px solid var(--line-2); }
.km td .cell { min-height: 36px; }
.km tr.pstart td { border-top: 2px solid var(--line); }
.km tr.auto td { background: var(--surface-2); }
.km tr.ko td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.km tr.ok td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.km .nm { font-size: 12.5px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps.small li { flex: 1 1 140px; font-size: 13.5px; }

.lrow.auto .accname b { white-space: normal; }
.alert svg { flex-shrink: 0; }

/* ---------- MIS Facture ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.tile b { font-family: var(--display); font-size: 18px; }
.tile span { color: var(--muted); font-size: 13.5px; }
a.tile:hover { border-color: var(--accent-bd); }
.tile.soon { opacity: .6; }
.scan { display: flex; gap: 10px; align-items: center; flex: 1 1 360px; }
.scan input { flex: 1; min-height: 46px; font-size: 16px; }
.prix { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prix small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.ean { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; letter-spacing: .02em; }
.stock-low { color: var(--danger); font-weight: 800; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.grid-form .wide { grid-column: 1 / -1; }
dialog.large { width: min(760px, calc(100vw - 32px)); }
.inline-btn { display: flex; gap: 8px; }
.inline-btn input { flex: 1; }
.field .calc-hint { margin-top: 2px; }
.calc-hint { font-size: 12.5px; color: var(--accent); font-weight: 600; min-height: 16px; }

/* sélecteur de modules du PGI MIS : une couleur par module (Atelier magenta, Facturation orange, Compta sarcelle) */
.modules a[data-m], .modules span[data-m] { display: inline-flex; align-items: center; gap: 7px; }
.modules [data-m]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mc); flex-shrink: 0; }
.modules .on[data-m]::before { background: var(--surface); }
.modules [data-m=atelier] { --mc: #e0119d; }
.modules [data-m=facture] { --mc: #f97316; }
.modules [data-m=compta] { --mc: #14b8a6; }

/* ---------- éditeur de document ---------- */
.doc-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
@media (max-width: 1000px) { .doc-grid { grid-template-columns: 1fr; } }
.client-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.client-card b { font-size: 16px; }
.picker { position: relative; }
.picker .res { position: absolute; z-index: 50; left: 0; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 36px rgba(15,23,42,.18); padding: 6px; max-height: 340px; overflow: auto; }
.picker .res button { display: flex; width: 100%; justify-content: space-between; gap: 10px; text-align: left; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.picker .res button:hover, .picker .res button.sel { background: var(--accent-bg); }
.picker .res small { color: var(--muted); }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--navy); color: #fff; }
.dl { width: 100%; border-collapse: collapse; }
.dl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.dl td { padding: 6px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.dl input, .dl select, .dl textarea { width: 100%; min-height: 38px; padding: 6px 9px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--surface); }
.dl textarea { min-height: 30px; font-size: 13px; color: var(--muted); margin-top: 4px; resize: vertical; }
.dl .n input { text-align: right; font-variant-numeric: tabular-nums; }
.dl .m { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 14px; }
.dl .ref { font-size: 11.5px; color: var(--muted); }
.totaux { display: flex; flex-direction: column; gap: 6px; }
.totaux .l { display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums; }
.totaux .big { font-family: var(--display); font-size: 26px; font-weight: 800; }
.saving { font-size: 12.5px; color: var(--muted); min-height: 18px; }
.ro-lines td { padding: 8px 6px; }
.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mode input { position: absolute; opacity: 0; }
.mode span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 6px; border-radius: 11px; border: 2px solid var(--line); font-weight: 700; text-align: center; cursor: pointer; }
.mode input:checked + span { border-color: var(--brand); background: var(--brand-bg); color: var(--brand); }
.mode input:focus-visible + span { outline: 2px solid var(--accent); }

/* Badge « Compta : n à vérifier » (écritures envoyées, encore au brouillard de la compta) */
.topbar .verif { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 9px; background: #dc2626; color: #fff;
  font-weight: 700; font-size: 13.5px; text-decoration: none; white-space: nowrap; animation: pulse-verif 1.3s ease-in-out infinite; }
.topbar .verif b { background: var(--surface); color: #b91c1c; border-radius: 99px; min-width: 20px; padding: 0 6px; text-align: center; }
.topbar .verif.hidden { display: none; }
@keyframes pulse-verif { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,.7); } 70%, 100% { box-shadow: 0 0 0 10px rgba(239,68,68,0); } }
/* animations Windows désactivées : pas de mouvement, mais un halo qui s'allume et s'éteint */
@media (prefers-reduced-motion: reduce) { .topbar .verif { animation: halo-verif 1.4s ease-in-out infinite; } }
@keyframes halo-verif { 0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } 50% { box-shadow: 0 0 0 4px rgba(239,68,68,.8); } }
/* Validation : particulier / professionnel */
.seg-client { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; border: 0; padding: 0; margin: 0; }
.seg-client legend { font-weight: 700; margin-bottom: 8px; }
.seg-client label { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 2px solid var(--line, #e2e8f0); border-radius: 12px; cursor: pointer; }
.seg-client label:has(input:checked) { border-color: var(--brand, #c2410c); background: #fff7ed; }
.seg-client input { margin-top: 3px; accent-color: var(--brand, #c2410c); }
.seg-client span { display: flex; flex-direction: column; gap: 2px; }
.seg-client small { color: var(--muted, #64748b); font-size: 12.5px; }

/* Facture électronique */
.fe-panel h2 .chip { margin-left: 8px; vertical-align: middle; }
.fe-evs { margin: 10px 0 0; padding-left: 18px; color: var(--muted, #64748b); font-size: 13px; }
.fe-opts { margin-top: 12px; border-top: 1px solid var(--line, #e2e8f0); padding-top: 10px; }
.fe-opts summary { cursor: pointer; font-weight: 700; margin-bottom: 8px; }
.fe-ctrl { margin: 6px 0; padding-left: 4px; list-style: none; font-size: 13.5px; }
.fe-ctrl .fe-ko { color: var(--danger, #b91c1c); padding-left: 18px; font-size: 12.5px; }

/* Statut en grand dans l'en-tête */
.chip.big { font-size: 14.5px; padding: 5px 14px; border-radius: 99px; font-weight: 800; vertical-align: middle; display: inline-flex; align-items: center; gap: 5px; }
/* Fil d'avancement de la vente */
.parcours { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; margin: 4px 0 2px; }
.parcours a { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line, #e2e8f0);
  text-decoration: none; color: inherit; min-width: 150px; }
.parcours a small { display: block; color: var(--muted, #64748b); font-size: 12px; }
.parcours a .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #e2e8f0; font-weight: 800; flex: none; }
.parcours a.ok .num { background: #16a34a; color: #fff; }
.parcours a.alerte { border-color: #dc2626; background: #fef2f2; }
.parcours a.alerte .num { background: #dc2626; color: #fff; }
.parcours .fl { align-self: center; color: #94a3b8; font-size: 20px; }
/* Suite de la vente : étapes numérotées, de haut en bas */
.suite-titre { margin: 18px 0 8px; font-size: 20px; }
.suite { display: flex; flex-direction: column; gap: 14px; }
.etape { border-left: 5px solid var(--line); }
.etape.ok { border-left-color: #16a34a; }
.etape.alerte { border-left-color: #dc2626; }
.etape-tete { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.etape-tete h2 { margin: 0; }
.etape-tete .hint { margin: 2px 0 0; }
.etape-tete .num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #e2e8f0; font-weight: 800; font-size: 16px; flex: none; }
.etape.ok .etape-tete .num, #p-valider .etape-tete .num { background: #16a34a; color: #fff; }
.etape.alerte .etape-tete .num { background: #dc2626; color: #fff; }
#p-valider { border: 2px solid var(--brand, #c2410c); }
.btn.big { font-size: 15.5px; padding: 11px 18px; }
.seg-regl { grid-template-columns: repeat(5, 1fr); margin-top: 14px; }
.seg-regl label { padding: 10px; }
@media (max-width: 760px) { .seg-regl { grid-template-columns: 1fr 1fr; } }
.chips.villes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; grid-column: 1 / -1; }
.chips.villes .chip { cursor: pointer; border: 1px solid var(--line, #e2e8f0); }

/* ---------- lisibilité (04/10/2026) : trame du module, cadres délimités, zones de saisie marquées ---------- */
@media screen {
  :root { --bg: color-mix(in srgb, var(--brand) 8%, #eef0f4); }   /* trame légère à la couleur du module */
  .panel, .kpi, .steps { border-color: #cbd3de; box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 6px 18px rgba(15,23,42,.06); }
  /* titre de cadre : trait de la couleur du module + filet de séparation */
  .panel > h2, .panel > .panel-titre { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; padding-bottom: 10px;
    border-bottom: 1px solid var(--line); font-family: var(--display); font-size: 18px; font-weight: 700; }
  .panel > h2::before, .panel > .panel-titre::before { content: ""; width: 5px; height: 20px; border-radius: 3px; background: var(--brand); flex-shrink: 0; }
  .panel > .panel-titre { margin: 0; padding: 14px 20px 12px; }
  /* étiquettes plus lisibles, champs bien détachés du fond blanc */
  .field > label, .lbl { color: #334155; }
  .input, .field input, .field select, .field textarea, .cell { background: var(--surface-2); border-color: #b6c0ce; }
  .input:hover, .field input:hover, .field select:hover, .field textarea:hover, .cell:hover { border-color: #8f9bad; }
  .input:focus, .field input:focus, .field select:focus, .field textarea:focus, .cell:focus { background: var(--surface); }
  .input:disabled, .field input:disabled, .field select:disabled, .field textarea:disabled, .cell:disabled { background: var(--surface-2); border-color: var(--line); border-style: dashed; color: var(--muted); }
  /* boutons secondaires : contour net, léger relief */
  .btn { border: 1.5px solid #c3cbd7; box-shadow: 0 1px 2px rgba(15,23,42,.07); }
  .btn:hover { border-color: #8f9bad; }
  .btn.primary, .btn.brand, .btn.ok, .btn.draft { border-color: transparent; }
  /* actions d'en-tête (Créer un avoir, Dupliquer…) : grandes, icône à la couleur du module */
  :is(.head, .doc-actions) .btn.act { min-height: 46px; padding: 0 18px; font-size: 15px; font-weight: 700; border-color: color-mix(in srgb, var(--brand) 45%, #c3cbd7); }
  :is(.head, .doc-actions) .btn.act svg { color: var(--brand); }
  :is(.head, .doc-actions) .btn.act:hover { background: var(--brand-bg); border-color: var(--brand); }
  :is(.head, .doc-actions) .btn.act.danger { border-color: #e7b4b4; }
  :is(.head, .doc-actions) .btn.act.danger svg { color: var(--danger); }
  :is(.head, .doc-actions) .btn.act.danger:hover { background: var(--danger-bg); border-color: var(--danger); }
}

/* ---------- archives Dolibarr ---------- */
.arch-info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 13.5px; }
.arch-info svg { color: var(--brand); }
dialog.large:has(.arch-dlg) { width: min(980px, calc(100vw - 32px)); }
.arch-dlg { max-height: calc(100vh - 60px); overflow: auto; }
.arch-dlg h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.arch-totaux { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px 22px; font-size: 14px; color: var(--muted); }
.arch-totaux b { color: var(--text); margin-left: 6px; }
.arch-totaux .ttc { font-size: 17px; color: var(--text); }
.arch-regl { display: flex; justify-content: space-between; gap: 12px; padding: 7px 12px; border-radius: 8px; background: var(--ok-bg); margin-bottom: 4px; font-size: 13.5px; }
.arch-dlg .tbl th.num { text-align: right; }

/* ---------- listes : filtres, regroupement par mois, suite, haut de page ---------- */
.panel.filtres { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; }
.panel.filtres:empty { display: none; }
.panel.filtres .input { width: auto; min-height: 38px; padding: 6px 10px; }
.panel.filtres .resume { color: var(--muted); font-size: 14px; }
.panel.filtres .resume b { color: var(--text); }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.seg button small { font-weight: 700; font-size: 11.5px; margin-left: 4px; padding: 1px 6px; border-radius: 99px; background: var(--line); color: var(--text); }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15,23,42,.15); }
.seg button.on small { background: var(--brand); color: #fff; }
.tbl tr.grp-mois td { background: color-mix(in srgb, var(--brand) 7%, #fff); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px 12px; }
.grp-mois .gm-t { font-family: var(--display); font-weight: 700; font-size: 15px; text-transform: capitalize; }
.grp-mois .gm-n { float: right; color: var(--muted); font-size: 13px; font-weight: 600; }
.chip.pro { background: #e0f2fe; color: #0369a1; }
.pied { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 16px; border-top: 1px solid var(--line); }
.pied:empty { display: none; }
.haut-page { position: fixed; right: 22px; bottom: 22px; z-index: 40; display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px;
  border-radius: 99px; border: 0; background: var(--navy); color: #fff; font-weight: 700; box-shadow: 0 8px 24px rgba(15,23,42,.3); cursor: pointer;
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; }
.haut-page.on { opacity: 1; transform: none; pointer-events: auto; }
.haut-page:hover { background: var(--brand); }
@media print { .haut-page { display: none; } }

/* ---------- familles d'articles ---------- */
.fam-dot { display: inline-block; width: 11px; height: 11px; border-radius: 4px; background: var(--fc, #94a3b8); vertical-align: middle; flex-shrink: 0; }
.familles { display: flex; flex-wrap: wrap; gap: 8px; }
.familles .fam { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 13.5px; color: var(--text); box-shadow: 0 1px 2px rgba(15,23,42,.05); }
.familles .fam b { font-weight: 600; }
.familles .fam small { font-weight: 700; font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.familles .fam:hover { border-color: var(--fc, #8f9bad); }
.familles .fam.on { border-color: var(--fc, var(--navy)); background: color-mix(in srgb, var(--fc, #0f172a) 10%, #fff); }
.familles .fam.on b { font-weight: 800; }
.familles .fam.on small { background: var(--fc, var(--navy)); color: #fff; }
.tbl tr.grp-fam td { background: color-mix(in srgb, var(--fc) 9%, #fff); border-top: 1px solid var(--line); padding: 9px 12px; font-size: 15px; }
.tbl tr.grp-fam td .muted { font-size: 13px; margin-left: 6px; }
/* pages numérotées */
.pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; }
.pages .pg { min-width: 36px; height: 36px; padding: 0 8px; border-radius: 9px; border: 1.5px solid #c3cbd7; background: var(--surface);
  font-weight: 700; font-size: 14px; color: var(--text); cursor: pointer; font-variant-numeric: tabular-nums; }
.pages .pg:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pages .pg.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pages .pg:disabled { opacity: .35; cursor: default; }
.pages .pg-sep { color: var(--muted); padding: 0 2px; }
.pages .pg-info { margin-left: 10px; color: var(--muted); font-size: 13px; }
.pages-haut:not(:empty), #pages-haut:not(:empty) { padding: 10px 16px; border-bottom: 1px solid var(--line); }
.arch-info #pages-haut:not(:empty) { padding: 0; border: 0; }
.arch-info #pages-haut .pg { min-width: 32px; height: 32px; font-size: 13px; }
.pages .pg.on, .pages .pg.on:hover { background: var(--brand); border-color: var(--brand); color: #fff; cursor: default; }

/* croix de fermeture des fenêtres */
dialog .dlg-x { position: sticky; top: 10px; float: right; z-index: 5; margin: 10px 10px -44px 0; width: 34px; height: 34px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); font-size: 16px; font-weight: 700; line-height: 1; cursor: pointer; }
dialog .dlg-x:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
dialog h2 { padding-right: 44px; }

/* ---------- fiche prix A4 ---------- */
.fp-grille { display: grid; grid-template-columns: minmax(340px, 1fr) auto; gap: 18px; align-items: start; }
@media (max-width: 1200px) { .fp-grille { grid-template-columns: 1fr; } }
.fp-form { display: flex; flex-direction: column; gap: 10px; }
.fp-lignes { display: flex; flex-direction: column; gap: 6px; }
.fp-ligne { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto auto; gap: 6px; align-items: center; }
.fp-ligne .input { min-height: 38px; padding: 6px 10px; }
.fp-zone { background: #cbd2dc; padding: 18px; border-radius: 14px; overflow: auto; }
.a4 { width: 210mm; min-height: 297mm; background: var(--surface); box-shadow: 0 6px 24px rgba(15,23,42,.25); padding: 9mm 11mm; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 6mm; color: #000; font-family: "Figtree", Arial, sans-serif; zoom: .62; }
.fp-haut { display: grid; grid-template-columns: 62mm 1fr; gap: 8mm; align-items: start; }
.fp-logo { border: 1px solid #9ec5e8; padding: 2mm; }
.fp-logo img { width: 100%; display: block; }
.fp-marque { border: 2.5px solid #000; text-align: center; font-family: Arial, sans-serif; font-size: 30pt; font-weight: 400; letter-spacing: .04em; padding: 1mm 4mm; min-height: 15mm; }
.fp-avert { margin-top: 3mm; border: 1.5px solid #000; padding: 2mm 3mm; font-size: 8.5pt; font-weight: 700; text-transform: uppercase; text-align: justify; line-height: 1.5; }
.fp-avert .rouge { color: #e00000; text-decoration: underline; }
.fp-titre { border: 1px dotted #555; border-bottom: 3px solid #000; padding: 2mm 3mm; font-size: 19pt; font-weight: 800; text-transform: uppercase; }
.fp-tab { width: 100%; border-collapse: collapse; border: 2px solid #000; font-size: 15pt; font-weight: 700; }
.fp-tab th, .fp-tab td { border: 1.5px solid #000; padding: 2mm 3mm; text-align: left; }
.fp-tab th { width: 42%; text-transform: uppercase; }
.fp-tab tr:nth-child(odd) th, .fp-tab tr:nth-child(odd) td { background: #d9d9d9; }
.fp-contact { border: 1.5px solid #000; margin: 0 6mm; padding: 4mm; text-align: center; font-size: 12.5pt; font-weight: 700; line-height: 1.7; }
.fp-ct { font-size: 14pt; text-decoration: underline; }
.fp-tel { font-size: 14pt; }
.fp-bas { display: grid; grid-template-columns: 1fr 1.6fr; border: 2.5px solid #e00000; margin-top: auto; min-height: 40mm; }
.fp-ean { display: grid; place-items: center; padding: 3mm; border-right: 2.5px solid #e00000; }
.fp-ean .ean-svg { width: 48mm; height: auto; }
.fp-ref { font-weight: 800; font-size: 13pt; }
.fp-prix { display: grid; place-items: center; font-family: "Bricolage", Impact, sans-serif; font-weight: 800; font-size: 58pt; color: #b5332e;
  letter-spacing: -.02em; line-height: 1; padding: 2mm; white-space: nowrap; }
.fp-prix small { font-size: .7em; }
@media print {
  @page { size: A4; margin: 0; }
  body.page-fiche { background: var(--surface) !important; }
  body.page-fiche .topbar, body.page-fiche .no-print, body.page-fiche .haut-page, body.page-fiche .toast { display: none !important; }
  body.page-fiche .page { padding: 0; max-width: none; }
  body.page-fiche .fp-grille { display: block; }
  body.page-fiche .fp-zone { padding: 0; background: none; }
  body.page-fiche .a4 { zoom: 1; box-shadow: none; width: 210mm; height: 297mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* marque en haut de la fiche : plus grande et plus épaisse ; logo si la marque en a un */
.fp-marque { font-size: 40pt; font-weight: 800; letter-spacing: .03em; display: grid; place-items: center; min-height: 24mm; }
.fp-marque img { max-height: 20mm; max-width: 100%; object-fit: contain; display: block; }
.ok-txt { color: var(--ok); font-weight: 700; }
.marques-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.marque-carte { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); }
.mc-logo { width: 100%; height: 70px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); padding: 6px; }
.mc-logo img { max-height: 58px; max-width: 100%; object-fit: contain; }
.mc-logo span { font-weight: 800; font-size: 20px; color: var(--muted); letter-spacing: .04em; }
.prix-fiche { font-size: 20px !important; font-weight: 800; color: #b5332e; max-width: 200px; }
.eco-bareme { min-height: 42px; border-radius: 10px; border: 1.5px solid #b6c0ce; background: var(--surface-2); padding: 0 8px; max-width: 170px; }
.fp-bas { position: relative; }
.fp-eco { position: absolute; right: 4mm; bottom: 2mm; font-size: 9pt; font-weight: 700; color: #000; }

/* ---------- vivacité (05/10/2026) : trame chaude, couleur du module plus présente, tableau de bord ---------- */
@media screen {
  :root { --bg: #f6ede6; --brand-dark: #9a3412; --brand-soft: #ffedd5; }
  body { background: linear-gradient(180deg, #f9e6d9 0, var(--bg) 220px) no-repeat, var(--bg); }
  .kicker { color: var(--brand); }
  h1.title { color: #1c1917; }
  .tabs .on { background: var(--brand); border-color: var(--brand); box-shadow: 0 4px 12px rgba(194,65,12,.25); }
  .tabs button:hover:not(.on), .tabs a:hover:not(.on) { border-color: var(--brand); color: var(--brand-dark); }
  .seg button.on { color: var(--brand-dark); }
  .tbl th { background: #fdf3ec; color: #7c2d12; border-bottom-color: #f3d9c8; }
  .tbl tr.clickable:hover td { background: #fff7f0; }
  .chip.ok { background: #dcfce7; color: #166534; box-shadow: inset 0 0 0 1px #bbf7d0; }
  .chip.err { background: #fee2e2; color: #991b1b; box-shadow: inset 0 0 0 1px #fecaca; }
  .chip.warn { background: #fef3c7; color: #92400e; box-shadow: inset 0 0 0 1px #fde68a; }
  .chip.info { box-shadow: inset 0 0 0 1px #c7d7fb; }
  .kpi { border-top: 4px solid var(--c, var(--brand)); }
  .panel { border-color: #ead7ca; }
}

/* tableau de bord */
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.action { --c: var(--brand); display: flex; align-items: center; gap: 14px; min-height: 86px; padding: 14px 16px; border-radius: 16px; text-align: left;
  border: 2px solid color-mix(in srgb, var(--c) 35%, #fff); background: color-mix(in srgb, var(--c) 8%, #fff); color: var(--c);
  text-decoration: none; cursor: pointer; font: inherit; box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s; }
.action:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.10); border-color: var(--c); }
.action .ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); color: var(--c); flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.action .t { display: flex; flex-direction: column; gap: 3px; }
.action .t b { font-family: var(--display); font-size: 18px; font-weight: 800; }
.action .t span { font-size: 13px; color: #44403c; font-weight: 600; }
.action.brand { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 8px 22px rgba(194,65,12,.30); }
.action.brand .t span { color: #ffedd5; }
.action.devis { --c: #7c3aed; }
.action.regl { --c: #15803d; }
.action.cat { --c: #0e7490; }
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.dkpi { --c: var(--brand); position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 14px 20px; border-radius: 14px; background: var(--surface);
  border: 1px solid #ead7ca; box-shadow: var(--shadow); text-decoration: none; color: var(--text); overflow: hidden; }
.dkpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--c); }
.dkpi:hover { border-color: var(--c); }
.dkpi .k { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--c); }
.dkpi .v { font-family: var(--display); font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.dkpi .n { font-size: 12.5px; color: var(--muted); }
.dkpi .n b { color: var(--c); }
.dkpi.alerte { background: #fff5f5; }
.dkpi.attention { background: #fffbeb; }
.dkpi .modes { display: flex; flex-wrap: wrap; gap: 4px; }
.mode-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 1px 8px 1px 6px; border-radius: 99px;
  background: color-mix(in srgb, var(--c) 10%, #fff); color: var(--c); font-weight: 600; }
.mode-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.type-tag { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 6px; }
.type-tag.facture { background: var(--brand-soft); color: var(--brand-dark); }
.type-tag.avoir { background: #e0f2fe; color: #075985; }
.type-tag.devis { background: #ede9fe; color: #5b21b6; }
.imp-l { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px;
  text-decoration: none; color: var(--text); border-left: 4px solid #fca5a5; background: #fff7f7; margin-bottom: 6px; }
.imp-l.retard { border-left-color: #dc2626; }
.imp-l:hover { background: #fee2e2; }
.ok-vide { padding: 18px; border-radius: 12px; background: #f0fdf4; color: #166534; font-weight: 700; text-align: center; }

/* 06/10 : sélection des brouillons, famille depuis Produits */
.sel-barre { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff8f2; border-radius: var(--radius) var(--radius) 0 0; }
.sel-n { font-size: 13px; font-weight: 700; color: var(--brand-dark, #9a3412); }
.tbl td.sel-c { width: 40px; text-align: center; cursor: default; }
.tbl td.sel-c input, #sel-tout { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.tbl tr.sel td { background: #fff1e6; }
.btn.small.danger { border-color: #fecaca; }
.fam.fam-new { border-style: dashed; color: var(--brand); }

/* 06/10 : création d'un document en étapes numérotées, de haut en bas */
.pas { padding: 16px 20px 18px; }
.pas.plein { padding: 0; }
.pas.plein > .pas-h { padding: 16px 20px 12px; margin: 0; }
.panel > h2.pas-h { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid #f1e3d8;
  font-family: var(--display); font-size: 19px; }
.panel > h2.pas-h::before { display: none; }
.pas-h small { font-family: "Figtree", sans-serif; font-size: 13px; font-weight: 500; color: var(--muted); }
.pas-n { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 17px; font-weight: 800;
  box-shadow: 0 3px 8px rgba(194,65,12,.3); flex: none; }
.client-choix { display: flex; flex-direction: column; gap: 12px; }
.ou-sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; }
.ou-sep::before, .ou-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.gros-choix { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .gros-choix { grid-template-columns: 1fr; } }
.choix { --c: #1d4ed8; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 16px; text-align: left; cursor: pointer; font: inherit;
  border: 2px solid color-mix(in srgb, var(--c) 35%, #fff); background: color-mix(in srgb, var(--c) 7%, #fff); color: var(--text); transition: transform .12s, box-shadow .12s; }
.choix:hover { border-color: var(--c); transform: translateY(-2px); box-shadow: 0 10px 22px rgba(15,23,42,.1); }
.choix .ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--c); color: #fff; flex: none; }
.choix b { display: block; font-family: var(--display); font-size: 19px; font-weight: 800; color: var(--c); }
.choix small { display: block; margin-top: 2px; font-size: 13px; color: #44403c; }
.choix.passage { --c: #b45309; }
.client-choisi { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.client-choisi .client-card { flex: 1 1 320px; border: 2px solid #86efac; background: #f0fdf4; }
.cc-actions { display: flex; flex-direction: column; gap: 8px; }
.client-choisi + .client-choix.hidden + * { margin-top: 0; }
.l-outils { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 0 20px 14px; }
.btn.libre { border: 2px solid #dc2626; color: #b91c1c; background: #fff5f5; font-weight: 800; min-height: 48px; }
.btn.libre:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
.doc-grid.fin { align-items: start; }
.barre-total { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 18px; border-radius: 14px;
  background: var(--navy); color: #e2e8f0; box-shadow: 0 12px 30px rgba(15,23,42,.3); }
.barre-total .bt-cli { font-weight: 700; color: #fff; }
.barre-total .bt-manque { color: #fbbf24; }
.barre-total .bt-n { font-size: 13px; color: #94a3b8; }
.barre-total .bt-err { color: #fca5a5; font-weight: 700; }
.barre-total .bt-tot { font-size: 15px; }
.barre-total .bt-tot b { font-family: var(--display); font-size: 22px; color: #fff; margin: 0 4px; }
.barre-total .bt-retour, .barre-total .bt-prev { background: transparent; color: #e2e8f0; border-color: #475569; }
.barre-total .bt-retour:hover, .barre-total .bt-prev:hover { background: #1e293b; color: #fff; }
.barre-total .btn { white-space: nowrap; }
@media (max-width: 1100px) { .barre-total { flex-wrap: wrap; } .barre-total .bt-n { display: none; } }
.creer-row { gap: 10px; margin-top: -4px; }
.btn.famille-btn { border: 2px solid #0e7490; color: #0e7490; background: #ecfeff; font-weight: 800; }
.btn.famille-btn:hover { background: #0e7490; color: #fff; }
/* boutons d'action principaux : toujours sous le titre, à gauche (création en couleur pleine, variante à côté) */
.btn.devis-btn { border: 2px solid #7c3aed; color: #6d28d9; background: #f5f3ff; font-weight: 800; }
.btn.devis-btn:hover { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.doc-actions { margin-top: -6px; }
.doc-actions .saving { font-size: 13px; color: var(--muted); }
.imp-tog { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: #fff7ed; border: 1px solid #fed7aa; font-weight: 700; display: flex; align-items: center; gap: 8px; }

/* ---------- accessibilité et harmonisation (audit du 06/10/2026) ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.topbar :focus-visible { outline-color: #fff; }
.tbl th.num { text-align: right; }
@media (max-width: 1440px) {
  .topbar { gap: 8px 10px; padding: 8px 14px; }
  .brand .brand-nom, .userbox .user-nom { display: none; }
  .nav a { padding: 8px 7px; font-size: 13.5px; }
  .modules a, .modules span { padding: 6px 9px; font-size: 12.5px; }
}
.btn.danger { color: #b91c1c; background: #fff5f5; border-color: #fca5a5; }
.btn.danger:hover { background: #fee2e2; border-color: #f87171; }

/* ---------- Produits : familles à gauche (dossiers), articles à droite ---------- */
.pf { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 16px; align-items: start; }
.pf-side { position: sticky; top: 132px; max-height: calc(100vh - 150px); overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.pf-lbl { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 10px 4px; }
.pf-row { display: flex; align-items: center; gap: 2px; }
.pf-f { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 0; border-radius: 9px; background: none;
  color: var(--text); font: inherit; font-size: 14.5px; text-align: left; cursor: pointer; }
.pf-f b { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-f small { font-weight: 700; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.pf-f:hover { background: var(--surface-2); }
.pf-f.on { background: color-mix(in srgb, var(--fc, var(--brand)) 13%, var(--surface)); box-shadow: inset 3px 0 0 var(--fc, var(--brand)); }
.pf-f.on b { font-weight: 800; }
.pf-f.on small { background: var(--fc, var(--brand)); color: #fff; }
.pf-f svg { color: var(--muted); flex: none; }
.pf-new { margin-top: 8px; border: 1.5px dashed var(--line); color: var(--brand); }
.pf-new svg, .pf-new b { color: var(--brand); }
.pf-ed { display: none; padding: 6px; border-radius: 7px; color: var(--muted); }
.pf-row:hover .pf-ed { display: inline-flex; }
.pf-ed:hover { background: var(--surface-2); color: var(--brand); }
.pf-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pf-outils { display: flex; flex-direction: column; gap: 12px; }
.pf-outils .scan { flex: none; }
.pf-filtres { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.pf-filtres.hidden { display: none; }
.pf-tri { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.pf-tri select { min-height: 36px; padding: 4px 8px; }
.pf-titre { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; padding: 0 4px; }
.pf-titre h2 { margin: 0; font-family: var(--display); font-size: 21px; display: inline-flex; align-items: center; gap: 9px; }
.pf-titre h2 .fam-dot { width: 14px; height: 14px; }
.pf-liste .pf-bloc + .pf-bloc { border-top: 1px solid var(--line); }
.pf-bloc h3 { margin: 0; padding: 14px 16px 10px; font-size: 15px; }
.pf-ref { max-width: 260px; overflow-wrap: anywhere; }
.pf-ref .ean { font-size: 12px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.pf-fam { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.pf-fam .fam-dot { width: 8px; height: 8px; }
@media (max-width: 900px) { .pf { grid-template-columns: 1fr; } .pf-side { position: static; max-height: none; } }

/* ---------- étapes facultatives en accordéon (Notes, Plus d'options) ---------- */
details.pas.accord > summary.pas-h { list-style: none; cursor: pointer; user-select: none; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  margin: 0; padding-bottom: 0; border-bottom: 0; font-family: var(--display); font-size: 19px; font-weight: 700; }
details.pas.accord > summary.pas-h::-webkit-details-marker { display: none; }
details.pas.accord[open] > summary.pas-h { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid #f1e3d8; }
details.pas.accord .acc-ch { margin-left: auto; color: var(--muted); display: inline-flex; transition: transform .15s; }
details.pas.accord[open] .acc-ch { transform: rotate(180deg); }
details.pas.accord:not([open]) { padding-bottom: 16px; }
details.pas.accord > summary:hover .acc-ch { color: var(--brand); }
html[data-theme=dark] details.pas.accord[open] > summary.pas-h { border-color: #2b3446; }

/* ---------- fiche client : suggestions d'adresse (BAN), client professionnel, annuaire des entreprises, doublons ---------- */
.adr-wrap { position: relative; }
.adr-sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15,23,42,.16); padding: 6px; max-height: 300px; overflow: auto; }
.adr-sugg button { display: block; width: 100%; padding: 8px 12px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 14.5px; text-align: left; cursor: pointer; }
.adr-sugg button.on, .adr-sugg button:hover { background: var(--accent-bg); color: var(--accent); }
.adr-sugg small { color: var(--muted); margin-left: 6px; }

.pro-tog { display: flex; align-items: center; gap: 12px; padding: 11px 14px; margin: 2px 0 14px; border-radius: 12px; cursor: pointer;
  border: 2px solid #c4b5fd; background: #f5f3ff; color: #5b21b6; }
.pro-tog input { width: 20px; height: 20px; accent-color: #6d28d9; flex: none; }
.pro-tog b { display: block; font-size: 16px; font-weight: 800; letter-spacing: .01em; }
.pro-tog small { display: block; font-size: 12.5px; color: #6d28d9; opacity: .85; }
.cl-dlg.est-pro .pro-tog { background: #6d28d9; border-color: #6d28d9; color: #fff; }
.cl-dlg.est-pro .pro-tog small { color: #ede9fe; }
.cl-dlg.est-pro .pro-tog input { accent-color: #fff; }
.chip.pro, .badge-pro { background: #f3e8ff; color: #6d28d9; font-weight: 800; }
.cl-res { border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: var(--surface-2); max-height: 300px; overflow: auto; }
.cl-res .lbl { font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 4px 8px; }
.cl-res button { display: flex; width: 100%; gap: 12px; align-items: center; text-align: left; padding: 9px 10px; border: 0; border-radius: 9px;
  background: none; color: inherit; font: inherit; cursor: pointer; }
.cl-res button:hover { background: var(--accent-bg); }
.cl-res button > span { flex: 1; min-width: 0; }
.cl-res small { color: var(--muted); }
.cl-res .sir { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cl-doublon { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px;
  background: var(--warn-bg, #fdf3e6); border: 1px solid #f5c98b; color: var(--warn, #b45309); }
.cl-doublon .btn small { color: var(--muted); font-weight: 500; }
html[data-theme=dark] .pro-tog { background: #2a1f47; border-color: #5b46a3; color: #ddd6fe; }
html[data-theme=dark] .pro-tog small { color: #c4b5fd; }
html[data-theme=dark] .chip.pro { background: #2a1f47; color: #ddd6fe; }
html[data-theme=dark] .cl-doublon { border-color: #6b4a1a; }

/* ---------- en-tête commun du PGI MIS (option A) : bande blanche d'identité + menu teinté + pied de page ---------- */
.modbar { position: sticky; top: 0; z-index: 31; display: flex; align-items: center; gap: 14px; padding: 8px 20px; background: var(--surface);
  border-bottom: 1px solid var(--line); font-family: "Figtree", Arial, sans-serif; }
.modbar + .topbar { top: var(--mb, 0px); }
.modbar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mb-ident { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); }
.mb-logo { width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 12.5px; letter-spacing: .04em; flex: none; }
.mb-txt { display: flex; flex-direction: column; }
.mb-t { font-family: var(--display, "Bricolage"), "Figtree", sans-serif; font-weight: 800; font-size: 21px; line-height: 1.05; white-space: nowrap; }
.mb-t b { color: var(--brand); }
.mb-s { font-size: 11.5px; color: #8a93a3; font-weight: 700; margin-top: 3px; letter-spacing: .02em; white-space: nowrap; }
.mb-sep { width: 1px; height: 30px; background: #e5e7eb; margin: 0 2px; }
.mb-aller { font-size: 11px; font-weight: 800; color: #8a93a3; letter-spacing: .1em; text-transform: uppercase; }
.mb-mods { display: flex; gap: 8px; }
.mb-mod[data-m=atelier] { --m: #c0007f; } .mb-mod[data-m=facture] { --m: #c2410c; } .mb-mod[data-m=compta] { --m: #0f766e; }
.mb-mod { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 9px; font-weight: 800; font-size: 13.5px; color: var(--m);
  text-decoration: none; border: 1.5px solid color-mix(in srgb, var(--m) 35%, #fff); background: var(--surface); white-space: nowrap; }
.mb-mod:hover { background: color-mix(in srgb, var(--m) 8%, #fff); border-color: var(--m); }
.mb-sp { flex: 1; }
.modbar .rp-zone { margin-left: 0; }
.mb-user { display: flex; align-items: center; gap: 9px; padding: 3px 4px 3px 4px; border-radius: 999px; border: 1px solid var(--line); font-weight: 700; font-size: 13.5px; color: #334155; white-space: nowrap; }
.mb-av { width: 30px; height: 30px; border-radius: 50%; background: #334155; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.mb-logout { border: 0; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 700; font-size: 12.5px; cursor: pointer; }
.mb-logout:hover { background: #e2e8f0; color: var(--text); }
/* menu du module : à la couleur du module, pour tous les comptes */
body.barre-teinte .topbar { background: var(--brand); }
body.barre-teinte .topbar .nav a { color: rgba(255,255,255,.9); display: inline-flex; align-items: center; gap: 7px; }
body.barre-teinte .topbar .nav a svg.mi { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
body.barre-teinte .topbar .nav a:hover { background: rgba(0,0,0,.14); }
body.barre-teinte .topbar .nav a.active { background: rgba(0,0,0,.22); color: #fff; box-shadow: inset 0 -3px 0 #fff; }
body.barre-teinte .topbar .btn-ghost-dark { border-color: rgba(255,255,255,.5); color: #fff; }
body.barre-teinte .topbar .btn-ghost-dark:hover { background: rgba(0,0,0,.14); }
/* pied de page : version et auteur */
.mis-pied { display: flex; gap: 14px; align-items: center; padding: 10px 24px 12px; margin-top: 24px; font-size: 11.5px; color: #8a93a3; border-top: 1px solid rgba(15,23,42,.07); }
.mis-pied b { color: var(--muted); }
.mis-pied .sp { flex: 1; }
@media (max-width: 1100px) { .mb-s, .mb-aller, .mb-nom { display: none; } .mb-t { font-size: 18px; } }
@media (max-width: 760px) { .mb-sep, .mb-mods .mb-mod { font-size: 0; gap: 0; } .mb-mod svg { width: 18px; height: 18px; } }
@media print { .modbar, .mis-pied { display: none !important; } }
body.tv .modbar, body.tv .mis-pied { display: none !important; }

/* ---------- finitions de l'en-tête (08/10/2026) : menu plus lisible, Déconnexion bien visible ---------- */
.mb-logout { border: 1.5px solid #dc2626; background: var(--surface); color: #b91c1c; padding: 5px 13px; font-weight: 800; }
.mb-logout:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
html[data-theme=dark] .mb-logout { color: #fca5a5; border-color: #ef4444; }
html[data-theme=dark] .mb-logout:hover { background: #dc2626; color: #fff; }
body.barre-teinte .topbar { box-shadow: 0 2px 6px rgba(15,23,42,.12); }
body.barre-teinte .topbar .nav a { font-size: 15px; font-weight: 700; color: #fff; padding: 9px 13px; }
body.barre-teinte .topbar .nav a svg.mi { width: 17px; height: 17px; opacity: 1; }
body.barre-teinte .topbar .nav a.active { font-weight: 800; }
/* boutons du menu (atelier : Messages, RDV sur site, gazole) et « En direct » : lisibles sur la couleur du module */
body.barre-teinte .topbar .bell { border: 1.5px solid rgba(255,255,255,.6); color: #fff; background: rgba(255,255,255,.12); font-weight: 700; font-size: 14px; }
body.barre-teinte .topbar .bell:hover { background: rgba(255,255,255,.24); }
body.barre-teinte .topbar .bell.has { border-color: #fff; background: rgba(255,255,255,.22); color: #fff; }
body.barre-teinte .topbar .fuel.alerte { background: #dc2626; border-color: #fff; }
body.barre-teinte .topbar .live { color: #fff; font-weight: 700; }
@media (max-width: 1200px) { body.barre-teinte .topbar .nav a { font-size: 14px; padding: 8px 9px; } }
/* recherche globale dans le menu (comme MIS Atelier) */
.search { position: relative; }
.search input { width: 100%; padding: 9px 14px 9px 36px; border-radius: 10px; border: 1px solid rgba(255,255,255,.55); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14.5px; box-shadow: 0 1px 2px rgba(15,23,42,.12); }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: 3px solid rgba(255,255,255,.55); outline-offset: 1px; }
.search::before { content: "⌕"; position: absolute; left: 13px; top: 7px; color: var(--muted); font-size: 17px; z-index: 1; }
.topbar .search { flex: 0 1 440px; min-width: 180px; }
.search-results { position: absolute; right: 0; top: calc(100% + 6px); width: min(520px, 94vw); max-height: 70vh; overflow: auto; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.25); padding: 6px; z-index: 70; }
.search-results.hidden { display: none; }
.search-results .res { display: flex; gap: 10px; align-items: center; padding: 9px; border-radius: 8px; color: inherit; text-decoration: none; }
.search-results .res:hover, .search-results .res.on { background: var(--surface-2); }
.search-results .res b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.search-results .res.vide { color: var(--muted); }
.search-results .pill { color: #fff; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; }
.search-results .m { color: var(--muted); font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results .d { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; text-align: right; }

/* ---------- rappels et fin de journée (bande « Modules ») ---------- */
.rp-zone { position: relative; margin-left: auto; display: flex; gap: 8px; align-items: center; align-self: center; }
.modbar.onglets .rp-zone { margin-bottom: 7px; }
.rp-zone.hidden, .rp-zone .hidden { display: none !important; }
.rp-btn { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 10px; font: inherit; font-weight: 800; font-size: 13.5px; cursor: pointer;
  border: 2px solid var(--line); background: var(--surface); color: var(--muted); white-space: nowrap; }
.rp-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rp-btn.rp-on { border-color: #f59e0b; background: #fffbeb; color: #92400e; }
.rp-btn .rp-n { background: #dc2626; color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 7px; }
.rp-fin { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.rp-fin.fini { border-color: #86efac; background: #f0fdf4; color: #15803d; }
.rp-panneau { position: absolute; right: 0; top: calc(100% + 8px); width: min(500px, 92vw); background: var(--surface); color: var(--text); border-radius: 14px; z-index: 60;
  box-shadow: 0 18px 40px rgba(15,23,42,.28); border: 1px solid var(--line); padding: 12px 14px; text-align: left; font-weight: 400; }
.rp-panneau h3 { margin: 4px 4px 8px; font-size: 16px; }
.rp-panneau .rp-h-fin { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.rp-sub { margin: -4px 4px 6px; font-size: 12.5px; color: var(--muted); }
.rp-vide { margin: 4px; color: #15803d; font-weight: 700; }
.rp-it { display: flex; gap: 12px; align-items: center; padding: 9px 6px; border-radius: 10px; --fg: #b45309; }
.rp-it.err { --fg: #b91c1c; }
.rp-it + .rp-it { border-top: 1px solid var(--line); }
.rp-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: var(--fg); font-weight: 900; flex: none; }
.rp-it b { display: block; font-size: 14.5px; }
.rp-it div span { display: block; font-size: 12.5px; color: #5b6475; }
.rp-go { margin-left: auto; border: 1.5px solid var(--fg); color: var(--fg); background: var(--surface); border-radius: 8px; padding: 6px 10px; font: inherit; font-weight: 800; font-size: 13px; cursor: pointer; white-space: nowrap; }
.rp-ck { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-top: 1px solid var(--line); font-size: 14px; }
.rp-box { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; flex: none; padding: 0; font-weight: 900; color: #fff; cursor: pointer; }
.rp-box[disabled] { cursor: default; }
.rp-ck.fait .rp-box { background: #15803d; border-color: #15803d; }
.rp-ck.fait .rp-lib { color: var(--muted); text-decoration: line-through; }
.rp-act { margin-left: auto; border: 0; background: none; color: #1d4ed8; font: inherit; font-weight: 800; font-size: 13px; cursor: pointer; white-space: nowrap; }
@media print { .rp-zone { display: none !important; } }

/* ---------- mode nuit (bouton ☀ / 🌙 de la bande blanche ; html[data-theme=dark]) ---------- */
html[data-theme=dark] {
  --bg: #0e1320; --surface: #171d2b; --surface-2: #1d2434; --line: #2b3446; --line-2: #222a3a;
  --text: #e6e9ef; --muted: #a7b0c0; --faint: #7f899c; --navy: #0b1020;
  --accent: #7aa2ff; --accent-bg: #1a2546; --accent-bd: #3a5bb0;
  --brand-bg: color-mix(in srgb, var(--brand) 22%, #171d2b); --teal-bg: #10302c;
  --ok: #4ade80; --ok-bg: #12301f; --warn: #fbbf24; --warn-bg: #33270f; --danger: #f87171; --danger-bg: #3a1719;
  --debit-bg: #1a2546; --credit-bg: #3a2214;
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 2px 12px rgba(0,0,0,.35);
  color-scheme: dark;
}
html[data-theme=dark] body { background: var(--bg); color: var(--text); }
html[data-theme=dark] input:not([type=checkbox]):not([type=radio]):not([type=range]), html[data-theme=dark] select, html[data-theme=dark] textarea {
  background-color: var(--surface-2); color: var(--text); border-color: var(--line); }
html[data-theme=dark] input::placeholder, html[data-theme=dark] textarea::placeholder { color: #6f7a8f; }
html[data-theme=dark] dialog { background: var(--surface); color: var(--text); }
html[data-theme=dark] [style*="background:#fff"], html[data-theme=dark] [style*="background: #fff"] { background: var(--surface) !important; }
html[data-theme=dark] [style*="color:#0f172a"], html[data-theme=dark] [style*="color: #0f172a"], html[data-theme=dark] [style*="color:#111827"] { color: var(--text) !important; }
html[data-theme=dark] .mb-mod { border-color: color-mix(in srgb, var(--m) 55%, #171d2b); color: color-mix(in srgb, var(--m) 55%, #fff); }
html[data-theme=dark] .mb-av { background: #475569; }
html[data-theme=dark] .mb-logout { background: var(--surface-2); color: var(--muted); }
html[data-theme=dark] .rp-btn { background: var(--surface-2); }
html[data-theme=dark] .rp-btn.rp-on { background: #33270f; color: #fcd34d; }
html[data-theme=dark] .rp-fin { background: #1a2546; color: #93c5fd; }
html[data-theme=dark] .rp-fin.fini { background: #12301f; color: #86efac; }
html[data-theme=dark] .rp-panneau, html[data-theme=dark] .rp-go { background: var(--surface); color: var(--text); }
html[data-theme=dark] .rp-it b { color: var(--text); }
html[data-theme=dark] .switch::after { background: #e6e9ef; }
/* impressions : toujours en clair */
@media print { html[data-theme=dark] {
  --bg: #eef0f4; --surface: #ffffff; --surface-2: #f7f8fa; --line: #dde2ea; --line-2: #eef0f4;
  --text: #111827; --muted: #5b6475; --faint: #8a93a3;
  --navy: #0f172a; --accent: #1d4ed8; --accent-bg: #eef3ff; --accent-bd: #9db4f0;
  --brand: #c2410c; --brand-bg: #fff4ed;   /* MIS Facture : orange brûlé */
  --ok: #15803d; --ok-bg: #e9f8ef; --warn: #b45309; --warn-bg: #fdf3e6; --danger: #b91c1c; --danger-bg: #fdecec;
  --debit: #1d4ed8; --debit-bg: #eaf1ff; --credit: #c2410c; --credit-bg: #fff1e8;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,23,42,.05), 0 2px 10px rgba(15,23,42,.05);
  --display: "Bricolage", "Figtree", system-ui, sans-serif;
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
  color-scheme: light; } html[data-theme=dark] body { background: #fff; color: #111827; } }
/* bouton jour / nuit */
.mb-theme { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; }
.mb-theme:hover { color: var(--text); border-color: var(--muted); }
.mb-theme svg { width: 18px; height: 18px; }

/* ---------- mode nuit : équivalents sombres générés (darkgen.py) ---------- */
@media screen {
:where(html[data-theme=dark]) .nav a .badge { color: #f6b28e; }
:where(html[data-theme=dark]) .btn.draft { color: #f6b28e; }
:where(html[data-theme=dark]) .chip.ok { color: #9ae9b8; }
:where(html[data-theme=dark]) .chip.warn { color: #f4b68f; }
:where(html[data-theme=dark]) .chip.err { color: #ed9797; }
:where(html[data-theme=dark]) .tbl tr.sub td { background: #1e2234; }
:where(html[data-theme=dark]) .steps li b { background: #212531; }
:where(html[data-theme=dark]) .jtile { background: color-mix(in srgb, var(--c) 9%, #1d2434); }
:where(html[data-theme=dark]) .cell.amt.computed { color: #9aafe9; }
:where(html[data-theme=dark]) .autoamt { color: #9aafe9; }
:where(html[data-theme=dark]) .autotag { background: #121f3f; }
:where(html[data-theme=dark]) .lockacc { color: #9aafe9; }
:where(html[data-theme=dark]) .eq.ok { color: #91f3cf; }
:where(html[data-theme=dark]) .eq.ko { background: #3f1212; color: #f09494; }
:where(html[data-theme=dark]) .alert.warn { color: #f4b68f; }
:where(html[data-theme=dark]) .alert.err { color: #ed9797; border-color: #2b3446; }
:where(html[data-theme=dark]) .alert.ok { color: #9ae9b8; }
:where(html[data-theme=dark]) .tbl th { background: #1d2434; }
:where(html[data-theme=dark]) .lettre { background: #143d22; color: #9ae9b8; }
:where(html[data-theme=dark]) .tbl tr.sel td { background: #12203f; }
:where(html[data-theme=dark]) .cand button { color: #9aafe9; }
:where(html[data-theme=dark]) .seg-client label:has(input:checked) { background: #3f2b12; }
:where(html[data-theme=dark]) .parcours a .num { background: #212831; }
:where(html[data-theme=dark]) .parcours a.alerte { background: #3e1414; }
:where(html[data-theme=dark]) .etape-tete .num { background: #212831; }
:where(html[data-theme=dark]) .field > label, :where(html[data-theme=dark]) .lbl { color: #b2bfd1; }
:where(html[data-theme=dark]) .btn { border-color: #2b3446; }
:where(html[data-theme=dark]) .tbl tr.grp-mois td { background: color-mix(in srgb, var(--brand) 7%, #1d2434); }
:where(html[data-theme=dark]) .chip.pro { background: #122d3f; color: #8ed1f6; }
:where(html[data-theme=dark]) .familles .fam.on { background: color-mix(in srgb, var(--fc, #0f172a) 10%, #1d2434); }
:where(html[data-theme=dark]) .tbl tr.grp-fam td { background: color-mix(in srgb, var(--fc) 9%, #1d2434); }
:where(html[data-theme=dark]) .pages .pg { border-color: #2b3446; }
:where(html[data-theme=dark]) .fp-zone { background: #24282e; }
:where(html[data-theme=dark]) .fp-tab tr:nth-child(odd) th, :where(html[data-theme=dark]) .fp-tab tr:nth-child(odd) td { background: #1d2434; }
:where(html[data-theme=dark]) body { background: linear-gradient(180deg, #3b2517 0, var(--bg) 220px) no-repeat, var(--bg); }
:where(html[data-theme=dark]) h1.title { color: #e6e9ef; }
:where(html[data-theme=dark]) .tbl th { background: #3d2515; color: #efab94; }
:where(html[data-theme=dark]) .tbl tr.clickable:hover td { background: #3f2712; }
:where(html[data-theme=dark]) .chip.ok { background: #143d22; color: #9ae9b8; }
:where(html[data-theme=dark]) .chip.err { background: #3f1212; color: #ed9797; }
:where(html[data-theme=dark]) .chip.warn { background: #3f3612; color: #f4b68f; }
:where(html[data-theme=dark]) .action { background: color-mix(in srgb, var(--c) 8%, #1d2434); }
:where(html[data-theme=dark]) .action .t span { color: #e6e9ef; }
:where(html[data-theme=dark]) .dkpi { border-color: #2b3446; }
:where(html[data-theme=dark]) .dkpi.alerte { background: #3f1212; }
:where(html[data-theme=dark]) .dkpi.attention { background: #3f3612; }
:where(html[data-theme=dark]) .mode-pill { background: color-mix(in srgb, var(--c) 10%, #1d2434); }
:where(html[data-theme=dark]) .type-tag.avoir { background: #122d3f; color: #8ed1f6; }
:where(html[data-theme=dark]) .type-tag.devis { background: #1b123f; }
:where(html[data-theme=dark]) .imp-l { background: #3f1212; border-color: #2b3446; }
:where(html[data-theme=dark]) .imp-l:hover { background: #3f1212; }
:where(html[data-theme=dark]) .ok-vide { background: #163c22; color: #9ae9b8; }
:where(html[data-theme=dark]) .sel-barre { background: #3f2712; }
:where(html[data-theme=dark]) .tbl tr.sel td { background: #3f2612; }
:where(html[data-theme=dark]) .panel > h2.pas-h { border-color: #2b3446; }
:where(html[data-theme=dark]) .choix { background: color-mix(in srgb, var(--c) 7%, #1d2434); }
:where(html[data-theme=dark]) .choix small { color: #e6e9ef; }
:where(html[data-theme=dark]) .client-choisi .client-card { background: #163c22; }
:where(html[data-theme=dark]) .btn.libre { background: #3f1212; color: #ef9595; }
:where(html[data-theme=dark]) .btn.famille-btn { background: #123d3f; color: #8fdef4; }
:where(html[data-theme=dark]) .btn.devis-btn { background: #1a123f; }
:where(html[data-theme=dark]) .imp-tog { background: #3f2b12; border-color: #2b3446; }
:where(html[data-theme=dark]) .btn.danger { background: #3f1212; color: #ef9595; }
:where(html[data-theme=dark]) .btn.danger:hover { background: #3f1212; }
}
/* ---------- fin des équivalents sombres générés ---------- */

/* ---------- mode TEST ---------- */
#pgi-test { position: sticky; top: 0; z-index: 1000; background: repeating-linear-gradient(135deg, #b91c1c 0 18px, #991b1b 18px 36px); color: #fff;
  font: 800 13px/1.2 "Figtree", system-ui, sans-serif; letter-spacing: .04em; text-align: center; padding: 7px 12px; }
@media print { #pgi-test { display: none; } }
