/* Achats — factures fournisseurs, échéancier, fiches fournisseurs. Rouge réservé aux actions importantes et aux alertes. */
.pb-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pb-kpi { text-align: left; font: inherit; cursor: pointer; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 1px 3px rgba(15, 25, 45, .05); border-top: 3px solid var(--k, #14223b); transition: box-shadow .15s, transform .15s; }
.pb-kpi:hover { box-shadow: 0 6px 16px rgba(15, 25, 45, .1); transform: translateY(-1px); }
.pb-kpi.on { outline: 2px solid var(--k, #14223b); outline-offset: 1px; }
.pb-kpi span { font-size: 11.5px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.pb-kpi b { font-family: var(--cond); font-size: 22px; color: var(--navy); line-height: 1.15; }
.pb-kpi em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.pb-kpi.k-red b { color: #c9141b; } .pb-kpi.k-orange b { color: #d0620e; } .pb-kpi.k-green b { color: #1a8a3a; }

.pb-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.pb-filters .field { margin: 0; min-width: 130px; flex: 0 1 160px; } .pb-filters .field label { font-size: 11.5px; }
.pb-filters .grow { flex: 1 1 240px; }
.pb-adv { display: none; } .pb-adv.open { display: flex; }
.pb-table th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
.pb-table th[data-sort]:hover { color: var(--navy); }
.pb-table th .arr { opacity: .35; margin-left: 3px; } .pb-table th.sorted .arr { opacity: 1; color: var(--red-text); }
.pb-table td { white-space: nowrap; } .pb-table td.wrap { white-space: normal; }
.pb-late { color: #c9141b; font-weight: 700; } .pb-soon { color: #d0620e; font-weight: 700; }
.pb-anom { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: #c9141b; }
.pb-anom.w { color: #d0620e; }

/* détail d'une facture */
.pb-head { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-start; padding: 20px 24px 12px; }
.pb-head .ref { font-family: var(--cond); font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1; }
.pb-head .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.pb-head .sub a { color: var(--navy); font-weight: 700; }
.pb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.pb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 0 24px 14px; }
.pb-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.pb-card span { font-size: 11.5px; color: var(--muted); font-weight: 600; } .pb-card b { display: block; font-family: var(--cond); font-size: 20px; color: var(--navy); }
.pb-card.hl b { color: #c9141b; }
.pb-body { padding: 0 24px 24px; }
.pb-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .pb-grid { grid-template-columns: 1fr; } }
.pb-sec { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; }
.pb-sec > h3 { margin: 0; padding: 12px 16px; font-size: 14px; letter-spacing: .3px; text-transform: uppercase; color: var(--navy); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.pb-sec > h3 .spacer { flex: 1; }
.pb-sec .in { padding: 14px 16px; }
.pb-dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; margin: 0; }
.pb-dl dt { color: var(--muted); } .pb-dl dd { margin: 0; font-weight: 600; color: var(--text-2); word-break: break-word; }
.pb-sit { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pb-sit div { background: #f6f8fa; border-radius: 8px; padding: 8px 10px; } .pb-sit span { font-size: 11px; color: var(--muted); display: block; } .pb-sit b { font-size: 15px; }
.pb-sit .late b { color: #c9141b; }

/* éditeur de lignes */
.pb-lines { width: 100%; border-collapse: collapse; font-size: 13px; }
.pb-lines th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); background: #f8fafc; white-space: nowrap; }
.pb-lines td { padding: 5px 6px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.pb-lines input, .pb-lines select { width: 100%; border: 1px solid var(--field-line); border-radius: 6px; padding: 6px 7px; font: inherit; font-size: 13px; background: #fff; min-width: 0; }
.pb-lines input:focus, .pb-lines select:focus { outline: 2px solid rgba(31, 99, 201, .25); border-color: #1f63c9; }
.pb-lines .num, .pb-lines input.num { text-align: right; }
.pb-lines .ro { color: var(--muted); font-size: 11.5px; }
.pb-lines-wrap { overflow-x: auto; }
.pb-totals { display: grid; grid-template-columns: 1fr auto; gap: 5px 18px; font-size: 13.5px; }
.pb-totals span { color: var(--muted); } .pb-totals b { text-align: right; font-variant-numeric: tabular-nums; }
.pb-totals .big { font-size: 18px; color: var(--navy); border-top: 1px solid var(--line); padding-top: 6px; margin-top: 3px; }
.pb-totals .due { color: #c9141b; }

/* rapprochement */
.vd { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.vd::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.vd.ok { color: #1a8a3a; background: #e9f7ee; } .vd.warn { color: #c46a0a; background: #fff3e4; } .vd.bad { color: #c9141b; background: #fdecec; } .vd.na { color: #6b7688; background: #f0f2f5; }

/* anomalies */
.an { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.an:last-child { border-bottom: 0; }
.an .sev { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; } .an .sev.critical { background: #e11d24; box-shadow: 0 0 0 3px rgba(225, 29, 36, .15); } .an .sev.warning { background: #f47a20; } .an .sev.info { background: #9aa3b2; }
.an .msg { font-size: 13.5px; } .an .meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.an.closed { opacity: .65; }

/* chaîne d'origine */
.pb-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 14px; }
.pb-chain a { display: inline-flex; flex-direction: column; text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; min-width: 96px; }
.pb-chain a:hover { border-color: var(--navy); box-shadow: 0 3px 10px rgba(15, 25, 45, .12); }
.pb-chain a small { font-size: 10px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.pb-chain a b { font-size: 12.5px; color: var(--navy); }
.pb-chain a.cur { border-color: #e11d24; box-shadow: inset 0 -3px 0 #e11d24; }
.pb-chain a.muted b { color: var(--muted); font-weight: 500; }
.pb-chain i { color: var(--muted-2); font-style: normal; }

/* historique */
.tl2 { position: relative; padding-left: 18px; }
.tl2::before { content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl2 .it { position: relative; padding: 0 0 12px; font-size: 13px; }
.tl2 .it::before { content: ''; position: absolute; left: -17px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--navy); }
.tl2 .it.warn::before { border-color: #f47a20; } .tl2 .it.bad::before { border-color: #e11d24; background: #e11d24; } .tl2 .it.ok::before { border-color: #1a8a3a; background: #1a8a3a; }
.tl2 time { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-right: 6px; }
.tl2 .ch { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* échéancier + tableau de bord */
.bucket-h { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-weight: 700; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.bucket-h .dotc { width: 10px; height: 10px; border-radius: 50%; } .b-retard .dotc { background: #e11d24; } .b-proche .dotc { background: #f47a20; } .b-a_venir .dotc { background: #1a8a3a; }
.mbars { display: flex; align-items: flex-end; gap: 6px; height: 160px; border-bottom: 1px solid var(--line); padding-top: 8px; }
.mbars div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.mbars i { width: 100%; max-width: 38px; background: #1d293d; border-radius: 4px 4px 0 0; min-height: 2px; }
.mbars div.cur i { background: #e11d24; }
.mbars em { font-style: normal; font-size: 10.5px; color: var(--muted); }
.pb-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.doc { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.doc b { font-size: 13px; word-break: break-all; } .doc small { color: var(--muted); font-size: 11.5px; }
.ocr-box { border: 1px dashed #1f63c9; background: #f3f7fd; border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.pb-kpi { text-decoration: none; color: inherit; }

.pb-card small { display: block; font-size: 11.5px; margin-top: 1px; }
.pb-more { position: relative; }
.pb-more > summary { list-style: none; cursor: pointer; } .pb-more > summary::-webkit-details-marker { display: none; }
.pb-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 34px rgba(15, 25, 45, .18); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 250px; }
.pb-menu .btn { justify-content: flex-start; border-color: transparent; box-shadow: none; }
.pb-menu .btn:hover { background: #f3f5f8; }
.pb-sched { table-layout: fixed; }
.pb-sched th:nth-child(1) { width: 38px; } .pb-sched th:nth-child(2) { width: 15%; } .pb-sched th:nth-child(3) { width: 19%; }
.pb-sched th:nth-child(7) { width: 11%; } .pb-sched th:nth-child(8) { width: 12%; } .pb-sched th:nth-child(9) { width: 16%; }
