/* =====================================================================
   MAGIC COPIEUR — bons de vente / d'approvisionnement, actions principales
   ===================================================================== */

/* Sélecteur Articles / Bon de vente (mobile et tablette) */
.pos-switch { display: flex; width: 100%; margin-bottom: 12px; position: sticky; top: calc(var(--hdr) + 54px); z-index: 20; box-shadow: var(--shadow); }
.pos-switch button { flex: 1; height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 13.5px; }
.pos-switch button .svg-i { width: 17px; height: 17px; }
.cnt-badge:not(:empty) { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
@media (max-width: 1023px) {
  .pos[data-view="articles"] .cart-col { display: none; }
  .pos[data-view="bon"] .pos-cat { display: none; }
}
@media (min-width: 1024px) { .pos-switch { display: none; } }
.pos > * { min-width: 0; }

/* Bon (vente / approvisionnement) */
.bon { padding: 0; overflow: hidden; }
.bon > *:not(.bon-h):not(.bon-lines) { margin-left: 14px; margin-right: 14px; }
.bon > .total-box { margin-bottom: 0; }
.bon > #pay, .bon > .btn-lg:last-child { margin-bottom: 14px; width: calc(100% - 28px); }
.bon-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px; background: linear-gradient(120deg, var(--tint-blue), transparent); border-bottom: 1px solid var(--line); }
.bon-t { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; color: var(--navy); }
:root[data-theme="dark"] .bon-t { color: #fff; }
.bon-t .svg-i { color: var(--blue); }
.bon-lines { padding: 4px 14px 0; }
.bon-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto; grid-template-areas: "nom nom nom del" "qte pu tot tot"; gap: 8px 10px; padding: 12px 0; border-bottom: 1px dashed var(--line-2); animation: up .25s both; align-items: end; }
.bon-line .bl-nom { grid-area: nom; display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 13.5px; }
.bon-line .bl-del { grid-area: del; width: 34px; height: 34px; color: var(--muted); align-self: start; }
.bon-line .bl-del:hover { color: var(--red); background: var(--tint-red); }
.bon-line .bl-c { display: grid; gap: 3px; min-width: 0; }
.bon-line .bl-c small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.bon-line .bl-c b { font-size: 14px; height: 32px; display: flex; align-items: center; }
.bon-line .bl-q { grid-area: qte; }
.bon-line .bl-p { grid-area: pu; }
.bon-line .bl-tot { grid-area: tot; text-align: right; justify-items: end; }
.bon-line .bl-tot b { color: var(--blue); }
.bon-line .qty { width: fit-content; }
.bon-line .qty input { width: 38px; }
.bl-pu { height: 32px !important; padding: 0 8px !important; font-size: 13px !important; max-width: 110px; }

/* Lignes d'approvisionnement */
.appro-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: center; animation: up .25s both; }
.appro-line:last-child { border-bottom: 0; }
.appro-line .al-fields { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1.3fr 1.3fr; gap: 8px; }
.appro-line .al-fields label { display: grid; gap: 3px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.appro-line .al-fields .input { height: 40px; }
.appro-line .al-tot { display: flex; flex-direction: column; justify-content: flex-end; }
.appro-line .al-tot b { height: 40px; display: flex; align-items: center; justify-content: flex-end; font-size: 14px; color: var(--green); }

/* Bandeaux d'action en tête de page */
.cta { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r-lg); color: #fff; margin-bottom: 14px; transition: transform .15s; box-shadow: 0 14px 26px -14px var(--c); background: linear-gradient(120deg, var(--c2), var(--c)); width: 100%; text-align: left; }
.cta:hover { transform: translateY(-2px); }
.cta .cta-ic { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 255, 255, .22); flex: none; }
.cta .cta-ic .svg-i { width: 28px; height: 28px; }
.cta b { font-size: 16px; display: block; }
.cta small { opacity: .9; font-size: 12px; }
.cta-row { display: grid; gap: 10px; margin-bottom: 14px; }
.cta-row .cta { margin: 0; }
@media (min-width: 720px) { .cta-row { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }

/* Barre du bas : bouton central « Vendre » */
.bn-item.center { position: relative; }
.bn-item.center .bn-fab { width: 56px; height: 56px; margin-top: -26px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--orange-2), var(--orange)); box-shadow: 0 10px 20px -8px var(--orange), 0 0 0 5px var(--card); transition: transform .2s; }
.bn-item.center .bn-fab .svg-i { width: 27px; height: 27px; transform: none !important; }
.bn-item.center:active .bn-fab { transform: scale(.92); }
.bn-item.center span:last-child { margin-top: 1px; color: var(--orange); font-weight: 700; }
.bn-item.center.on::before { display: none; }

