/* ==========================================================================
   NOURZAYTOUN — Feuille de style de l'outil de gestion
   ========================================================================== */

:root{
  --olive-900:#26301a; --olive-800:#33421f; --olive-700:#425427; --olive-600:#556b31;
  --olive-500:#6b8340; --olive-400:#8aa15c; --olive-300:#b0c088; --olive-100:#e5ecd6;
  --or-600:#a8811a; --or-500:#c9a227; --or-300:#e7cf7d; --or-100:#f6edd0;
  --terre:#8c5a3c;

  --bg:#f7f6f1; --surface:#ffffff; --surface-2:#fbfaf6; --line:#e3e1d6;
  --text:#1f2318; --text-2:#5c6152; --text-3:#8b8f80;
  --ok:#2f7d4f; --ok-bg:#e6f3ea;
  --warn:#a86b16; --warn-bg:#fbf0dc;
  --bad:#a53127; --bad-bg:#fbe9e7;
  --info:#2a5f8f; --info-bg:#e6eff7;

  --r:10px; --r-s:7px; --r-l:16px;
  --sh-1:0 1px 2px rgba(31,35,24,.06), 0 1px 3px rgba(31,35,24,.05);
  --sh-2:0 4px 14px rgba(31,35,24,.09);
  --sh-3:0 18px 48px rgba(31,35,24,.18);
  --nav-w:236px;
  --ff:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue","Noto Sans",Arial,sans-serif;
  --ff-num:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;
}

@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#14170f; --surface:#1c2015; --surface-2:#22271a; --line:#333925;
    --text:#eef0e6; --text-2:#adb3a0; --text-3:#7d846f;
    --olive-100:#2b3520; --olive-300:#7d9455;
    --ok-bg:#16301f; --warn-bg:#33260f; --bad-bg:#331916; --info-bg:#132434;
    --ok:#6cc48c; --warn:#e0ae5a; --bad:#e88a80; --info:#7fb2e0;
    --or-100:#332b12;
    --sh-1:0 1px 2px rgba(0,0,0,.35); --sh-2:0 4px 14px rgba(0,0,0,.4); --sh-3:0 18px 48px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"]{
  --bg:#14170f; --surface:#1c2015; --surface-2:#22271a; --line:#333925;
  --text:#eef0e6; --text-2:#adb3a0; --text-3:#7d846f;
  --olive-100:#2b3520; --olive-300:#7d9455;
  --ok-bg:#16301f; --warn-bg:#33260f; --bad-bg:#331916; --info-bg:#132434;
  --ok:#6cc48c; --warn:#e0ae5a; --bad:#e88a80; --info:#7fb2e0;
  --or-100:#332b12;
  --sh-1:0 1px 2px rgba(0,0,0,.35); --sh-2:0 4px 14px rgba(0,0,0,.4); --sh-3:0 18px 48px rgba(0,0,0,.55);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; font-family:var(--ff); background:var(--bg); color:var(--text);
  font-size:14.5px; line-height:1.5; -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{margin:0; font-weight:640; letter-spacing:-.01em; line-height:1.25}
a{color:inherit}
button{font-family:inherit}
.num{font-variant-numeric:tabular-nums; font-feature-settings:"tnum"}

/* ---------- Écran de connexion ------------------------------------------- */
.login-wrap{min-height:100vh; display:grid; place-items:center; padding:24px;
  background:radial-gradient(1000px 600px at 20% -10%, var(--olive-100), transparent 60%), var(--bg)}
.login-card{width:min(420px,100%); background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-l); padding:34px 30px; box-shadow:var(--sh-2)}
.login-card .brand{display:flex; align-items:center; gap:12px; margin-bottom:6px}
.login-card h1{font-size:21px}
.login-card p.sub{color:var(--text-2); font-size:13.5px; margin:6px 0 22px}

