:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --border: #e3e6ee;
    --text: #1f2430;
    --muted: #6b7385;
    --primary: #2f5bea;
    --primary-dark: #2448c2;
    --sidebar: #1c2233;
    --sidebar-text: #c5cbe0;
    --success: #1e9e5a;
    --danger: #d64545;
    --orange: #e08a1e;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: 230px; background: var(--sidebar); color: var(--sidebar-text); padding: 20px 12px; }
.sidebar .brand { font-weight: 700; font-size: 18px; color: #fff; padding: 0 10px 20px; }
.sidebar nav a { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 8px; color: var(--sidebar-text); margin-bottom: 2px; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar nav i { width: 18px; text-align: center; }
.nav-group { margin-bottom: 2px; }
.nav-group summary { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 8px; cursor: pointer; list-style: none; user-select: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-group.has-active summary { color: #fff; }
.nav-group .nav-caret { margin-left: auto; font-size: 11px; transition: transform .15s; }
.nav-group[open] .nav-caret { transform: rotate(180deg); }
.sidebar .nav-group a { padding-left: 30px; font-size: 14px; }

.main { margin-left: 230px; min-height: 100vh; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 28px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 20px; margin: 0; }
.topbar .user { display: flex; gap: 12px; align-items: center; color: var(--muted); }
.content { padding: 24px 28px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; margin-bottom: 20px; overflow-x: auto; }
.card h3 { margin: 0 0 14px; font-size: 15px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
a.tile { color: inherit; }
a.tile:hover { border-color: var(--primary); }
.tile-label { color: var(--muted); font-size: 13px; }
.tile-value { font-size: 26px; font-weight: 700; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: #fafbfd; }
.table tr.inactive td { opacity: .5; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; margin-right: 4px; white-space: nowrap; }
.pill-blue { background: #e7edfd; color: var(--primary-dark); }
.pill-green { background: #e3f5eb; color: #16774a; }
.pill-orange { background: #fdf0de; color: #a8620c; }
.pill-grey { background: #eceef3; color: var(--muted); }
.pill-red { background: #fde4e4; color: #b42318; }
.pill-outline { background: transparent; border: 1px solid currentColor; color: var(--muted); }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: #fff; width: 100%; }
.toolbar input, .toolbar select { width: auto; min-width: 220px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; margin-bottom: 14px; }
label.check { flex-direction: row; align-items: center; margin: 0; font-weight: 400; }
label.check input { width: auto; }
.table input, .table select { margin: 0; }

.btn { display: inline-flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: 7px; border: 1px solid var(--border); background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { background: #f1f3f8; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-icon { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; }
.btn-icon:hover { color: var(--primary); }
.btn-icon-danger:hover { color: var(--danger); }
.btn-icon:disabled { opacity: .25; cursor: default; }
.btn-icon:disabled:hover { color: var(--muted); }

/* Lignes réordonnables */
.drag-handle { cursor: grab; color: var(--muted); padding: 4px; display: inline-block; }
.drag-handle:active { cursor: grabbing; }
tr.dragging { opacity: .4; background: #eef2fe; }
.line-tools { white-space: nowrap; }
tr.line-empty td { background: #fff8f0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }

/* Autocomplétion (assets/app.js) */
.ac { position: relative; font-weight: 400; }
.ac-list { position: absolute; z-index: 20; left: 0; right: 0; min-width: 320px; top: 100%; margin: 2px 0 0; padding: 4px 0; list-style: none; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(20,30,60,.12); max-height: 320px; overflow-y: auto; }
.ac-list li { padding: 7px 12px; cursor: pointer; }
.ac-list li[data-index]:hover, .ac-list li.active { background: #eef2fe; }
.ac-invalid .ac-input { border-color: var(--danger); background: #fff8f8; }
/* 3.10.10 : loupe au bout des champs de recherche (app.js, addLoupe) */
.sx { position: relative; display: inline-block; max-width: 100%; vertical-align: middle; }
.sx.sx-block { display: block; }
.sx > input { padding-right: 36px; }
.sx.sx-block > input { width: 100%; }
.sx-btn { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px;
          background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 32px; }
.sx-btn:hover, .sx-btn:focus-visible { color: var(--primary); background: #eef2fe; }
.doc-form { overflow: visible; }

/* Éditeur de lignes : prix de référence (dernier saisi, HT ou TTC) */
.lines-editor input.is-base, .base-sample { border: 2px solid var(--primary); background: #f4f7ff; font-weight: 600; }
.base-sample { display: inline-block; padding: 0 6px; border-radius: 5px; }
.lines-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
/* Sélection par modèle (2.65.0, _variant_picker.view.php) */
.vp-dialog { width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(20,30,60,.25); }
.vp-dialog[open] { display: flex; flex-direction: column; }
.vp-dialog [hidden] { display: none !important; }
.vp-dialog::backdrop { background: rgba(20,26,40,.45); }
.vp-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.vp-head h3 { margin: 0; font-size: 16px; flex: 1; }
.vp-body { padding: 16px 18px; overflow: auto; flex: 1; min-height: 320px; }
.vp-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--border); }
.vp-foot .js-vp-total { margin-right: auto; }
.vp-search { width: 100%; margin-bottom: 14px; }
/* 2.77.0 : rayons et fil d'Ariane */
.vp-crumbs { margin: -6px 0 12px; font-size: 13px; }
.vp-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 14px; }
.vp-cat { display: flex; gap: 12px; align-items: center; text-align: left; padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: #f8f9fd; font: inherit; color: inherit; cursor: pointer; }
.vp-cat:hover, .vp-cat:focus { border-color: var(--primary); background: #eef2ff; outline: none; }
.vp-models { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.vp-model, .vp-color { display: flex; gap: 12px; align-items: center; text-align: left; padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: #fff; font: inherit; color: inherit; cursor: pointer; }
.vp-model:hover, .vp-color:hover, .vp-model:focus, .vp-color:focus { border-color: var(--primary); background: #f7f9ff; outline: none; }
.vp-model-txt { min-width: 0; }
.vp-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.vp-thumb, .vp-thumb-sm, .vp-photo-img { flex: none; object-fit: contain; background: #fff; border-radius: 7px; border: 1px solid var(--border); }
.vp-thumb { width: 72px; height: 72px; }
.vp-thumb-sm { width: 48px; height: 48px; }
.vp-photo-img { width: 220px; height: 220px; }
.vp-nothumb { display: inline-flex; align-items: center; justify-content: center; color: #c3c8d6; font-size: 22px; background: #f5f6fa; }
.vp-photo-img.vp-nothumb { font-size: 54px; }
.vp-model-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.vp-sizes-wrap { display: flex; gap: 18px; align-items: flex-start; }
.vp-sizes-main { flex: 1; min-width: 0; }
.vp-sizes-main .vp-model-head { display: block; }
.vp-grid-wrap { overflow-x: auto; }
.vp-grid th, .vp-grid td { padding: 6px 6px; text-align: center; }
.vp-grid th:first-child, .vp-grid td:first-child { text-align: left; white-space: nowrap; }
.vp-grid th { text-transform: none; font-size: 13px; color: var(--text); }
.vp-qty { width: 64px; }
.vp-qty.vp-short { border-color: var(--orange); background: #fff7ec; }
.vp-quick { display: block; margin-top: 12px; }
.vp-quick input { width: 100%; margin-top: 4px; }
/* Vue PAO du tableau de bord (2.67.0, _pao_bat.view.php) */
/* Chapitres et sous-totaux (2.73.0) */
.line-title td { background: #eef2ff; }
.chapter-input { display: flex; align-items: center; gap: 8px; color: var(--primary-dark); }
.chapter-input input { flex: 1; font-weight: 600; border-color: #c7d2fe; }
.line-title .js-chapter-total { font-weight: 600; color: var(--primary-dark); white-space: nowrap; }
.table tr.line-chapter td { background: #eef2ff; font-weight: 600; color: var(--primary-dark); }
.table tr.line-subtotal td { background: #f6f7fb; font-style: italic; }
.table tr.line-chapter-l2 td:first-child, .table tr.line-chapter-l2 td.stack-full { padding-left: 24px; }
/* Catégories (2.75.0) */
.cat-top td { background: #f6f7fb; }
.cat-indent { color: var(--muted); margin-left: 14px; }
.mono { font-family: ui-monospace, monospace; }
.meta-refclient input { width: 100%; max-width: 260px; padding: 4px 8px; }
.meta-refclient [hidden] { display: none !important; } /* 3.13.9 : bouton OK caché tant que la valeur est inchangée (.btn l'affichait) */
.pao-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 14px; }
.pao-tiles .tile.is-active { border-color: var(--primary); }
.pao-card .toolbar { margin-bottom: 10px; }
.pao-bat { font-size: 12px; font-weight: 500; padding: 3px 6px; border-radius: 999px; border: 1px solid var(--border); max-width: 220px; }
.pao-bat-blue { background: #e7edfd; color: var(--primary-dark); }
.pao-bat-red { background: #fde8e8; color: #a32d2d; }
.pao-bat-orange { background: #fdf0de; color: #8a5208; }
.pao-bat-purple { background: #eeedfe; color: #3c3489; }
.pao-bat-green { background: #e3f5ea; color: #17663a; }
.pao-bat-grey { background: #eef0f4; color: var(--muted); }
@media (max-width: 720px) { .vp-sizes-wrap { flex-direction: column; } .vp-photo-img { width: 140px; height: 140px; } .vp-models { grid-template-columns: 1fr; } }

.grid-4 { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 16px; }
.grid-2-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2-cards .card p { margin: 0 0 6px; }
.table.kv td:first-child { color: var(--muted); width: 45%; }
.btn-danger { color: var(--danger); border-color: #f1c4c4; }
.btn-danger:hover { background: #fdeaea; }
.toolbar form { margin: 0; }
.table tfoot td { border-bottom: 0; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.form-actions .check { margin-right: auto; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert-error { background: #fdeaea; color: #9d2b2b; }
.alert-success { background: #e3f5eb; color: #16774a; }

.muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { margin: 0 0 4px; }

@media (max-width: 800px) {
    .sidebar { position: static; width: auto; }
    .main { margin-left: 0; }
    .grid-3, .grid-4, .grid-2-cards { grid-template-columns: 1fr; }
    .content { padding: 16px; }
}

/* Statistiques / réunion commerciale */
.section-title { margin: 4px 0 12px; font-size: 15px; }
.print-only { display: none; }
@media print {
    .sidebar, .topbar .user, .toolbar, .no-print { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0; }
    .print-only { display: block; }
    .print-only h2 { margin: 0 0 12px; font-size: 18px; }
    body { background: #fff; }
    .card, .tile { break-inside: avoid; box-shadow: none; }
    .meeting-section { break-inside: auto; }
}
.table .col-sep { border-left: 2px solid var(--border); }
.table .group-row td { background: var(--bg); font-weight: 600; color: var(--muted); }
.table tr.row-selected td { background: #eef2fd; }
.commission-head td:nth-child(odd) { color: var(--muted); width: 18%; }
@media print {
    .page-break { break-before: page; }
    .commission-sheet { border: none; padding: 0; }
}
.freeze-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.freeze-bar.is-frozen { border-color: #9cc7ae; background: #f1faf4; }
.freeze-bar .fa-lock { color: var(--success); }
.table tr.line-unpaid td { color: var(--muted); background: #fbfbfd; }
.sort-link { color: inherit; white-space: nowrap; }
.sort-link:hover, .sort-link.is-sorted { color: var(--primary); }

/* Pagination des listes */
.toolbar select.pager-per { min-width: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.pager-pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pager-pages a, .pager-pages span { min-width: 34px; text-align: center; padding: 5px 9px; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text); text-decoration: none; }
.pager-pages a:hover { background: #f1f3f8; }
.pager-pages .is-current { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager-pages .is-disabled { color: var(--muted); opacity: .5; }
.pager-pages .is-gap { border-color: transparent; background: none; }
.nowrap { white-space: nowrap; }
input.is-suggested { background: #fff7e0; border-color: #e0b44c; }

/* Planning de production */
.pill-violet { background: #efe7fd; color: #5b2bb5; }
.pill-teal { background: #dff5f3; color: #0f766e; }
.pill-xs { font-size: 10px; padding: 0 5px; }
.stage-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stage-tiles .tile { padding: 10px 12px; color: inherit; }
.stage-tiles .tile-value { font-size: 22px; }
.stage-tiles .tile.is-selected { border-color: var(--primary); box-shadow: 0 0 0 2px #dfe7fd; }
.stage-tiles .tile-late .tile-value { color: #b42318; }
.planning-card { overflow-x: auto; padding: 10px; }
.plan { table-layout: fixed; min-width: 1300px; }
.plan th { font-size: 11px; white-space: normal; vertical-align: bottom; padding: 8px 5px; }
.plan td { vertical-align: top; font-size: 12.5px; padding: 6px 5px; overflow-wrap: anywhere; }
.plan .pill { font-size: 11px; padding: 2px 7px; }
.plan .week-row td { background: #f1f3f8; font-weight: 600; padding: 6px 10px; }
.plan .week-row.is-late td { background: #fde4e4; color: #b42318; }
.plan .week-n { font-weight: 400; opacity: .7; }
.plan .client { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan .cf-line { line-height: 1.35; margin-bottom: 4px; }
.plan .cf-line .sup { font-weight: 500; }
.plan .cf-line .ref { color: var(--muted); font-size: 12px; }
.plan .cf-line .st { display: block; }
.plan .bl { margin-top: 3px; font-size: 12px; }
.plan .alerts i { margin-right: 5px; font-size: 14px; }
.red { color: #b42318; } .orange { color: #a8620c; }
.plan .cell-input { width: 100%; min-width: 0; padding: 3px 4px; font-size: 12px; border: 1px solid transparent; background: transparent; border-radius: 5px; }
.plan .cell-input:hover { border-color: var(--border); background: #fff; }
.plan .cell-input:focus { border-color: var(--primary); background: #fff; outline: none; }
.plan .cell-dates .cell-input { padding: 1px 2px; }
.plan input.cell-input[type=date]:not(:focus):invalid, .plan input.cell-input[type=date][value=""]:not(:focus) { color: #b8c0d4; }
.plan .tone-green { background: #e3f5eb; color: #16774a; }
.plan .tone-orange { background: #fdf0de; color: #a8620c; }
.plan .tone-red { background: #fde4e4; color: #b42318; }
.plan .tone-blue { background: #e7edfd; color: var(--primary-dark); }
.plan tr.is-saving { opacity: .5; }
.plan tr.is-saved td { background: #eefaf2; transition: background .6s; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 10px 4px 2px; }
/* Planning : vue cartes (2.91.0) — frise des 7 étapes du processus, avancement, détail en accordéon */
.pcards.plan { min-width: 0; table-layout: auto; }
.pcards-tools { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 8px; }
.pweek { font-size: 13px; font-weight: 600; color: var(--muted); margin: 16px 2px 8px; }
.pweek.is-late { color: #b42318; }
.pweek .week-n { font-weight: 400; }
.pcard { background: #fff; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.pcard.is-saving { opacity: .5; }
.pcard.is-saved { box-shadow: 0 0 0 2px #bfe8cf; transition: box-shadow .6s; }
.pcard-head { display: grid; grid-template-columns: 18px minmax(0, 1.6fr) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; }
.pcard-head:hover { background: #fafbfd; }
.pcard-chevron { color: var(--muted); transition: transform .15s; }
.pcard.is-open .pcard-chevron { transform: rotate(90deg); }
.pcard-client { margin-left: 6px; }
.pcard-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-stage { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pcard-stage .alerts i { margin-right: 4px; font-size: 14px; }
.pcard-date { font-size: 13px; text-align: right; }
.pcard-steps { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 2px 14px 10px; }
.pstep { text-align: center; font-size: 12px; color: var(--muted); }
.pstep-label { display: block; }
.pstep-bar { display: block; height: 4px; margin: 7px 0 6px; background: #e3e6ee; }
.pstep:first-child .pstep-bar { border-radius: 2px 0 0 2px; }
.pstep:last-child .pstep-bar { border-radius: 0 2px 2px 0; }
.pstep-icon { font-size: 18px; color: #c4c9d6; }
.pstep .fa-circle { font-size: 10px; margin: 4px 0; }
.pstep-note { display: block; font-size: 11px; color: var(--muted); }
.pstep.is-ok .pstep-bar { background: #2e9e5b; }
.pstep.is-ok .pstep-icon, .pstep-ok { color: #16774a; }
.pstep.is-cur .pstep-bar { background: #f0a030; }
.pstep.is-cur .pstep-icon, .pstep.is-cur .pstep-label, .pstep-cur { color: #c06a0a; }
.pstep.is-late .pstep-bar { background: #e24b4a; }
.pstep.is-late .pstep-icon, .pstep.is-late .pstep-label, .pstep-late { color: #b42318; }
.pstep-todo { color: #c4c9d6; }
.pcard-progress { display: grid; grid-template-columns: 190px minmax(0, 1fr) 46px; align-items: center; gap: 12px; padding: 0 14px 12px; font-size: 12px; color: var(--muted); }
.pbar { height: 6px; border-radius: 3px; background: #e3e6ee; overflow: hidden; }
.pbar span { display: block; height: 100%; background: #2e9e5b; }
.pbar.is-late span { background: #e24b4a; }
.pbar-dates { display: flex; justify-content: space-between; margin-top: 3px; }
.pcard-detail { display: none; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; padding: 12px 14px; border-top: 1px solid var(--border); background: #f8f9fc; font-size: 12.5px; }
.pcard.is-open .pcard-detail { display: grid; }
.pcard-detail label, .pcard-lbl { display: block; color: var(--muted); font-size: 12px; }
.pcard-detail label .cell-input, .pcard-detail > div .cell-input { margin-top: 3px; color: var(--text, #1d2433); }
.pcard-detail .cell-input { border-color: var(--border); }
.pcard-detail .cell-input:not(.tone-green):not(.tone-orange):not(.tone-red):not(.tone-blue) { background: #fff; }
.pcard-cf { grid-column: span 2; }
.pcard-wide { grid-column: 1 / -1; }
.pcard-detail .bl { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
@media (max-width: 900px) {
    .pcard-head { grid-template-columns: 18px minmax(0, 1fr); }
    .pcard-stage, .pcard-date { grid-column: 2; text-align: left; }
    .pcard-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 8px; }
    .pcard-progress { grid-template-columns: minmax(0, 1fr) 46px; }
    .pcard-progress > span:first-child { grid-column: 1 / -1; }
    .pcard-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media print {
    .pcard { break-inside: avoid; }
    .pcard-detail { display: none !important; }
}
@media print {
    .planning-card { overflow: visible; padding: 0; }
    .plan { min-width: 0; font-size: 10px; }
    .plan .cell-input { border: 0; background: none; -webkit-appearance: none; appearance: none; padding: 0; }
}
.plan .cell-input.is-auto { font-style: italic; color: var(--muted); }
.plan .cell-input:disabled { color: inherit; opacity: 1; cursor: default; }

/* Droits des utilisateurs */
.rights-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.rights-groups h3 { margin-top: 0; }
.rights-group { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 7px; color: var(--text); margin-bottom: 2px; }
.rights-group:hover { background: #f1f3f8; }
.rights-group.is-active { background: var(--primary); color: #fff; }
.rights-group.is-active .pill { background: rgba(255,255,255,.25); color: #fff; }
.rights-group .fa-crown { color: #d9a300; font-size: 12px; }
.rights-group.is-active .fa-crown { color: #ffe08a; }
.rights-add { display: flex; gap: 6px; margin-top: 12px; }
.rights-add input { min-width: 0; }
.rights-name { flex-direction: row; align-items: center; gap: 10px; margin: 0; }
.rights-name input { width: 260px; }
.rights-table td, .rights-table th { vertical-align: middle; }
.rights-table .center, .rights-matrix .center { text-align: center; }
.rights-table input[type=checkbox], .rights-matrix input[type=checkbox] { width: 18px; height: 18px; }
.rights-table select { width: auto; min-width: 210px; padding: 5px 8px; }
.small { font-size: 12px; }
#rights-detail.is-muted { opacity: .45; pointer-events: none; }
.rights-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px 24px; }
.rights-options .check { margin: 0; }
.rights-max { flex-direction: row; align-items: center; gap: 10px; margin: 0; font-weight: 400; }
.rights-matrix th { font-size: 12px; }
@media (max-width: 900px) { .rights-layout { grid-template-columns: 1fr; } }

/* Création de tiers */
.tp-nature { display: flex; gap: 24px; align-items: end; flex-wrap: wrap; margin-bottom: 8px; }
.tp-nature label { margin: 0; }
.tp-nature select { min-width: 200px; }
#tp-company.is-private .tp-req { display: none; }
.company-hit { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; }
.company-hit.is-closed { opacity: .6; }
.company-hit .btn { flex-shrink: 0; }
input.is-suggested, select.is-suggested, textarea.is-suggested { background: #fff7e0; border-color: #e0b44c; }
.tp-monaco { display: none; background: #eef4ff; color: var(--text); border: 1px solid #c9d7fb; }
#tp-company.is-monaco .tp-monaco { display: block; }
.tp-monaco .btn { margin-left: 8px; padding: 4px 10px; }
/* Envoi d'un devis par e-mail */
.mail-form .mail-row { display: grid; grid-template-columns: 90px 1fr; gap: 12px; align-items: start; margin-bottom: 10px; }
.mail-form .mail-label { font-weight: 600; padding-top: 7px; color: var(--muted); }
.mail-recipients { display: flex; flex-direction: column; gap: 6px; }
.mail-editor { min-height: 220px; max-height: 480px; overflow: auto; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); line-height: 1.5; }
.mail-editor:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
@media (max-width: 700px) { .mail-form .mail-row { grid-template-columns: 1fr; gap: 4px; } .mail-form .mail-label { padding-top: 0; } }
/* Fiche tiers : onglets, indicateurs, contacts */
.tp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 17px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs .tab { padding: 9px 16px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs .tab:hover { color: var(--text); }
.tabs .tab.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-row .kpi { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.kpi-row .kpi strong { font-size: 20px; }
.btn.btn-sm { padding: 4px 8px; font-size: 12px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions form { margin: 0; }
.grid-4 .span-2 { grid-column: span 2; }
@media (max-width: 700px) { .grid-4 .span-2 { grid-column: auto; } }
a.tp-link { color: inherit; text-decoration: none; }
a.tp-link:hover { color: var(--primary); text-decoration: underline; }
.tp-doc-links { margin-top: 6px; font-size: 13px; }
.tp-doc-links a { white-space: nowrap; }
.tp-payment { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 13px; line-height: 1.6; }
.tp-payment-title { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.grid-4.contact-grid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-4.contact-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .grid-4.contact-grid { grid-template-columns: 1fr; } }
.rights-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rights-main > .card { margin: 0; }
.rights-add-member { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rights-add-member select { width: auto; min-width: 260px; max-width: 100%; }
a.pill { text-decoration: none; }
/* Achats : ticket scanné → facture fournisseur */
.alert-warning { background: #fff7e0; border: 1px solid #f0d58a; color: #7a5200; }
.alert-warning ul { margin: 4px 0 0; padding-left: 20px; }
.scan-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 16px; border: 2px dashed var(--border); border-radius: 12px; text-align: center; cursor: pointer; font-weight: 400; transition: border-color .15s, background .15s; }
.scan-drop:hover, .scan-drop.is-over { border-color: var(--primary); background: #f4f7ff; }
.scan-drop.is-busy { opacity: .6; pointer-events: none; }
.scan-drop .fa-camera { font-size: 30px; color: var(--primary); }
.scan-drop input[type=file] { max-width: 100%; margin-top: 6px; }
.scan-layout { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 16px; align-items: start; }
.scan-preview { position: sticky; top: 16px; margin: 0; }
.scan-preview img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 6px; background: #f1f3f8; }
.scan-preview iframe { width: 100%; height: 70vh; border: 0; border-radius: 6px; }
.scan-preview-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 10px; }
.scan-main { min-width: 0; }
.scan-supplier { margin-bottom: 14px; }
.scan-supplier .small { margin-top: 4px; }
.grid-4.scan-grid { grid-template-columns: 1.3fr 1fr 1fr 1fr; }
.scan-lines select, .scan-lines input { min-width: 0; width: 100%; }
.scan-lines td:nth-child(3) { width: 90px; }
.scan-lines td:nth-child(4) { width: 110px; }
.scan-lines td:nth-child(5) { width: 100px; white-space: nowrap; }
.scan-lines td:last-child { width: 44px; }
.scan-lines input.num { text-align: right; }
@media (max-width: 900px) { .scan-layout { grid-template-columns: 1fr; } .scan-preview { position: static; } .grid-4.scan-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .grid-4.scan-grid { grid-template-columns: 1fr; } .scan-lines thead { display: none; } .scan-lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 0; } .scan-lines td { width: auto !important; border: 0; padding: 0; } .scan-lines td:first-child, .scan-lines td:nth-child(2) { grid-column: span 2; } }
.scan-guest { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; padding: 10px 12px; margin: 4px 0 12px; border-radius: 8px; background: #f7f8fb; }
.scan-guest.is-highlight { background: #eef4ff; border: 1px solid #c9d7fb; }
.scan-guest label { margin: 0; }
@media (max-width: 700px) { .scan-guest { grid-template-columns: 1fr; } }
.text-warning { color: var(--orange); }
.tabs .tab.is-empty { opacity: .55; }
/* Fiche fournisseur : délai et franco, statistiques */
.tp-leadtime { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.tp-leadtime label { margin: 0; }
.tp-leadtime .span-all { grid-column: 1 / -1; }
.tp-leadtime .form-actions { margin: 0; }
.stats-months td, .stats-months th { white-space: nowrap; }
@media (max-width: 560px) { .tp-leadtime { grid-template-columns: 1fr; } }
/* Fiche client : groupe de sociétés */
.tp-group-add { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 12px; align-items: end; margin-top: 14px; }
.tp-group-add label { margin: 0; }
tr.is-current td { background: #f4f7ff; }
.section-title { margin: 22px 0 10px; }
@media (max-width: 700px) { .tp-group-add { grid-template-columns: 1fr; } }
/* Statistiques > Vendeurs : cartes par commercial (4 par rangée) */
.seller-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.seller-card { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.seller-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.seller-card-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.seller-card-kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 4px 0; font-size: 13px; }
.seller-card-kv dt { color: var(--muted); }
.seller-card-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.seller-card .btn { align-self: flex-start; margin-top: auto; }
.seller-sort { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
@media (max-width: 1200px) { .seller-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .seller-cards { grid-template-columns: 1fr; } }
.line-stock { margin-top: 3px; min-height: 0; }
.sale-toggle { margin: 0; }
.seg { display: inline-flex; gap: 4px; }
a.seller-card.tile-link { color: inherit; text-decoration: none; }
a.seller-card.tile-link:hover { border-color: var(--primary); }
/* Texte des lignes de document (description Dolibarr) */
textarea.line-desc { display: block; width: 100%; margin-top: 4px; font: inherit; font-size: .9em; resize: vertical; min-height: 0; }
.line-desc-text { margin-top: 2px; color: var(--muted, #6b7280); font-size: .92em; white-space: normal; }
.line-desc-edit { margin-top: 4px; }
.line-desc-edit .btn { margin-top: 4px; }
/* Quantités modifiables des lignes enregistrées (brouillon) */
input.qty-edit { width: 80px; text-align: right; }
input.qty-edit.is-changed { border: 2px solid var(--primary); background: #f4f7ff; font-weight: 600; }
.toolbar-inline { display: inline-flex; gap: 6px; flex-wrap: wrap; }
/* Formulaires en ligne des fiches (BAT, responsable suivi) */
form.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
form.inline-form select { width: auto; max-width: 100%; }
form.inline-form .small { flex-basis: 100%; }
.line-desc-toggle { display: inline-block; margin-top: 3px; color: var(--muted); text-decoration: none; }
.line-desc-toggle:hover { color: var(--primary); }
textarea.line-desc[hidden], .line-desc-toggle[hidden] { display: none; }
input.qty-edit.is-saving { opacity: .6; }
input.qty-edit.is-saved { border-color: var(--green, #16a34a); background: #effaf3; transition: background .3s; }
/* Crayon d'une ligne enregistrée : prix, remise, texte */
.line-edit-prices { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 4px; }
.line-edit-prices label { display: flex; flex-direction: column; font-size: .85em; color: var(--muted); }
.line-edit-prices input { width: 105px; }
.line-edit-prices input.is-base { border: 2px solid var(--primary); background: #f4f7ff; font-weight: 600; }
.line-edit-prices input[readonly] { background: #f3f4f6; color: var(--muted); }

/* ================================================================ Responsive : tablettes et téléphones (2.33.0)
   ≥ 1024 px : menu latéral fixe (bureau, tablette paysage) ; < 1024 px : menu en tiroir (☰) ;
   < 900 px : éditeur de lignes en cartes ; < 640 px : tableaux de consultation en cartes, saisie au doigt. */

.sidebar { overflow-y: auto; -webkit-overflow-scrolling: touch; z-index: 60; }
.nav-toggle, .nav-close { display: none; border: 0; background: none; color: inherit; font-size: 20px; padding: 6px 10px; cursor: pointer; line-height: 1; }
.nav-close { color: var(--sidebar-text); margin-left: auto; }
.sidebar .brand { display: flex; align-items: center; }
.nav-backdrop { display: none; }
.topbar { gap: 12px; }
.topbar h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-list { min-width: min(320px, calc(100vw - 32px)); }

@media (max-width: 1023px) {
    .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; max-width: 85vw; transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
    body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
    body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,20,35,.45); z-index: 55; }
    body.nav-open { overflow: hidden; }
    .nav-toggle, .nav-close { display: inline-block; }
    .main { margin-left: 0; }
    .topbar { position: sticky; top: 0; z-index: 40; padding: 10px 16px; justify-content: flex-start; }
    .topbar h1 { font-size: 17px; flex: 1; }
    .content { padding: 16px; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
    .sidebar nav a, .nav-group summary { padding: 12px 10px; }
}

@media (max-width: 800px) {
    .sidebar { position: fixed; width: 280px; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* Éditeur de lignes (devis, commandes, factures) en cartes sous 900 px : produit sur toute la largeur, puis les champs. */
@media (max-width: 899px) {
    .table.is-stackable-md thead { display: none; }
    .table.is-stackable-md, .table.is-stackable-md tbody, .table.is-stackable-md tfoot, .table.is-stackable-md tr, .table.is-stackable-md td { display: block; width: 100%; }
    .table.is-stackable-md tbody tr { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; background: #fff; }
    .table.is-stackable-md td { border: 0; padding: 5px 0 5px 40%; position: relative; text-align: left; min-height: 30px; width: 100% !important; }
    .table.is-stackable-md td::before { content: attr(data-label); position: absolute; left: 0; top: 10px; width: 38%; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
    .table.is-stackable-md td[data-label=""], .table.is-stackable-md td.stack-full { padding-left: 0; }
    .table.is-stackable-md td[data-label=""]::before { content: none; }
    .table.is-stackable-md td.stack-full::before { position: static; display: block; width: auto; margin-bottom: 4px; }
    .table.is-stackable-md td.line-tools { text-align: right; }
    .table.is-stackable-md td input, .table.is-stackable-md td select { width: 100%; text-align: left; }
    .table.is-stackable-md tfoot tr { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
    .table.is-stackable-md tfoot td { padding: 4px 0; width: auto !important; text-align: right; }
    .table.is-stackable-md tfoot td::before, .table.is-stackable-md tfoot td:empty { content: none; display: none; }
    .table.is-stackable-md .drag-handle { display: none; }
}

@media (max-width: 639px) {
    body { font-size: 15px; }
    input, select, textarea { font-size: 16px; padding: 10px 12px; } /* 16 px : pas de zoom automatique sur iPhone */
    .btn { padding: 10px 14px; min-height: 42px; }
    .btn-sm { min-height: 36px; }
    .btn-icon { padding: 9px; font-size: 16px; }
    .toolbar { gap: 8px; }
    .toolbar input, .toolbar select { min-width: 0; width: 100%; flex: 1 1 100%; }
    .toolbar .sx { flex: 1 1 100%; width: 100%; } /* 3.10.10 : champ de recherche avec loupe */
    .sx-btn { width: 38px; height: 38px; line-height: 38px; font-size: 17px; }
    .toolbar > .btn, .toolbar > form, .toolbar > a.btn { flex: 0 1 auto; }
    .toolbar [style*="margin-left:auto"] { margin-left: 0 !important; width: 100%; }
    .topbar .user-name { display: none; }
    .card { padding: 14px; border-radius: 10px; }
    .grid-3, .grid-4, .grid-2-cards { grid-template-columns: 1fr; }
    .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
    .tile { padding: 12px; }
    .tile-value { font-size: 20px; }
    .form-actions { justify-content: stretch; }
    .form-actions .btn { flex: 1 1 auto; justify-content: center; }
    .form-actions .check { width: 100%; margin-right: 0; }
    .card-head { align-items: flex-start; }

    /* Tableaux de consultation en cartes : une ligne = une carte, chaque valeur précédée du titre de sa colonne. */
    .table.is-stackable thead { display: none; }
    .table.is-stackable, .table.is-stackable tbody, .table.is-stackable tfoot, .table.is-stackable tr, .table.is-stackable td { display: block; width: 100%; }
    .table.is-stackable tbody tr { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; background: #fff; }
    .table.is-stackable tbody tr:hover { background: #fff; }
    .table.is-stackable td { border: 0; padding: 4px 0 4px 42%; position: relative; text-align: left; white-space: normal; min-height: 26px; width: 100% !important; }
    .table.is-stackable td::before { content: attr(data-label); position: absolute; left: 0; top: 6px; width: 40%; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; line-height: 1.3; }
    .table.is-stackable td[data-label=""], .table.is-stackable td.stack-full { padding-left: 0; }
    .table.is-stackable td[data-label=""]::before { content: none; }
    .table.is-stackable td.stack-full::before { position: static; display: block; width: auto; margin-bottom: 4px; }
    .table.is-stackable td:empty { display: none; }
    .table.is-stackable td[colspan] { padding-left: 0; }
    .table.is-stackable td.line-tools, .table.is-stackable td.num:last-child:has(.btn) { text-align: right; }
    .table.is-stackable tfoot tr { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 4px; }
    .table.is-stackable tfoot td { padding: 4px 0; width: auto !important; text-align: right; }
    .table.is-stackable tfoot td::before, .table.is-stackable tfoot td:empty { content: none; display: none; }
    .table.is-stackable .drag-handle { display: none; }
    .table.is-stackable input.qty-edit { width: 100px; }

    /* Grilles à faire défiler (statistiques, planning…) : défilement horizontal au doigt. */
    .card { -webkit-overflow-scrolling: touch; }
    .table:not(.is-stackable) { min-width: 560px; }
    .table.kv { min-width: 0; }
    .table.kv td:first-child { width: 40%; }
}

/* Cartes : poignée de déplacement masquée (flèches ↑ ↓ conservées), case à cocher en haut à droite de la carte. */
@media (max-width: 899px) {
    .table.is-stackable-md tbody tr { position: relative; }
    .table.is-stackable-md td:has(> .drag-handle:only-child) { display: none; }
    .table.is-stackable-md input[type=checkbox] { width: auto; }
}
@media (max-width: 639px) {
    .table.is-stackable tbody tr { position: relative; }
    .table.is-stackable td:has(> .drag-handle:only-child) { display: none; }
    .table.is-stackable input[type=checkbox] { width: auto; }
    .table.is-stackable td:has(> input.js-sel) { position: absolute; top: 10px; right: 12px; width: auto !important; padding: 0; min-height: 0; }
    .table.is-stackable td.stack-full { padding-right: 34px; }
}

/* Lignes enregistrées (stack-md) sous 900 px : case à cocher en haut à droite, poignée masquée, qté à largeur fixe. */
@media (max-width: 899px) {
    .table.is-stackable-md td:has(> input.js-sel) { position: absolute; top: 10px; right: 12px; width: auto !important; padding: 0; min-height: 0; }
    .table.is-stackable-md td.stack-full { padding-right: 34px; }
    .table.is-stackable-md input.qty-edit { width: 110px; }
    .table.is-stackable-md td:empty { display: none; }
    .table.is-stackable-md td[colspan] { padding-left: 0; }
}
/* Tablette : les champs de l'éditeur de lignes en cartes restent compacts (2 colonnes label / champ plus étroites). */
@media (min-width: 640px) and (max-width: 899px) {
    .table.is-stackable-md td { padding-left: 30%; }
    .table.is-stackable-md td::before { width: 28%; }
    .table.is-stackable-md td input:not([type=checkbox]):not(.ac-input), .table.is-stackable-md td select { max-width: 260px; }
}
/* Droit « Voir les prix de vente » absent : colonnes de prix de l'éditeur de lignes masquées (lib/prices.php). */
.lines-editor.no-prices .price-col { display: none !important; }
/* Crayon d'une ligne enregistrée : PU HT, PU TTC et remise modifiables dans leurs colonnes (2.36.1). */
input.cell-edit { width: 105px; min-width: 0; text-align: right; margin: 0; }
input.cell-edit[hidden] { display: none; }
input.cell-edit.is-base { border: 2px solid var(--primary); background: #f4f7ff; font-weight: 600; }
input.cell-edit[readonly] { background: #f3f4f6; color: var(--muted); }
tr.is-editing > td { background: #f8faff; }
/* Onglet Données : ligne vendue à perte */
tr.line-negative > td { background: #fff5f5; }
/* Signature des BL par le client (2.39.0) : écran pensé pour la tablette. */
.sign-sheet { max-width: 860px; margin: 0 auto 20px; }
.sign-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 8px; }
.sign-head h2 { margin: 2px 0 0; font-size: 24px; }
.sign-client { text-align: right; display: flex; flex-direction: column; font-size: 17px; }
.sign-lines td { font-size: 15px; }
.sign-ack { font-size: 15px; margin: 6px 0 14px; align-items: flex-start; gap: 10px; }
.sign-ack input { width: 22px; height: 22px; flex-shrink: 0; }
.sign-pad-wrap { border: 2px dashed var(--border); border-radius: 12px; padding: 10px; background: #fafbfd; }
.sign-pad-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-weight: 600; }
canvas.sign-pad { display: block; width: 100%; height: 260px; background: #fff; border: 1px solid var(--border); border-radius: 8px; touch-action: none; cursor: crosshair; }
.sign-pad-hint { margin-top: 6px; text-align: center; }
.sign-done-body { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.sign-done-body img { width: 300px; max-width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.sign-done-body > div { flex: 1; min-width: 220px; }
@media (max-width: 639px) { canvas.sign-pad { height: 220px; } .sign-client { text-align: left; } }
/* Adresse de livraison (2.40.0) */
.delivery-box { margin: 4px 0 14px; }
.delivery-new { border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px 2px; margin-top: -6px; background: #fafbfd; }
.delivery-new .span-2 { grid-column: span 2; }
details.delivery-change { margin-top: 6px; }
details.delivery-change > summary { list-style: none; display: inline-flex; }
details.delivery-change > summary::-webkit-details-marker { display: none; }
details.delivery-change[open] > summary { margin-bottom: 8px; }
details.delivery-change form { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #fff; }
@media (max-width: 700px) { .delivery-new .span-2 { grid-column: auto; } }
/* Adresse de livraison : champs en lecture seule (adresse du client ou adresse enregistrée) */
.delivery-new { margin-top: 0; }
.delivery-new.is-readonly { border-style: solid; background: #f6f7fa; }
.delivery-new.is-readonly input[readonly] { background: transparent; border-color: transparent; padding-left: 0; color: var(--text); }
/* En-tête compact des formulaires de création (2.42.0) : grille de 6 colonnes, libellés serrés, bloc adresse de
   livraison fondu dans la grille (display: contents) et détail de l'adresse sur 2 rangées. */
.doc-head { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 14px; margin-bottom: 18px; align-items: end; }
.doc-head label { margin-bottom: 0; gap: 4px; font-size: 13px; min-width: 0; }
.doc-head label > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-head .span-2 { grid-column: span 2; }
.doc-head .delivery-box { display: contents; }
.doc-head .delivery-box > label { grid-column: span 2; }
.doc-head .delivery-new { grid-column: 1 / -1; margin: 0; padding: 8px 12px; }
.doc-head .delivery-new .grid-3 { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px 14px; }
.doc-head .delivery-new label { font-size: 12px; }
.doc-head .delivery-new.is-readonly label > span { color: var(--muted); font-weight: 500; }
.doc-head .delivery-new.is-readonly input[readonly] { padding-top: 2px; padding-bottom: 2px; min-height: 0; height: auto; }
.doc-head .delivery-new .dlv-name, .doc-head .delivery-new .dlv-email { grid-column: span 2; }
.doc-head .delivery-new .dlv-address { grid-column: span 4; }
.doc-head .delivery-new .js-dlv-hint { margin: 6px 0 0; }
@media (max-width: 1100px) {
    .doc-head { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .doc-head .delivery-new .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .doc-head .delivery-new .dlv-name { grid-column: span 1; }
    .doc-head .delivery-new .dlv-address { grid-column: span 2; }
}
@media (max-width: 640px) {
    .doc-head, .doc-head .delivery-new .grid-3 { grid-template-columns: 1fr 1fr; }
    .doc-head .span-2, .doc-head .delivery-box > label,
    .doc-head .delivery-new .dlv-name, .doc-head .delivery-new .dlv-address, .doc-head .delivery-new .dlv-email { grid-column: 1 / -1; }
}
/* Variante commandes / factures (2.42.1) : client sur 3 colonnes, liste « Adresse de livraison » sur 4. */
.doc-head .span-3 { grid-column: span 3; }
.doc-head.dlv-4 .delivery-box > label { grid-column: span 4; }
@media (max-width: 1100px) { .doc-head.dlv-4 .delivery-box > label { grid-column: 1 / -1; } }
@media (max-width: 640px) { .doc-head .span-3 { grid-column: 1 / -1; } }
/* Retrait atelier / livraison commercial (2.43.0) : bloc adresse de livraison masqué, simple mention à la place. */
.delivery-box .dlv-off { display: none; }
.delivery-box.is-off > label, .delivery-box.is-off > .delivery-new { display: none; }
.delivery-box.is-off > .dlv-off { display: block; padding: 8px 0; }
.doc-head .delivery-box > .dlv-off { grid-column: span 2; align-self: center; }
.doc-head.dlv-4 .delivery-box > .dlv-off { grid-column: span 4; }
@media (max-width: 1100px) { .doc-head .delivery-box > .dlv-off { grid-column: 1 / -1; } }
/* Filtres des listes de documents (2.48.0, pages/_list_filters.view.php) : rangée sous la barre d'outils. */
.toolbar .list-filters { flex-basis: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px 12px; align-items: end;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.list-filters label { margin: 0; gap: 3px; font-size: 12px; font-weight: 500; min-width: 0; }
.list-filters label > span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar .list-filters input, .toolbar .list-filters select { min-width: 0; width: 100%; }
.list-filters .lf-tp { grid-column: span 2; }
.list-filters .lf-reset { justify-self: start; }
@media (max-width: 640px) { .list-filters .lf-tp { grid-column: 1 / -1; } .toolbar .list-filters { grid-template-columns: 1fr 1fr; } }

/* Préparation de commandes (2.56.0) */
.prep-bar { display: flex; height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; margin-bottom: 3px; }
.prep-bar-shipped { background: #2f9e62; }
.prep-bar-carton { background: #4f7be8; }
.prep-table .qty-edit { width: 80px; }
.prep-table .prep-carton { width: 70px; }
.prep-table tr.prep-shipped td { color: var(--muted); }
.prep-foot { display: grid; grid-template-columns: 180px 1fr; gap: 12px; margin-top: 12px; }
@media (max-width: 700px) { .prep-foot { grid-template-columns: 1fr; } }
@media print {
    .prep-print-head { margin-bottom: 10px; }
    .prep-table input { border: 0; background: none; padding: 0; width: auto; -webkit-appearance: none; appearance: none; font: inherit; }
    .prep-table { font-size: 12px; }
}
.prep-cartons .prep-carton { width: 80px; }
.prep-cartons .prep-dims { width: 110px; }
.prep-bl { margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.prep-bl h3 { margin-top: 0; }
.prep-svc { margin: 6px 0 10px; }
.prep-foot { grid-template-columns: 1fr; }

/* Catalogues fournisseurs (2.58.0) */
.catalog-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.catalog-color { padding: 4px 10px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); font-size: 13px; text-decoration: none; }
.catalog-color:hover { border-color: var(--primary); }
.catalog-color.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.catalog-color.is-active .muted { color: #e8ecfb; }
.catalog-color.is-hit { border-color: #e0a100; background: #fff8e6; }
.catalog-grid td, .catalog-grid th { padding: 4px 8px; }
.catalog-in { color: #2f9e62; }
.catalog-out { color: var(--muted); }
/* Pilotage > Rentabilité (2.78.0) */
.prof-table { font-size: 13px; }
.prof-table td, .prof-table th { padding: 6px 7px; }
.prof-table td:first-child { white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.prof-grp { cursor: pointer; }
.prof-grp.prof-strong td { font-weight: 600; }
.prof-grp .prof-caret { width: 10px; color: var(--muted); transition: transform .15s; }
.prof-grp.is-open .prof-caret { transform: rotate(90deg); }
.prof-sub td { background: #fafbfd; font-size: 12px; }
.prof-sub td:first-child { padding-left: 24px; }
.prof-total td { background: #eef2ff; font-weight: 700; }
.prof-sub-total td { background: #f6f7fb; font-weight: 600; }
.prof-section td { background: #f1f3f8; font-weight: 700; font-size: 12px; letter-spacing: .03em; color: var(--muted); }
.prof-rate td { font-size: 12px; color: var(--muted); }
.prof-est, .prof-legend { font-style: italic; color: #3b5bdb; }
.prof-part { font-style: italic; }
/* Ventes par famille (2.79.0) */
.fs-table td, .fs-table th { padding: 7px 9px; }
.fs-grp { cursor: pointer; background: #f6f7fb; }
.fs-grp .fs-caret { color: var(--muted); transition: transform .15s; }
.fs-grp.is-open .fs-caret { transform: rotate(90deg); }
.fs-sub td:first-child { padding-left: 28px; }
.fs-total td { background: #eef2ff; font-weight: 600; }
.fs-trend { font-size: 12.5px; }
.fs-trend td, .fs-trend th { padding: 6px 7px; }
.vent-table th.vent-grp { text-align: center; border-bottom: 1px solid var(--border); color: var(--text, #1f2937); }
.vent-table td { line-height: 1.25; }
/* Métiers des clients (2.82.0) */
.trade-chip { display: inline-flex; align-items: center; gap: 4px; margin: 0 4px 4px 0; }
.trade-chip form { display: inline; margin: 0; }
.trade-x { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 2px; font-size: 14px; line-height: 1; opacity: .6; }
.trade-x:hover { opacity: 1; }
/* Groupes clients (2.83.0) */
.cg-table tr.cg-sep td { background: #f1f3f8; padding-top: 7px; padding-bottom: 7px; }
.cg-grid input.cg-rate { width: 56px; text-align: right; }
.cg-grid input.cg-num { width: 90px; text-align: right; }
.cg-grid td:first-child { white-space: nowrap; }
/* Création d'un client (2.85.0) */
.doc-form [hidden], .doc-form label[hidden], .doc-form p[hidden] { display: none !important; }
.tp-choose { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 8px; }
.tp-choice { display: flex; flex-direction: column; gap: 6px; padding: 22px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: inherit; background: #fff; transition: border-color .15s, box-shadow .15s; }
.tp-choice:hover { border-color: var(--primary); box-shadow: 0 0 0 3px #dfe7fd; }
.tp-choice i { font-size: 28px; color: var(--primary); }
.tp-choice strong { font-size: 17px; }
.pill-group { background: #f1e8ff; color: #6b3fb8; text-decoration: none; }
.pill-group:hover { background: #e4d4ff; }

/* Fiche commande : frise du processus (2.91.1) */
.order-flow .pcard-steps, .order-flow .pcard-progress { padding-left: 0; padding-right: 0; }
.order-flow .pcard-progress { padding-bottom: 0; }

/* Configuration > Thèmes (2.93.0) */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 16px; }
.theme-card { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.theme-card.is-active { border-color: var(--success); box-shadow: 0 0 0 2px rgba(30, 158, 90, .25); }
.theme-preview { display: flex; height: 110px; border: 1px solid; border-radius: 8px; overflow: hidden; }
.tp-side { width: 28%; padding: 10px 7px; display: flex; flex-direction: column; gap: 6px; }
.tp-side span { height: 7px; border-radius: 3px; opacity: .9; }
.tp-side span + span { opacity: .45; }
.tp-main { flex: 1; display: flex; flex-direction: column; }
.tp-top { height: 18px; border-bottom: 1px solid; }
.tp-card { margin: 10px; padding: 9px; border: 1px solid; border-radius: 6px; display: flex; flex-direction: column; gap: 6px; }
.tp-card span { height: 6px; border-radius: 3px; }
.theme-info h3 { margin: 0 0 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.theme-info p { margin: 2px 0; }
.theme-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.sidebar .brand .brand-logo { width: 34px; height: 34px; margin-right: 10px; flex: none; }
.login-card .login-logo { display: block; width: 76px; height: 76px; margin: 0 auto 8px; }
/* 3.10.1 : logo complet TELA ERP (symbole + nom) */
.sidebar .brand .brand-wordmark { height: 58px; width: auto; max-width: 170px; margin: -8px auto -8px -6px; flex: none; }
.login-card .login-wordmark { display: block; width: 230px; max-width: 80%; height: auto; margin: 0 auto 14px; }
.login-card .login-head { text-align: center; }
.login-card .login-head h2 { margin: 0 0 10px; }

/* Tableaux de bord par service (2.95.0) */
.dash-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.dash-kpis .tile { color: inherit; gap: 4px; }
.dash-kpis .tile-value { font-size: 24px; }
.dash-gauge { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.dash-gauge span { display: block; height: 100%; background: var(--primary); }
.dash-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.dash-actions-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-actions-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } /* Comptabilité (3.6.0) */
.dash-actions-6 .dash-btn { flex-direction: column; gap: 6px; font-size: 14px; padding: 12px 6px; }
.dash-big-value.dash-big-money { font-size: 32px; white-space: nowrap; }
.dash-actions-6.dash-actions-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); } /* Banque (3.9.0) : 8 actions */
@media (max-width: 1100px) { .dash-actions-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .dash-actions-6, .dash-actions-6.dash-actions-8 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-big-value.dash-big-money { font-size: 24px; } }
.dash-btn { justify-content: center; padding: 15px 12px; font-size: 16px; font-weight: 600; border-radius: 10px; }
.dash-btn i { font-size: 19px; }
.dash-btn-outline { border: 2px solid var(--primary); color: var(--primary); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 0 18px; }
.dash-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-grid .card, .dash-split .card { margin-bottom: 18px; }
.dash-grid .table td, .dash-split .table td { padding: 7px 6px; }
.dash-big { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.dash-big-tile { flex-direction: row; justify-content: space-between; align-items: center; padding: 18px 22px; color: inherit; }
.dash-big-tile.is-selected { border-color: var(--primary); box-shadow: 0 0 0 2px #dfe7fd; }
.dash-big-tile .pill { font-size: 13px; padding: 3px 10px; }
.dash-big-tile small { display: block; color: var(--muted); font-size: 12px; margin-top: 7px; }
.dash-big-value { font-size: 46px; font-weight: 700; line-height: 1; }
.dash-red { color: #b42318; } .dash-orange { color: #a8620c; } .dash-blue { color: var(--primary-dark); } .dash-green { color: #16774a; }
.dash-violet { color: #5b2bb5; } .dash-teal { color: #0f766e; } .dash-grey { color: var(--text); }
.dash-urgent { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid #f3c7c7; border-left: 4px solid var(--danger); border-radius: 0 10px 10px 0; padding: 11px 16px; margin-bottom: 18px; }
.dash-urgent > i { color: var(--danger); font-size: 18px; }
.dash-urgent a { margin-left: auto; }
.dash-split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }
.dash-bar { display: grid; grid-template-columns: 110px minmax(0, 1fr) 30px; gap: 10px; align-items: center; margin: 7px 0; font-size: 13px; }
.dash-bar-track { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.dash-bar-track span { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.dash-days { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; text-align: center; }
.dash-day { border: 1px solid var(--border); border-radius: 9px; padding: 9px 4px; color: inherit; }
.dash-day b { display: block; font-size: 24px; margin-top: 2px; }
.dash-day.is-today { border-color: var(--primary); background: #f4f7ff; }
.dash-day.is-late { border-color: #f3c7c7; background: #fff6f6; }
.dash-day.is-late b { color: #b42318; }
.objectives input { width: 82px; text-align: right; padding: 5px 6px; }
@media (max-width: 1100px) {
    .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-split, .dash-grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
    .dash-big { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-big-value { font-size: 34px; }
    .dash-big-tile { padding: 14px 16px; }
    .dash-actions, .dash-actions-3 { grid-template-columns: minmax(0, 1fr); }
    .dash-days { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
/* Tableau de bord Commercial : commandes en cours avec la frise du planning (2.96.1) */
.dash-order .pcard-head { color: inherit; text-decoration: none; }
.dash-order .ref { color: var(--primary); }
.dash-order:last-of-type { margin-bottom: 8px; }

/* Fiche produit (2.99.0) */
.pc-head { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.pc-photo { width: 96px; height: 96px; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 34px; overflow: hidden; }
.pc-photo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.pc-id h2 { margin: 0 0 2px; font-size: 20px; }
.pc-pills { margin-top: 7px; display: flex; gap: 4px; flex-wrap: wrap; }
.pc-price { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.pc-price strong { font-size: 22px; }
.pc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 18px; align-items: start; }
.card.is-editing { border-color: var(--primary); box-shadow: 0 0 0 2px #dfe7fd; }
.pc-form label { margin-bottom: 10px; }
.pc-form .form-actions { justify-content: flex-end; gap: 8px; }
.pc-2 { display: grid; grid-template-columns: minmax(0, 1fr) 90px; gap: 8px; }
.pc-checks { display: flex; gap: 18px; margin-bottom: 12px; }
.pc-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; align-items: end; }
.pc-row .form-actions { grid-column: 1 / -1; }
.pc-inline { margin-top: 10px; }
.pc-stock { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; text-align: center; margin-bottom: 8px; }
.pc-stock div { border: 1px solid var(--border); border-radius: 8px; padding: 8px 4px; }
.pc-stock b { display: block; font-size: 20px; margin-top: 2px; }
.pc-variants { font-size: 13px; margin: 5px 0; line-height: 1.6; }
tr.is-editing td { background: #f8f9fc; }
@media (max-width: 900px) {
    .pc-grid { grid-template-columns: minmax(0, 1fr); }
    .pc-head { grid-template-columns: 64px minmax(0, 1fr); }
    .pc-photo { width: 64px; height: 64px; font-size: 24px; }
    .pc-price { grid-column: 1 / -1; text-align: left; }
    .pc-stock { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.pc-catbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: #fff7f7; border: 1px solid #f3c7c7; border-radius: 8px; padding: 9px 12px; margin: 0 0 12px; }
.pc-catbar button { margin-left: auto; }

/* Délai de fabrication (3.0.0) : bandeau des commandes EXPRESS / RUSH (tableaux de bord), cartes du planning, lignes verrouillées. */
.dash-delai { border: 2px solid var(--danger); margin-bottom: 16px; }
.dash-delai.is-empty { border: 1px solid var(--border); }
.dash-delai-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.dash-delai-head h3 { margin: 0; color: var(--danger); }
.dash-delai.is-empty .dash-delai-head h3 { color: inherit; }
.dash-delai-head a { margin-left: auto; }
.dash-delai-table td { vertical-align: middle; }
.dash-delai-table tr.delai-rush td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.dash-delai-table tr.delai-express td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
.delai-pill { white-space: nowrap; }
.pcard.delai-rush { border-left: 4px solid var(--danger); }
.pcard.delai-express { border-left: 4px solid var(--orange); }
.delai-tile-rush { border-color: #f3c7c7; }
.delai-tile-express { border-color: #f6dcb5; }
tr.line-delai td { background: #fff8ec; }

/* Envoi du devis par WhatsApp (3.0.9) : panneau sous le bouton. */
.wa-send { position: relative; display: inline-block; }
.wa-send > summary { list-style: none; cursor: pointer; }
.wa-send > summary::-webkit-details-marker { display: none; }
.wa-panel { position: absolute; right: 0; z-index: 30; width: min(440px, 92vw); margin-top: 6px; display: grid; gap: 8px; text-align: left; box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.wa-panel textarea { width: 100%; }

/* Grosses icônes d'actions des fiches (3.0.10) : devis, commandes, factures, commandes et factures fournisseurs, BL, BP,
   réceptions. Les boutons de la barre (formulaires et liens existants, mêmes confirmations et mêmes droits) deviennent des
   tuiles façon application ; couleur selon l'icône de l'action. Le bouton retour et les panneaux ouverts gardent leur style. */
.toolbar-icons { align-items: flex-start; }
.toolbar-icons .btn { flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; width: 86px; min-height: 0; padding: 2px; background: none; border: 0; box-shadow: none;
    color: var(--text); font-size: 12px; font-weight: 500; line-height: 1.2; white-space: normal; text-align: center; }
.toolbar-icons .btn > i { width: 58px; height: 58px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 27px; color: #fff; background: #888780; margin: 0; transition: transform .12s, filter .12s; }
.toolbar-icons .btn:hover { background: none; }
.toolbar-icons .btn:hover > i { transform: translateY(-2px); filter: brightness(1.08); }
.toolbar-icons .btn:disabled > i, .toolbar-icons .btn[disabled] > i { opacity: .45; }
/* exceptions : bouton retour, boutons des panneaux (WhatsApp…), petits boutons */
.toolbar-icons > a.btn:first-child, .toolbar-icons .card .btn, .toolbar-icons .btn-sm { flex-direction: row; width: auto; gap: 6px; padding: 8px 14px; border: 1px solid var(--border); background: var(--surface); font-weight: 500; }
.toolbar-icons > a.btn:first-child > i, .toolbar-icons .card .btn > i, .toolbar-icons .btn-sm > i { width: auto; height: auto; font-size: inherit; background: none; color: inherit; border-radius: 0; }
.toolbar-icons .card .btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
/* couleurs par famille d'action */
.toolbar-icons .btn > i.fa-check, .toolbar-icons .btn > i.fa-circle-check, .toolbar-icons .btn > i.fa-thumbs-up, .toolbar-icons .btn > i.fa-check-double, .toolbar-icons .btn > i.fa-file-signature { background: #639922; }
.toolbar-icons .btn > i.fa-signature { background: #378ADD; }
.toolbar-icons .btn > i.fa-envelope, .toolbar-icons .btn > i.fa-paper-plane { background: #D85A30; }
.toolbar-icons .btn > i.fa-whatsapp { background: #25D366; }
.toolbar-icons .btn > i.fa-cart-shopping, .toolbar-icons .btn > i.fa-cart-plus { background: #7F77DD; }
.toolbar-icons .btn > i.fa-file-pdf, .toolbar-icons .btn > i.fa-file-arrow-down { background: #E24B4A; }
.toolbar-icons .btn > i.fa-trash { background: #A32D2D; }
.toolbar-icons .btn > i.fa-truck, .toolbar-icons .btn > i.fa-truck-fast, .toolbar-icons .btn > i.fa-flag-checkered, .toolbar-icons .btn > i.fa-dolly, .toolbar-icons .btn > i.fa-boxes-packing, .toolbar-icons .btn > i.fa-truck-ramp-box { background: #1D9E75; }
.toolbar-icons .btn > i.fa-box-open, .toolbar-icons .btn > i.fa-box, .toolbar-icons .btn > i.fa-tags { background: #BA7517; }
.toolbar-icons .btn > i.fa-file-invoice-dollar, .toolbar-icons .btn > i.fa-file-invoice, .toolbar-icons .btn > i.fa-euro-sign, .toolbar-icons .btn > i.fa-credit-card, .toolbar-icons .btn > i.fa-money-bill { background: #185FA5; }
.toolbar-icons .btn > i.fa-arrow-up-right-from-square, .toolbar-icons .btn > i.fa-up-right-from-square { background: #534AB7; }
@media (max-width: 640px) { .toolbar-icons .btn { width: 74px; font-size: 11px; } .toolbar-icons .btn > i { width: 50px; height: 50px; font-size: 23px; border-radius: 14px; } }
.doc-side { margin-top: 10px; }
/* Action impossible (3.0.13, ex. « Non supprimable ») : icône grisée, raison au survol. */
.btn.is-disabled { cursor: not-allowed; opacity: .6; }
.toolbar-icons .btn.is-disabled { opacity: 1; color: var(--muted); }
.toolbar-icons .btn.is-disabled > i { opacity: .4; }
.toolbar-icons .btn.is-disabled:hover > i { transform: none; filter: none; }

/* Fenêtre « Ajouter un marquage » (3.1.0) */
.mk-bar { margin: 0 0 10px; }
.mk-dialog { border: 0; border-radius: 14px; padding: 0; width: min(720px, 96vw); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.mk-dialog::backdrop { background: rgba(20, 24, 36, .45); }
.mk-form { padding: 18px 20px; }
.mk-top { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.mk-top strong { font-size: 17px; margin-right: auto; }
.mk-toggle { display: flex; border: 1px solid var(--border); border-radius: 20px; overflow: hidden; }
.mk-toggle button { border: 0; background: none; padding: 7px 18px; font: inherit; font-weight: 500; cursor: pointer; }
.mk-toggle button.on { background: #639922; color: #fff; }
.mk-sec { font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.mk-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.mk-pos { width: 96px; border: 1px solid var(--border); border-radius: 10px; padding: 6px; text-align: center; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.mk-pos b { display: block; font-size: 13px; color: var(--text); }
.mk-pos svg { width: 70px; height: 70px; display: block; margin: 0 auto 4px; }
.mk-pos.on { border: 2px solid #639922; padding: 5px; background: #f3f8ec; }
.mk-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-top: 14px; }
.mk-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.mk-row input[type=number] { width: 120px; }
.mk-wide { flex: 1; min-width: 220px; }
.mk-res { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 8px; font-size: 13px; }
.mk-ln { display: grid; grid-template-columns: minmax(0, 1fr) 120px 90px; gap: 8px; padding: 4px 0; }
.mk-ln span:nth-child(n+2) { text-align: right; }
.mk-tot { border-top: 1px solid var(--border); font-weight: 600; }
.mk-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.alert-info { background: #e8f2fc; border: 1px solid #b5d4f4; color: #0c447c; } /* 3.13.4 : information (opération du relevé liée) */
/* 3.14.0 : mandats de prélèvement SEPA (fiche client, page publique sepa_sign) */
.sm-new { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.sm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.sm-grid .span-all { grid-column: 1 / -1; }
.sm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.sm-main { min-width: 0; flex: 1 1 320px; }
.sm-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sm-sheet .sm-kv { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 4px 12px; margin: 8px 0 14px; }
.sm-sheet .sm-legal { font-size: 13px; color: var(--muted); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; line-height: 1.5; }
@media (max-width: 600px) { .sm-sheet .sm-kv { grid-template-columns: 1fr; } }
/* 3.17.0 : remise volume (fiche devis / commande) */
.remvol-info { margin-top: 4px; line-height: 1.6; }
.remvol-bar { height: 6px; background: #eef0f3; border-radius: 3px; overflow: hidden; margin: 4px 0; max-width: 360px; }
.remvol-bar span { display: block; height: 100%; background: var(--success); }
.remvol-bar span.over { background: var(--danger); }
.btn-icon.is-on { color: var(--primary); }
.stat { background: #f6f7f9; border-radius: 8px; padding: 10px 12px; }
.stat strong { font-size: 1.1em; }
.gift-panel { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: baseline; background: #f1f8f4; border-radius: 8px; padding: 10px 14px; margin-top: 10px; }
.mk-items { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.mk-item { display: flex; align-items: center; gap: 8px; background: #f3f0fb; border-radius: 8px; padding: 6px 10px; }
.mk-item span { flex: 1; }
/* 3.39.0 : lignes « inclus dans le pack » (éditeur de lignes) */
.lines-editor tr.line-pack-item td { background: #f6f8fc; }
.lines-editor tr.line-pack-item .ac-input { padding-left: 22px; }