/* Accès rapide : 2 rangées */
.quick.quick-8 { grid-template-columns: repeat(4, 1fr); }
@media (min-width: 720px) { .quick.quick-8 { grid-template-columns: repeat(8, 1fr); max-width: none; } }
.quick-8 .q-tile { font-size: 11px; }
.quick-8 .q-tile .svg-i { width: 28px; height: 28px; }
.features > * { min-width: 0; overflow-wrap: anywhere; }
.bon > .btn-block, .bon > .li, .bon > .pay-modes, .bon > .grid-2, .bon > .total-box { width: auto; }
.bon > .btn-block { display: flex; }

/* Permissions à 3 niveaux (fiche utilisateur) */
.perm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 10px; }
.perm-level { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 10px; background: var(--card); }
.perm-lh { display: flex; align-items: center; gap: 10px; padding: 11px 12px; background: var(--tint); cursor: pointer; border-bottom: 1px solid var(--line); }
.perm-lh b { display: block; font-size: 13.5px; color: var(--c); }
.perm-lh small { display: block; font-size: 11.5px; color: var(--muted); }
.perm-badge { width: 28px; height: 28px; flex: none; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800; background: var(--c); box-shadow: 0 4px 10px -4px var(--c); }
.perm-count { font-size: 12px; font-weight: 700; color: var(--c); min-width: 34px; text-align: right; }
.perm-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; font-size: 13px; transition: background .15s; }
.perm-row + .perm-row { border-top: 1px dashed var(--line); }
.perm-row:hover { background: var(--card-2); }
.perm-row input { position: absolute; opacity: 0; pointer-events: none; }
.perm-box { width: 22px; height: 22px; flex: none; border-radius: 7px; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; transition: .15s; }
.perm-box .svg-i { width: 14px; height: 14px; stroke-width: 3; }
.perm-row input:checked + .perm-box { background: var(--c); border-color: var(--c); color: #fff; }
.perm-row input:focus-visible + .perm-box { box-shadow: var(--ring); }
.perm-list { display: flex; flex-wrap: wrap; gap: 6px; }
/* Barre de période (rapports, dépenses) */
.pbar { display: grid; gap: 10px; margin-bottom: 14px; }
.pbar-tabs .tab .svg-i { width: 15px; height: 15px; }
.pbar-nav { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.pbar-nav .input { height: 40px; flex: 1; }
.pbar-nav .icon-btn { background: var(--card-2); }
.pbar-nav .icon-btn[disabled] { opacity: .35; pointer-events: none; }
.pbar-label { flex: 1; text-align: center; min-width: 0; }
.pbar-label b { display: block; font-size: 15px; color: var(--navy); }
:root[data-theme="dark"] .pbar-label b { color: #fff; }
.pbar-label small { font-size: 11.5px; color: var(--muted); }

/* Dépenses */
.dep-row { display: flex; align-items: center; gap: 12px; }
.dep-acts { display: flex; gap: 2px; flex: none; }
.dep-acts .icon-btn { width: 36px; height: 36px; color: var(--muted); }
.dep-acts .icon-btn:hover { background: var(--card-2); color: var(--blue); }
.dep-acts .icon-btn.del:hover { background: var(--tint-red); color: var(--red); }
.nat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.nat { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 6px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--card); font-size: 11.5px; font-weight: 600; color: var(--ink-2); text-align: center; transition: .15s; }
.nat .svg-i { width: 22px; height: 22px; color: var(--c); }
.nat.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--card)); color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.crud-bar { display: flex; flex-wrap: wrap; gap: 8px; }
/* Carrousel enrichi : photo plein cadre, montages, boutons d'action */
.carousel { aspect-ratio: 16 / 8; max-height: 340px; }
@media (min-width: 1024px) { .carousel { aspect-ratio: 16 / 6; } }
.slide-p, .slide-c { position: relative; height: 100%; overflow: hidden; color: #fff; }
.slide-p .sp-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; transform: scale(1.03); transition: transform 7s ease-out; }
.car-slide.act .sp-bg { transform: scale(1.15); }
.slide-p::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(4, 12, 40, .93) 0%, rgba(4, 12, 40, .72) 42%, rgba(4, 12, 40, .08) 100%); }
.sp-txt, .sc-txt { position: absolute; inset: 0; z-index: 2; padding: 14px 18px; display: flex; flex-direction: column; justify-content: center; gap: 6px; max-width: 64%; }
.sc-txt { max-width: 58%; }
.sp-kick { display: inline-flex; align-items: center; gap: 6px; width: fit-content; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 4px 10px; border-radius: 99px; background: rgba(245, 124, 0, .92); }
.sp-kick .svg-i { width: 13px; height: 13px; }
.sp-txt h3, .sc-txt h3 { font-size: clamp(16px, 4.6vw, 30px); font-weight: 800; line-height: 1.1; margin: 0; }
.sp-txt p, .sc-txt p { font-size: clamp(11px, 3vw, 14.5px); opacity: .9; margin: 0; }
.s-cta { display: inline-flex; align-items: center; gap: 4px; width: fit-content; margin-top: 4px; padding: 7px 14px; border-radius: 99px; background: #fff; color: var(--acc-2); font-weight: 700; font-size: 12.5px; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .5); transition: transform .15s; }
.s-cta:hover { transform: translateX(3px); }
.s-cta .svg-i { width: 15px; height: 15px; }
.car-slide.act .sp-txt > *, .car-slide.act .sc-txt > * { animation: up .6s both; }
.car-slide.act .sp-txt > *:nth-child(2), .car-slide.act .sc-txt > *:nth-child(2) { animation-delay: .08s; }
.car-slide.act .sp-txt > *:nth-child(3), .car-slide.act .sc-txt > *:nth-child(3) { animation-delay: .16s; }
.car-slide.act .sp-txt > *:nth-child(4), .car-slide.act .sc-txt > *:nth-child(4) { animation-delay: .24s; }
/* Montage de copieurs */
.sc-imgs { position: absolute; right: 2%; top: 0; bottom: 0; width: 46%; }
.sc-imgs img { position: absolute; bottom: 7%; height: 82%; width: auto; max-width: 48%; object-fit: contain; border-radius: 14px; background: #fff; padding: 4px;
  box-shadow: 0 16px 30px -12px rgba(0, 0, 0, .65); left: calc(var(--i) * 27%); transform: rotate(calc((var(--i) - 1) * 4deg)); z-index: calc(3 - var(--i)); }
.sc-imgs img:nth-child(2) { height: 92%; bottom: 3%; z-index: 5; }
.car-slide.act .sc-imgs img { animation: scIn .8s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i) * 140ms); }
@keyframes scIn { from { opacity: 0; transform: translateY(30px) scale(.85); } }
/* Grille de consommables */
.sc-grid { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; width: min(40%, 230px); z-index: 1; }
.sc-grid img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #fff; border-radius: 12px; padding: 5px; box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .55); }
.car-slide.act .sc-grid img { animation: scIn .7s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i) * 110ms); }