/* ---------- Structure ----------------------------------------------------- */
.app{display:grid; grid-template-columns:var(--nav-w) 1fr; min-height:100vh}

.nav{background:var(--olive-900); color:#e9eede; display:flex; flex-direction:column;
  position:sticky; top:0; height:100vh; overflow-y:auto}
.nav .brand{display:flex; align-items:center; gap:11px; padding:19px 18px 17px;
  border-bottom:1px solid rgba(255,255,255,.09)}
.nav .brand b{font-size:15.5px; letter-spacing:-.01em; display:block}
.nav .brand span{font-size:11px; color:#a9b795; text-transform:uppercase; letter-spacing:.09em}
.nav nav{padding:12px 10px; flex:1}
.nav .grp{font-size:10.5px; text-transform:uppercase; letter-spacing:.1em; color:#8e9c7a;
  padding:14px 10px 6px; font-weight:600}
.nav a{display:flex; align-items:center; gap:10px; padding:8.5px 11px; border-radius:var(--r-s);
  color:#d5ddc4; text-decoration:none; font-size:14px; font-weight:500; margin-bottom:1px}
.nav a:hover{background:rgba(255,255,255,.07); color:#fff}
.nav a.on{background:var(--olive-600); color:#fff; box-shadow:inset 0 0 0 1px rgba(255,255,255,.09)}
.nav a svg{width:17px; height:17px; flex:none; opacity:.9}
.nav .foot{padding:12px 14px; border-top:1px solid rgba(255,255,255,.09); font-size:12.5px; color:#a9b795}
.nav .foot .who{display:flex; align-items:center; gap:9px; margin-bottom:9px}
.nav .foot .av{width:29px; height:29px; border-radius:50%; background:var(--olive-600); color:#fff;
  display:grid; place-items:center; font-size:12px; font-weight:650; flex:none}
.nav .foot .who b{color:#e9eede; font-size:13px; display:block; line-height:1.2}
.nav .foot button{background:none; border:0; color:#a9b795; cursor:pointer; font-size:12.5px; padding:0; text-decoration:underline}

.main{min-width:0; display:flex; flex-direction:column}
.top{position:sticky; top:0; z-index:20; background:color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter:blur(10px); border-bottom:1px solid var(--line);
  padding:14px 26px; display:flex; align-items:center; gap:14px; flex-wrap:wrap}
.top h1{font-size:19.5px; flex:1; min-width:180px}
.top .sub{font-size:12.5px; color:var(--text-2); font-weight:450; display:block; margin-top:2px}
.content{padding:22px 26px 60px; flex:1}
.burger{display:none}

@media (max-width:900px){
  .app{grid-template-columns:1fr}
  .nav{position:fixed; z-index:60; width:var(--nav-w); transform:translateX(-100%);
    transition:transform .22s ease; box-shadow:var(--sh-3)}
  .nav.open{transform:none}
  .burger{display:inline-grid}
  .content{padding:16px 14px 60px}
  .top{padding:11px 14px}
  .scrim{position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:50}
}

/* ---------- Boutons ------------------------------------------------------- */
.btn{display:inline-flex; align-items:center; justify-content:center; gap:7px;
  padding:8px 13px; border-radius:var(--r-s); border:1px solid var(--line);
  background:var(--surface); color:var(--text); font-size:13.5px; font-weight:550;
  cursor:pointer; white-space:nowrap; transition:.14s}
.btn:hover{background:var(--surface-2); border-color:var(--olive-300)}
.btn svg{width:15px; height:15px}
.btn.pri{background:var(--olive-600); border-color:var(--olive-600); color:#fff}
.btn.pri:hover{background:var(--olive-700); border-color:var(--olive-700)}
.btn.dgr{color:var(--bad); border-color:color-mix(in srgb,var(--bad) 35%, var(--line))}
.btn.dgr:hover{background:var(--bad-bg)}
.btn.sm{padding:5px 9px; font-size:12.5px}
.btn.ico{padding:6px; width:30px; height:30px}
.btn.ico svg{width:15px;height:15px}
.btn:disabled{opacity:.5; cursor:not-allowed}
.btn.block{width:100%; padding:10px}

/* ---------- Cartes / KPI -------------------------------------------------- */
.card{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--sh-1); min-width:0}
.card > .hd{padding:13px 16px; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.card > .hd h3{font-size:14.5px; flex:1}
.card > .bd{padding:16px}

.kpis{display:grid; grid-template-columns:repeat(auto-fit,minmax(185px,1fr)); gap:12px; margin-bottom:18px}
.kpi{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:14px 15px; box-shadow:var(--sh-1)}
.kpi .lb{font-size:11.5px; text-transform:uppercase; letter-spacing:.06em; color:var(--text-3); font-weight:600}
.kpi .vl{font-size:25px; font-weight:660; letter-spacing:-.02em; margin-top:5px; font-variant-numeric:tabular-nums}
.kpi .vl small{font-size:13px; font-weight:500; color:var(--text-2); margin-left:3px}
.kpi .dt{font-size:12px; color:var(--text-2); margin-top:3px}
.kpi.acc-olive{border-left:3px solid var(--olive-500)}
.kpi.acc-or{border-left:3px solid var(--or-500)}
.kpi.acc-ok{border-left:3px solid var(--ok)}
.kpi.acc-bad{border-left:3px solid var(--bad)}
.kpi.acc-info{border-left:3px solid var(--info)}

.grid2{display:grid; grid-template-columns:repeat(auto-fit,minmax(min(330px,100%),1fr)); gap:14px}
.grid3{display:grid; grid-template-columns:repeat(auto-fit,minmax(min(250px,100%),1fr)); gap:14px}
.grid2 > *, .grid3 > *{min-width:0}
.grid2, .grid3{align-items:start}
.stack{display:grid; gap:14px; margin-bottom:14px}

/* ---------- Barre d'outils ------------------------------------------------ */
.toolbar{display:flex; gap:9px; align-items:center; flex-wrap:wrap; margin-bottom:14px}
.toolbar .spacer{flex:1}
.search{position:relative; flex:1; min-width:180px; max-width:330px}
.search input{width:100%; padding:8px 11px 8px 32px}
.search svg{position:absolute; left:10px; top:50%; transform:translateY(-50%); width:15px; height:15px; color:var(--text-3)}

/* ---------- Formulaires --------------------------------------------------- */
input,select,textarea{
  width:100%; padding:8px 10px; border:1px solid var(--line); border-radius:var(--r-s);
  background:var(--surface); color:var(--text); font-family:inherit; font-size:13.8px; outline:none;
}
input:focus,select:focus,textarea:focus{border-color:var(--olive-500); box-shadow:0 0 0 3px color-mix(in srgb,var(--olive-500) 18%, transparent)}
input[type=checkbox]{width:auto; accent-color:var(--olive-600)}
textarea{resize:vertical; min-height:66px}
select{appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8f80' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 8px center; background-size:15px; padding-right:29px}
label.fld{display:block; margin-bottom:12px}
label.fld > span{display:block; font-size:12.3px; font-weight:600; color:var(--text-2); margin-bottom:4px}
label.fld .hint{font-weight:450; color:var(--text-3); font-size:11.5px; display:block; margin-top:3px}
label.fld.req > span::after{content:" *"; color:var(--bad)}
label.chk{display:flex; align-items:center; gap:8px; font-size:13.5px; margin-bottom:12px; cursor:pointer}
.form-grid{display:grid; grid-template-columns:repeat(2,1fr); gap:0 14px}
.form-grid .full{grid-column:1/-1}
@media(max-width:640px){.form-grid{grid-template-columns:1fr}}
.calc-note{background:var(--olive-100); border:1px solid color-mix(in srgb,var(--olive-500) 25%, var(--line));
  border-radius:var(--r-s); padding:9px 12px; font-size:13px; margin-bottom:12px; color:var(--text)}
.calc-note b{font-variant-numeric:tabular-nums}

/* ---------- Tableaux ------------------------------------------------------ */
.tbl-wrap{overflow-x:auto; border:1px solid var(--line); border-radius:var(--r); background:var(--surface); box-shadow:var(--sh-1)}
table.tbl{width:100%; border-collapse:collapse; font-size:13.5px; min-width:640px}
table.tbl th{
  text-align:left; padding:9px 12px; background:var(--surface-2); color:var(--text-2);
  font-size:11.4px; text-transform:uppercase; letter-spacing:.055em; font-weight:660;
  border-bottom:1px solid var(--line); white-space:nowrap; position:sticky; top:0; z-index:2; cursor:pointer; user-select:none}
table.tbl th.nosort{cursor:default}
table.tbl th .ar{opacity:.45; font-size:9px; margin-left:3px}
table.tbl td{padding:9px 12px; border-bottom:1px solid var(--line); vertical-align:middle}
table.tbl tbody tr:hover{background:var(--surface-2)}
table.tbl tbody tr:last-child td{border-bottom:0}
table.tbl td.r, table.tbl th.r{text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap}
table.tbl td.c, table.tbl th.c{text-align:center}
table.tbl tfoot td{padding:10px 12px; font-weight:650; background:var(--surface-2); border-top:2px solid var(--line);
  font-variant-numeric:tabular-nums}
.acts{display:flex; gap:5px; justify-content:flex-end}
.lot-badge{font-family:var(--ff-num); font-size:12.4px; font-weight:640; background:var(--olive-100);
  color:var(--olive-700); padding:2.5px 7px; border-radius:5px; white-space:nowrap; border:1px solid color-mix(in srgb,var(--olive-500) 22%, transparent)}
:root[data-theme="dark"] .lot-badge{color:var(--olive-300)}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .lot-badge{color:var(--olive-300)}
}

.tag{display:inline-flex; align-items:center; gap:4px; font-size:11.6px; font-weight:600;
  padding:2.5px 8px; border-radius:99px; white-space:nowrap}
.tag.ok{background:var(--ok-bg); color:var(--ok)}
.tag.warn{background:var(--warn-bg); color:var(--warn)}
.tag.bad{background:var(--bad-bg); color:var(--bad)}
.tag.info{background:var(--info-bg); color:var(--info)}
.tag.mut{background:var(--surface-2); color:var(--text-2); border:1px solid var(--line)}

.empty{text-align:center; padding:46px 20px; color:var(--text-2)}
.empty svg{width:38px; height:38px; opacity:.35; margin-bottom:10px}
.empty h4{font-size:15px; margin-bottom:5px}
.empty p{font-size:13.3px; margin:0 0 14px}

/* ---------- Modale -------------------------------------------------------- */
.modal-bg{position:fixed; inset:0; background:rgba(20,23,15,.5); backdrop-filter:blur(3px);
  z-index:100; display:flex; align-items:flex-start; justify-content:center; padding:34px 16px; overflow-y:auto}
.modal{background:var(--surface); border-radius:var(--r-l); box-shadow:var(--sh-3);
  width:min(720px,100%); border:1px solid var(--line); animation:pop .16s ease}
.modal.wide{width:min(980px,100%)}
@keyframes pop{from{opacity:0; transform:translateY(-8px) scale(.99)}}
.modal .mh{padding:16px 20px; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:12px}
.modal .mh h3{font-size:16px; flex:1}
.modal .mb{padding:18px 20px; max-height:min(64vh,680px); overflow-y:auto}
.modal .mf{padding:14px 20px; border-top:1px solid var(--line); display:flex; gap:9px; justify-content:flex-end; flex-wrap:wrap}
.modal .mf .spacer{flex:1}

/* ---------- Toasts -------------------------------------------------------- */
.toasts{position:fixed; bottom:18px; right:18px; z-index:200; display:flex; flex-direction:column; gap:8px}
.toast{background:var(--surface); border:1px solid var(--line); border-left:3px solid var(--olive-500);
  border-radius:var(--r-s); padding:11px 15px; box-shadow:var(--sh-2); font-size:13.4px; max-width:340px;
  animation:slide .2s ease}
.toast.ok{border-left-color:var(--ok)} .toast.bad{border-left-color:var(--bad)}
@keyframes slide{from{opacity:0; transform:translateX(14px)}}

/* ---------- Graphiques ---------------------------------------------------- */
.chart{width:100%; overflow:visible}
.chart text{font-family:var(--ff); font-size:12.5px; fill:var(--text-3)}
.chart .axis{stroke:var(--line); stroke-width:1}
.chart .grid{stroke:var(--line); stroke-width:1; stroke-dasharray:2 4; opacity:.75}
.legend{display:flex; gap:14px; flex-wrap:wrap; font-size:12.4px; color:var(--text-2); margin-top:10px}
.legend i{width:10px; height:10px; border-radius:3px; display:inline-block; margin-right:6px; vertical-align:-1px}
.bar-row{margin-bottom:11px; font-size:13px}
.bar-row .hd{display:flex; justify-content:space-between; gap:12px; margin-bottom:4px; align-items:baseline}
.bar-row .nm{font-size:12.8px; color:var(--text); font-weight:530; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.bar-row .vv{font-variant-numeric:tabular-nums; font-size:12.6px; color:var(--text-2); white-space:nowrap; flex:none}
.bar-row .track{background:var(--surface-2); border-radius:4px; height:9px; position:relative; overflow:hidden; border:1px solid var(--line)}
.bar-row .fill{position:absolute; inset:0 auto 0 0; background:var(--olive-500); border-radius:3px; min-width:2px}

/* ---------- Fiche lot / traçabilité --------------------------------------- */
.lot-head{display:flex; gap:20px; flex-wrap:wrap; align-items:flex-start}
.lot-head .qr{background:#fff; padding:10px; border-radius:var(--r-s); border:1px solid var(--line); flex:none}
.lot-head .qr svg{display:block; width:132px; height:132px}
.dl{display:grid; grid-template-columns:auto 1fr; gap:7px 16px; font-size:13.6px; align-items:baseline}
.dl dt{color:var(--text-2); font-size:12.6px}
.dl dd{margin:0; font-weight:550; font-variant-numeric:tabular-nums}
.timeline{position:relative; padding-left:22px}
.timeline::before{content:''; position:absolute; left:6px; top:6px; bottom:6px; width:2px; background:var(--line)}
.timeline .ev{position:relative; padding-bottom:16px}
.timeline .ev::before{content:''; position:absolute; left:-19px; top:5px; width:9px; height:9px; border-radius:50%;
  background:var(--olive-500); box-shadow:0 0 0 3px var(--surface)}
.timeline .ev b{display:block; font-size:13.6px}
.timeline .ev span{font-size:12.4px; color:var(--text-2)}

/* ---------- Document imprimable ------------------------------------------- */
.doc{background:#fff; color:#1b1b1b; padding:34px; font-size:13px; border-radius:var(--r); border:1px solid var(--line)}
.doc h2{font-size:19px; margin-bottom:3px}
.doc .doc-head{display:flex; justify-content:space-between; gap:24px; border-bottom:2px solid #1b1b1b; padding-bottom:14px; margin-bottom:18px}
.doc table{width:100%; border-collapse:collapse; margin:14px 0; font-size:12.6px}
.doc th{background:#f0f0ea; text-align:left; padding:7px 9px; border:1px solid #d8d8d0; font-size:11.5px; text-transform:uppercase; letter-spacing:.04em}
.doc td{padding:7px 9px; border:1px solid #d8d8d0}
.doc td.r,.doc th.r{text-align:right}
.doc .tot{display:flex; justify-content:flex-end}
.doc .tot table{width:min(320px,100%)}
.doc .foot{margin-top:26px; font-size:11.4px; color:#666; border-top:1px solid #ddd; padding-top:10px}

@media print{
  body{background:#fff}
  .nav,.top,.toasts,.no-print,.modal .mf,.modal .mh{display:none !important}
  .app{display:block}
  .modal-bg{position:static; padding:0; background:none; backdrop-filter:none; display:block}
  .modal{width:100%; max-width:none; box-shadow:none; border:0; border-radius:0}
  .modal .mb{max-height:none; overflow:visible; padding:0}
  .content{padding:0}
  .doc{border:0; padding:0}
  @page{margin:16mm}
}

/* ---------- Divers -------------------------------------------------------- */
.banner{padding:10px 14px; border-radius:var(--r-s); font-size:13.3px; margin-bottom:14px; display:flex; gap:10px; align-items:center}
.banner.info{background:var(--info-bg); color:var(--info)}
.banner.warn{background:var(--warn-bg); color:var(--warn)}
.banner b{font-weight:660}
.banner svg{width:18px; height:18px; flex:none}
.banner > div{min-width:0}
.muted{color:var(--text-2)}
.small{font-size:12.5px}
.spinner{width:17px; height:17px; border:2px solid var(--line); border-top-color:var(--olive-500);
  border-radius:50%; animation:spin .7s linear infinite; display:inline-block}
@keyframes spin{to{transform:rotate(360deg)}}
.tabs{display:flex; gap:3px; border-bottom:1px solid var(--line); margin-bottom:16px; overflow-x:auto}
.tabs button{background:none; border:0; padding:9px 14px; font-size:13.6px; font-weight:560; color:var(--text-2);
  cursor:pointer; border-bottom:2px solid transparent; white-space:nowrap}
.tabs button.on{color:var(--olive-600); border-bottom-color:var(--olive-600)}
:root[data-theme="dark"] .tabs button.on{color:var(--olive-300); border-bottom-color:var(--olive-300)}

/* ── Bouton bascule de langue ─────────────────────────────────────────────── */
.lang-btn{background:none; border:1px solid var(--line); border-radius:var(--r-s);
  padding:3px 8px; font-size:12px; font-weight:600; color:var(--text-2);
  cursor:pointer; letter-spacing:.5px; margin-inline-start:6px}
.lang-btn:hover{background:var(--olive-100); color:var(--olive-700)}

/* ── Support RTL (arabe) ──────────────────────────────────────────────────── */
[dir="rtl"] body{font-family:"Noto Sans Arabic",var(--ff)}
[dir="rtl"] .app{flex-direction:row-reverse}
[dir="rtl"] .nav{border-right:none; border-left:1px solid var(--line)}
[dir="rtl"] .main{margin-left:0; margin-right:var(--nav-w)}
[dir="rtl"] .brand > *:last-child{margin-right:0}
[dir="rtl"] .foot .who{flex-direction:row-reverse}
[dir="rtl"] .top{flex-direction:row-reverse}
[dir="rtl"] .toolbar{flex-direction:row-reverse}
[dir="rtl"] .search{flex-direction:row-reverse}
[dir="rtl"] .table th,[dir="rtl"] .table td{text-align:right}
[dir="rtl"] .table th.r,[dir="rtl"] .table td.r{text-align:left}
[dir="rtl"] .acts{flex-direction:row-reverse}
[dir="rtl"] .modal-card{text-align:right}
[dir="rtl"] .modal-foot{flex-direction:row-reverse}
[dir="rtl"] .form-row{flex-direction:row-reverse}
[dir="rtl"] .fld{text-align:right}
[dir="rtl"] .banner{flex-direction:row-reverse; text-align:right}
[dir="rtl"] .kpi-grid{direction:rtl}
[dir="rtl"] nav a{flex-direction:row-reverse}
[dir="rtl"] nav .grp{text-align:right}
[dir="rtl"] input,[dir="rtl"] select,[dir="rtl"] textarea{text-align:right; direction:rtl}
@media(max-width:768px){
  [dir="rtl"] .main{margin-right:0}
  [dir="rtl"] .nav{right:auto; left:0; transform:translateX(-100%)}
  [dir="rtl"] .nav.open{transform:none}
}


/* ---------- Scanner de documents ------------------------------------------ */
.banner.bad{background:var(--bad-bg); color:var(--bad)}
.nav-badge{margin-left:auto; background:var(--or-500); color:#1c2314; font-size:11px; font-weight:700;
  border-radius:99px; padding:1px 7px; min-width:20px; text-align:center}
.scan-btns{display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:12px}
.btn.big{padding:18px 16px; font-size:16px; border-radius:var(--r)}
.btn.big svg{width:22px; height:22px}
.scan-queue{margin-top:12px; display:grid; gap:6px}
.scan-q{display:flex; justify-content:space-between; gap:10px; font-size:13px; padding:7px 10px;
  border:1px solid var(--line); border-radius:var(--r-s); background:var(--surface-2)}
.scan-q.erreur{color:var(--bad); border-color:color-mix(in srgb,var(--bad) 35%, var(--line))}
.scan-list{display:grid; grid-template-columns:repeat(auto-fill,minmax(min(360px,100%),1fr)); gap:12px}
.scan-card{display:flex; gap:12px; align-items:flex-start; border:1px solid var(--line); border-radius:var(--r);
  padding:10px; background:var(--surface)}
.scan-thumb,.scan-nophoto{width:76px; height:96px; object-fit:cover; border-radius:var(--r-s); flex:none;
  background:var(--surface-2); border:1px solid var(--line)}
.scan-list.compact .scan-thumb{width:48px; height:60px}
.scan-info{flex:1; min-width:0; font-size:13.5px}
.scan-t{display:flex; gap:6px; flex-wrap:wrap; margin-bottom:5px}
.scan-m{font-size:17px; font-weight:660; font-variant-numeric:tabular-nums}
.scan-act{display:flex; flex-direction:column; gap:6px; align-items:flex-end}
.scan-val{display:grid; grid-template-columns:minmax(0,5fr) minmax(0,7fr); gap:18px; align-items:start}
.scan-photo img{width:100%; max-height:70vh; object-fit:contain; border:1px solid var(--line);
  border-radius:var(--r-s); background:var(--surface-2); display:block}
.scan-photo{position:sticky; top:0}
.seg{display:flex; gap:0; margin-bottom:12px; border:1px solid var(--line); border-radius:var(--r-s); overflow:hidden}
.seg button{flex:1; padding:10px 8px; border:0; background:var(--surface); color:var(--text-2); font:inherit;
  font-size:13.5px; font-weight:600; cursor:pointer}
.seg button.on{background:var(--olive-600); color:#fff}
.fab{display:none; position:fixed; right:16px; bottom:calc(16px + env(safe-area-inset-bottom)); z-index:40;
  width:58px; height:58px; border-radius:50%; background:var(--olive-600); color:#fff;
  align-items:center; justify-content:center; box-shadow:var(--sh-3)}
.fab svg{width:26px; height:26px}
@media (max-width:900px){
  .fab{display:flex}
  .scan-val{grid-template-columns:1fr}
  .scan-photo{position:static}
  .scan-photo img{max-height:38vh}
  .scan-act{flex-direction:row; flex-wrap:wrap; justify-content:flex-end}
  .scan-card{flex-wrap:wrap}
  .scan-act{width:100%}
}
[dir="rtl"] .fab{right:auto; left:16px}
[dir="rtl"] .nav-badge{margin-left:0; margin-right:auto}
@media print{.fab{display:none}}