/* Bandeaux illustrés (maintenance, approvisionnement) */
.new-inter-cta.photo { position: relative; overflow: hidden; background: linear-gradient(90deg, rgba(154, 52, 18, .96) 0%, rgba(245, 124, 0, .88) 55%, rgba(245, 124, 0, .25) 100%), url("../img/carrousel/maintenance.jpg") right center / cover no-repeat; min-height: 96px; }
.cta-imgs { display: flex; margin-left: auto; flex: none; }
.cta-imgs img { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; margin-left: -10px; box-shadow: 0 6px 12px -6px rgba(0, 0, 0, .5); border: 2px solid rgba(255, 255, 255, .7); }
@media (max-width: 420px) { .cta-imgs img:nth-child(n+3) { display: none; } }.sp-kick { white-space: nowrap; }
.car-dots { left: auto; right: 14px; justify-content: flex-end; }
@media (max-width: 640px) {
  .carousel { aspect-ratio: 16 / 10.5; }
  .sp-txt, .sc-txt { max-width: 80%; padding: 12px 14px 24px; gap: 4px; }
  .sc-txt { max-width: 60%; }
  .sp-kick { font-size: 9.5px; padding: 3px 8px; letter-spacing: .04em; }
  .sp-txt h3, .sc-txt h3 { font-size: 18px; }
  .sp-txt p, .sc-txt p { font-size: 11.5px; }
  .s-cta { padding: 6px 12px; font-size: 11.5px; }
  .sc-imgs { width: 44%; }
  .sc-grid { width: 36%; gap: 5px; }
}.sc-imgs img { max-width: none; width: auto; aspect-ratio: auto; object-fit: contain; }
@media (max-width: 640px) {
  .sc-imgs { width: 48%; right: 0; }
  .sc-imgs img { height: 74%; bottom: 10%; }
  .sc-imgs img:nth-child(2) { height: 84%; bottom: 6%; }
  .sc-imgs img:nth-child(3) { display: none; }
  .sc-imgs img:nth-child(1) { left: 2%; }
  .sc-imgs img:nth-child(2) { left: 34%; }
}
/* ---------- Matrice des droits d'accès (v1.7) ---------- */
.pm-zone { --pm-w: 52px; }
.pm-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pm-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.pm-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 99px; font-size: 12px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.pm-pill i, .pm-legend i { width: 20px; height: 20px; border-radius: 7px; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 800; color: #fff; background: var(--c); }
.pm-risk { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 99px; }
.pm-risk .svg-i { width: 15px; height: 15px; }
.pm-risk.lo { color: #16a34a; background: var(--tint-green); }
.pm-risk.mid { color: #d97706; background: var(--tint-amber); }
.pm-risk.hi { color: #e11d48; background: var(--tint-red); }
.pm-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.pm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pm-legend i { width: 16px; height: 16px; font-size: 10px; border-radius: 5px; }
.pm-table { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); margin-bottom: 12px; }
.pm-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(4, var(--pm-w)); align-items: center; gap: 4px; padding: 6px 8px; }
.pm-row + .pm-row { border-top: 1px solid var(--line); }
.pm-th { background: var(--card-2); padding-top: 8px; padding-bottom: 8px; }
.pm-mod { display: flex; align-items: center; gap: 9px; min-width: 0; background: none; border: 0; padding: 4px; text-align: left; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); border-radius: 10px; }
button.pm-mod { cursor: pointer; }
button.pm-mod:hover { background: var(--card-2); }
.pm-mod-h { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pm-mod-ic { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.pm-mod-ic .svg-i { width: 17px; height: 17px; }
.pm-mod-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-mod.on .pm-mod-ic { color: #fff; background: var(--c); }
.pm-col { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; padding: 4px 0; border-radius: 10px; color: var(--muted); font: inherit; }
.pm-col .svg-i { width: 17px; height: 17px; }
.pm-col small { font-size: 10px; font-weight: 700; }
button.pm-col { cursor: pointer; }
button.pm-col:hover, .pm-col.on { color: var(--blue); background: var(--tint-blue); }
.pm-cell { position: relative; justify-self: center; width: 40px; height: 40px; cursor: pointer; }
.pm-cell input { position: absolute; opacity: 0; pointer-events: none; }
.pm-cell > span { width: 100%; height: 100%; border-radius: 12px; display: grid; place-items: center; border: 2px dashed var(--line-2); color: var(--line-2); transition: transform .15s, background .15s, border-color .15s, color .15s; }
.pm-cell > span .svg-i { width: 18px; height: 18px; }
.pm-cell:hover > span { border-color: var(--c); color: var(--c); }
.pm-cell input:checked + span { border: 2px solid var(--c); background: var(--c); color: #fff; box-shadow: 0 6px 14px -8px var(--c); }
.pm-cell input:active + span { transform: scale(.92); }
.pm-cell input:focus-visible + span { box-shadow: var(--ring); }
.pm-cell i { position: absolute; right: -3px; top: -3px; width: 15px; height: 15px; border-radius: 5px; display: grid; place-items: center; font-style: normal; font-size: 9px; font-weight: 800; color: #fff; background: var(--c); border: 2px solid var(--card); }
.pm-cell.ro { cursor: default; }
.pm-cell.ro > span { border-style: solid; border-color: transparent; background: var(--card-2); color: var(--line-2); }
.pm-cell.ro.on > span { background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); }
.pm-na { justify-self: center; color: var(--line-2); }
.pm-group { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); margin-bottom: 12px; }
.pm-gh { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 13px; font-weight: 700; background: var(--card-2); border-bottom: 1px solid var(--line); }
.pm-gh .svg-i { width: 16px; height: 16px; color: var(--muted); }
.pm-gh small { margin-left: auto; font-weight: 600; font-size: 11px; color: var(--muted); }
.pm-group.sens { border-color: color-mix(in srgb, #e11d48 35%, var(--line)); }
.pm-group.sens .pm-gh { background: var(--tint-red); color: #e11d48; }
.pm-group.sens .pm-gh .svg-i { color: #e11d48; }
.pm-sp { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; }
.pm-sp + .pm-sp { border-top: 1px dashed var(--line); }
.pm-sp:hover { background: var(--card-2); }
.pm-sp-ic { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.pm-sp-ic .svg-i { width: 16px; height: 16px; }
.pm-sp-t { flex: 1; min-width: 0; }
.pm-sp-t b { display: block; font-size: 13px; }
.pm-sp-t small { display: block; font-size: 11.5px; color: var(--muted); }
.pm-sp.ro { cursor: default; opacity: .5; }
.pm-sp.ro.on { opacity: 1; }
.pm-sp.ro:hover { background: none; }
.pm-ok { color: var(--line-2); display: grid; }
.pm-sp.ro.on .pm-ok { color: var(--c); }
@media (max-width: 420px) {
  .pm-zone { --pm-w: 42px; }
  .pm-cell { width: 36px; height: 36px; }
  .pm-mod-ic { width: 26px; height: 26px; }
  .pm-mod { font-size: 12px; gap: 6px; }
  .pm-col small { font-size: 9.5px; }
  .pm-col small span { display: none; }
  .pm-col small::after { content: attr(data-s); }
}
