@font-face{
  font-family:"Barlow";
  font-weight:400;
  src:url(fonts/barlow-latin-400-normal.woff2) format("woff2");
  font-display:swap;
}

@font-face{
  font-family:"Barlow";
  font-weight:600;
  src:url(fonts/barlow-latin-600-normal.woff2) format("woff2");
  font-display:swap;
}

@font-face{
  font-family:"Barlow Semi Condensed";
  font-weight:600;
  src:url(fonts/barlow-semi-condensed-latin-600-normal.woff2) format("woff2");
  font-display:swap;
}

@font-face{
  font-family:"Barlow Semi Condensed";
  font-weight:700;
  src:url(fonts/barlow-semi-condensed-latin-700-normal.woff2) format("woff2");
  font-display:swap;
}


/* =========================================================
   VARIABLES
   ========================================================= */

:root{
  --bg:#f3f7f7;

  --surface:#ffffff;
  --surface-2:#f0f5f5;
  --surface-3:#e4ecee;

  --ink:#14272d;
  --muted:#5c6f76;

  --line:#d7e2e4;
  --line-strong:#bdcdd1;

  --blue:#176b78;
  --blue-hover:#125864;
  --blue-soft:#e3f1f3;
  --blue-ink:#ffffff;

  --label:#f2b84b;
  --label-hover:#f7c45e;
  --label-ink:#4b3308;

  --scan:var(--label);
  --scan-ink:var(--label-ink);

  --red:#c64b3d;
  --red-soft:#fbeceb;

  --green:#2d8962;
  --green-soft:#e6f5ee;

  --teal:#197e77;
  --teal-soft:#e4f4f2;

  --amber:#b97813;
  --amber-bg:#fff1d8;

  /* Teintes de texte pour les étiquettes sur fonds doux (contraste AA >= 4,5:1) */
  --red-ink:#a8372b;
  --green-ink:#1f6b49;
  --teal-ink:#126760;
  --amber-ink:#8a560a;

  --nav:#103b43;
  --nav-hover:#174c55;
  --nav-active:#e1f0f1;
  --nav-active-ink:#164650;
  --nav-text:#d7e7e9;
  --nav-muted:#96b1b6;

  --radius:13px;
  --radius-s:9px;
  --radius-xs:6px;

  --shadow-xs:
    0 1px 2px rgba(16,48,55,.035);

  --shadow-sm:
    0 6px 18px rgba(16,48,55,.065);

  --shadow-md:
    0 13px 34px rgba(16,48,55,.105);

  --shadow-lg:
    0 22px 52px rgba(16,48,55,.16);

  --f-body:
    "Barlow",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;

  --f-cond:
    "Barlow Semi Condensed",
    "Barlow",
    system-ui,
    sans-serif;

  color-scheme:light;
}


/* =========================================================
   DARK MODE
   ========================================================= */

@media (prefers-color-scheme:dark){

  :root:not([data-theme=light]){

    --bg:#0d181c;

    --surface:#17262b;
    --surface-2:#1c3036;
    --surface-3:#263c42;

    --ink:#edf4f5;
    --muted:#9bb0b5;

    --line:#2c4147;
    --line-strong:#40575e;

    --blue:#58b6c2;
    --blue-hover:#70c5cf;
    --blue-soft:#19383e;
    --blue-ink:#07171a;

    --label:#f2b84b;
    --label-hover:#f7c45e;
    --label-ink:#352400;

    --red:#ef8173;
    --red-soft:#3b2421;

    --green:#6dca9c;
    --green-soft:#1c382b;

    --teal:#55c0b7;
    --teal-soft:#193a38;

    --amber:#e1ad4b;
    --amber-bg:#3b3019;

    --red-ink:var(--red);
    --green-ink:var(--green);
    --teal-ink:var(--teal);
    --amber-ink:var(--amber);

    --nav:#081f25;
    --nav-hover:#103139;
    --nav-active:#21444b;
    --nav-active-ink:#eaf6f7;
    --nav-text:#dcebec;
    --nav-muted:#91aeb3;

    --shadow-xs:
      0 1px 2px rgba(0,0,0,.24);

    --shadow-sm:
      0 6px 18px rgba(0,0,0,.28);

    --shadow-md:
      0 13px 34px rgba(0,0,0,.36);

    --shadow-lg:
      0 22px 52px rgba(0,0,0,.46);

    color-scheme:dark;
  }
}

:root[data-theme=dark]{

  --bg:#0d181c;

  --surface:#17262b;
  --surface-2:#1c3036;
  --surface-3:#263c42;

  --ink:#edf4f5;
  --muted:#9bb0b5;

  --line:#2c4147;
  --line-strong:#40575e;

  --blue:#58b6c2;
  --blue-hover:#70c5cf;
  --blue-soft:#19383e;
  --blue-ink:#07171a;

  --label:#f2b84b;
  --label-hover:#f7c45e;
  --label-ink:#352400;

  --red:#ef8173;
  --red-soft:#3b2421;

  --green:#6dca9c;
  --green-soft:#1c382b;

  --teal:#55c0b7;
  --teal-soft:#193a38;

  --amber:#e1ad4b;
  --amber-bg:#3b3019;

  --red-ink:var(--red);
  --green-ink:var(--green);
  --teal-ink:var(--teal);
  --amber-ink:var(--amber);

  --nav:#081f25;
  --nav-hover:#103139;
  --nav-active:#21444b;
  --nav-active-ink:#eaf6f7;
  --nav-text:#dcebec;
  --nav-muted:#91aeb3;

  --shadow-xs:
    0 1px 2px rgba(0,0,0,.24);

  --shadow-sm:
    0 6px 18px rgba(0,0,0,.28);

  --shadow-md:
    0 13px 34px rgba(0,0,0,.36);

  --shadow-lg:
    0 22px 52px rgba(0,0,0,.46);

  color-scheme:dark;
}


/* =========================================================
   RESET / BASE
   ========================================================= */

*{
  box-sizing:border-box;
  -webkit-tap-highlight-color:transparent;
}

html,
body{
  margin:0;
  height:100%;
}

html{
  scroll-behavior:smooth;
}

body{
  font-family:var(--f-body);
  font-size:16px;
  line-height:1.5;

  background:
    radial-gradient(
      circle at 20% 0%,
      color-mix(in srgb,var(--blue-soft) 45%,transparent),
      transparent 32%
    ),
    var(--bg);

  color:var(--ink);

  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

h1,
h2,
h3{
  font-family:var(--f-cond);
  font-weight:700;

  margin:0;

  line-height:1.08;

  letter-spacing:-.018em;
}

h1{
  font-size:2.05rem;
}

h2{
  font-size:1.45rem;
}

h3{
  font-size:1.1rem;
}

a{
  color:var(--blue);
  text-decoration:none;

  transition:
    color .16s ease;
}

a:hover{
  color:var(--blue-hover);
  text-decoration:none;
}

button,
input,
select,
textarea{
  font:inherit;
  color:inherit;
}

.skip-link{
  position:absolute;

  top:-100px;
  left:12px;

  z-index:100;

  background:var(--blue);
  color:var(--blue-ink);

  padding:12px 18px;

  border-radius:var(--radius-s);

  font-weight:600;

  text-decoration:none;

  box-shadow:var(--shadow-md);

  transition:top .15s ease;
}

#main:focus,
#main h1[tabindex="-1"]:focus{
  outline:none;
}

.skip-link:focus{
  top:12px;

  padding-top:
    calc(12px + env(safe-area-inset-top));
}

:focus-visible{
  outline:3px solid
    color-mix(
      in srgb,
      var(--blue) 70%,
      white
    );

  outline-offset:3px;

  border-radius:6px;
}

::selection{
  background:var(--blue);
  color:var(--blue-ink);
}

.muted{
  color:var(--muted);
}

.small{
  font-size:.875rem;
}

.right{
  text-align:right;
}

/* ---- Utilitaires (remplacent des style="…" statiques en ligne) ----
   !important : un style en ligne l'emporte sur toute règle de feuille ; ceci reproduit cette priorité.
   Ce bloc doit rester AVANT .hidden (aussi !important) pour que .hidden garde la priorité, comme avec le style en ligne. */
.ai-center{align-items:center!important}
.break-all{word-break:break-all!important}
.c-inherit{color:inherit!important}
.d-block{display:block!important}
.gap0{gap:0!important}
.gap10{gap:10px!important}
.gap2{gap:2px!important}
.gap4{gap:4px!important}
.gap6{gap:6px!important}
.gap8{gap:8px!important}
.jc-center{justify-content:center!important}
.jc-end{justify-content:flex-end!important}
.m-b10{margin:0 0 10px!important}
.m0{margin:0!important}
.mb0{margin-bottom:0!important}
.mb12{margin-bottom:12px!important}
.mb14{margin-bottom:14px!important}
.mb16{margin-bottom:16px!important}
.mb18{margin-bottom:18px!important}
.mb2{margin-bottom:2px!important}
.mb8{margin-bottom:8px!important}
.mt0{margin-top:0!important}
.mt12{margin-top:12px!important}
.mt18{margin-top:18px!important}
.mt2{margin-top:2px!important}
.mt4{margin-top:4px!important}
.mw520{max-width:520px!important}
.mx-auto{margin:0 auto!important}
.nowrap{flex-wrap:nowrap!important}
.p0{padding:0!important}
.shrink0{flex-shrink:0!important}
.ta-center{text-align:center!important}
.w-full{width:100%!important}
.wrap{flex-wrap:wrap!important}

.hidden{
  display:none!important;
}

.mono{
  font-family:var(--f-cond);
  font-weight:600;
}


/* =========================================================
   STRUCTURE
   ========================================================= */

#app{
  min-height:100%;

  display:flex;

  flex-direction:column;
}

main{
  flex:1;

  width:100%;
  max-width:1280px;

  margin:0 auto;

  padding:
    22px
    14px
    102px;
}


/* =========================================================
   NAVIGATION MOBILE
   ========================================================= */

.nav{
  position:fixed;

  bottom:0;
  left:0;
  right:0;

  z-index:20;

  display:flex;

  background:
    color-mix(
      in srgb,
      var(--surface) 96%,
      transparent
    );

  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);

  border-top:1px solid var(--line);

  box-shadow:
    0 -10px 30px rgba(16,48,55,.09);

  padding-bottom:
    env(safe-area-inset-bottom);
}

.nav a{
  flex:1;

  display:flex;

  flex-direction:column;

  align-items:center;
  justify-content:center;

  gap:3px;

  padding:
    8px
    2px
    7px;

  color:var(--muted);

  font-family:var(--f-cond);
  font-weight:600;

  font-size:.8rem;

  text-decoration:none;

  transition:
    color .16s ease,
    transform .15s ease;
}

.nav a svg{
  width:23px;
  height:23px;

  transition:
    transform .16s ease;
}

.nav a.on{
  color:var(--blue);
}

.nav a.on svg{
  transform:translateY(-1px);
}

.nav a:active{
  transform:scale(.95);
}

.nav a.scan{
  color:var(--scan-ink);
}

.nav a.scan span.pill{
  background:var(--scan);

  border-radius:999px;

  padding:
    5px
    15px;

  margin-top:-17px;

  box-shadow:
    0 3px 0 rgba(0,0,0,.13),
    0 6px 14px rgba(0,0,0,.09);
}

.nav a.scan.on{
  color:var(--scan-ink);
}

/* Barre mobile en mode sombre : le libellé "Scanner" (hors pastille jaune)
   doit rester en texte clair pour rester lisible sur la barre foncée.
   L'icône dans la pastille jaune, elle, garde son texte foncé (label-ink). */
@media (max-width:899px){
  :root[data-theme=dark] .nav a.scan span:last-child{
    color:var(--ink);
  }
}
@media (max-width:899px) and (prefers-color-scheme:dark){
  :root:not([data-theme=light]) .nav a.scan span:last-child{
    color:var(--ink);
  }
}

.badge{
  background:var(--red);

  color:#fff;

  border-radius:999px;

  font-size:.75rem;

  padding:
    1px
    6px;

  margin-left:4px;

  font-family:var(--f-cond);
  font-weight:700;
}

@keyframes sk-pulse{
  0%,100%{ opacity:.55; }
  50%{ opacity:1; }
}

.sk{
  border-radius:7px;

  height:13px;

  background:var(--surface-2);

  animation:sk-pulse 1.3s ease-in-out infinite;
}

.sk-row{
  display:flex;

  align-items:center;

  gap:12px;

  pointer-events:none;
}

.filter-count{
  display:inline-flex;

  align-items:center;
  justify-content:center;

  min-width:18px;
  height:18px;

  padding:0 5px;

  border-radius:999px;

  background:var(--blue);

  color:var(--blue-ink);

  font-size:.75rem;
  font-weight:700;
  font-family:var(--f-cond);
}

/* Tri de la liste d'articles : même hauteur que les boutons "small" de la barre d'outils (Filtres). */
.sort-inline{
  flex:none;

  width:auto;
  max-width:190px;

  min-height:40px;
  height:40px;

  padding:0 12px;

  font-size:.9rem;
  font-weight:600;
}

.sort-inline:focus{
  border-color:var(--blue);

  box-shadow:
    0 0 0 3px
    var(--blue-soft);
}

@media (max-width:640px){
  .sort-inline{
    max-width:160px;
  }
}

.brand{
  display:none;

  font-family:var(--f-cond);
  font-weight:700;

  font-size:1.55rem;

  letter-spacing:-.025em;

  padding:
    5px
    14px
    30px;

  color:var(--ink);
}

.nav .spacer{
  display:none;
}


/* =========================================================
   NAVIGATION DESKTOP
   ========================================================= */

@media (min-width:900px){

  #app{
    flex-direction:row;
  }

  .nav{
    position:sticky;

    top:0;

    width:258px;

    height:100vh;
    min-height:100vh;

    flex-direction:column;

    padding:
      27px
      15px;

    gap:5px;

    flex:none;

    background:
      linear-gradient(
        180deg,
        var(--nav) 0%,
        color-mix(
          in srgb,
          var(--nav) 85%,
          black
        ) 100%
      );

    border:0;

    box-shadow:
      7px 0 28px rgba(10,40,47,.12);
  }

  .nav .brand{
    display:block;

    color:#fff;

    font-size:1.72rem;

    padding:
      7px
      15px
      34px;
  }

  .nav .brand-row{
    display:flex;

    align-items:center;

    gap:10px;
  }

  .nav .brand-icon{
    width:32px;
    height:32px;

    flex:none;

    display:block;

    border-radius:8px;

    background:#fff;
    padding:5px;
    box-sizing:border-box;

    box-shadow:0 1px 3px rgba(0,0,0,.25);
  }

  .nav .brand::after{
    content:"";

    display:block;

    width:34px;

    height:3px;

    margin-top:8px;

    border-radius:99px;

    background:var(--label);
  }

  .nav a{
    position:relative;

    flex:none;

    flex-direction:row;

    justify-content:flex-start;

    gap:13px;

    min-height:49px;

    padding:
      11px
      14px;

    border-radius:10px;

    color:var(--nav-text);

    font-size:1rem;
  }

  .nav a svg{
    width:21px;
    height:21px;

    flex:none;
  }

  .nav a:hover{
    background:var(--nav-hover);

    color:#fff;

    transform:none;
  }

  .nav a.on{
    background:var(--nav-active);

    color:var(--nav-active-ink);

    font-weight:700;

    box-shadow:
      0 4px 12px rgba(0,0,0,.08);
  }

  .nav a.on::before{
    content:"";

    position:absolute;

    left:0;

    top:9px;
    bottom:9px;

    width:4px;

    border-radius:0 5px 5px 0;

    background:var(--label);
  }

  .nav a.scan{
    margin:
      14px
      0
      17px;

    min-height:52px;

    background:var(--scan);

    color:var(--scan-ink);

    box-shadow:
      0 4px 0 rgba(0,0,0,.15),
      0 9px 20px rgba(0,0,0,.13);
  }

  .nav a.scan:hover{
    background:
      color-mix(
        in srgb,
        var(--scan) 85%,
        black
      );

    color:var(--scan-ink);

    transform:translateY(-1px);

    box-shadow:
      0 5px 0 rgba(0,0,0,.15),
      0 11px 23px rgba(0,0,0,.15);
  }

  .nav a.scan span.pill{
    margin:0;

    padding:0;

    background:none;

    box-shadow:none;

    display:flex;

    gap:13px;

    align-items:center;
  }

  .nav .spacer{
    display:block;

    flex:1;

    margin-top:14px;
  }

  main{
    padding:
      34px
      40px
      50px;
  }
}


/* =========================================================
   PAGE HEADER
   ========================================================= */

.pagehead{
  display:flex;

  align-items:flex-end;

  justify-content:space-between;

  gap:16px;

  margin-bottom:25px;

  flex-wrap:wrap;
}

.pagehead h1{
  letter-spacing:-.03em;
}

.pagehead .muted{
  margin-top:5px;

  font-size:.98rem;
}


/* =========================================================
   BREADCRUMBS
   ========================================================= */

.crumbs{
  display:flex;

  flex-wrap:wrap;

  gap:
    2px
    0;

  margin-bottom:8px;

  font-size:.88rem;

  color:var(--muted);
}

.crumbs a,
.crumbs span{
  color:var(--muted);
}

.crumbs a:hover{
  color:var(--blue);
}

.crumbs .sep{
  padding:
    0
    7px;

  opacity:.45;
}

.crumbs .last{
  color:var(--ink);

  font-weight:600;
}


/* =========================================================
   LAYOUT / CARDS
   ========================================================= */

.card{
  background:var(--surface);

  border:
    1px solid
    var(--line);

  border-radius:var(--radius);

  padding:20px;

  box-shadow:var(--shadow-xs);

  transition:
    box-shadow .18s ease,
    border-color .18s ease,
    transform .18s ease;
}

.card:hover{
  box-shadow:var(--shadow-sm);

  border-color:
    color-mix(
      in srgb,
      var(--blue) 15%,
      var(--line)
    );
}

.stack{
  display:flex;

  flex-direction:column;

  gap:15px;
}

.row{
  display:flex;

  gap:10px;

  align-items:center;

  flex-wrap:wrap;
}

.between{
  justify-content:space-between;
}

.grow{
  flex:1;

  min-width:0;
}

.grid{
  display:grid;

  gap:15px;
}

.g2{
  grid-template-columns:
    repeat(
      2,
      minmax(0,1fr)
    );
}

@media (min-width:700px){

  .g3{
    grid-template-columns:
      repeat(
        3,
        minmax(0,1fr)
      );
  }

  .g4{
    grid-template-columns:
      repeat(
        4,
        minmax(0,1fr)
      );
  }

  .split{
    grid-template-columns:1fr 1fr;
  }
}


/* =========================================================
   BOUTONS
   ========================================================= */

.btn{
  display:inline-flex;

  align-items:center;
  justify-content:center;

  gap:8px;

  border:
    1px solid
    var(--line-strong);

  background:var(--surface);

  border-radius:var(--radius-s);

  padding:
    9px
    16px;

  min-height:43px;

  cursor:pointer;

  font-weight:600;

  text-decoration:none;

  color:var(--ink);

  box-shadow:
    0 1px 2px rgba(16,48,55,.045);

  transition:
    background .15s ease,
    border-color .15s ease,
    color .15s ease,
    box-shadow .15s ease,
    transform .1s ease;
}

.btn:hover{
  background:var(--surface-2);

  border-color:var(--line-strong);

  box-shadow:var(--shadow-sm);

  text-decoration:none;
}

.btn:active{
  transform:translateY(1px);

  box-shadow:none;
}

.btn.primary{
  background:var(--blue);

  border-color:var(--blue);

  color:var(--blue-ink);

  box-shadow:
    0 5px 13px
    color-mix(
      in srgb,
      var(--blue) 24%,
      transparent
    );
}

.btn.primary:hover{
  background:var(--blue-hover);

  border-color:var(--blue-hover);

  box-shadow:
    0 7px 16px
    color-mix(
      in srgb,
      var(--blue) 28%,
      transparent
    );
}

.btn.danger{
  color:var(--red-ink);

  border-color:
    color-mix(
      in srgb,
      var(--red) 45%,
      var(--line)
    );

  background:var(--surface);
}

.btn.danger:hover{
  background:var(--red-soft);

  border-color:var(--red);
}

.btn.small{
  padding:
    7px
    11px;

  min-height:40px;

  font-size:.9rem;
}

.btn[disabled]{
  opacity:.5;

  pointer-events:none;
}

.btn svg{
  width:20px;
  height:20px;
}


/* =========================================================
   FORMULAIRES
   ========================================================= */

.field{
  display:flex;

  flex-direction:column;

  gap:7px;
}

.field label{
  font-weight:600;

  font-size:.9rem;

  color:var(--ink);
}

input[type=text],
input[type=search],
input[type=number],
input[type=date],
input[type=password],
input[type=url],
input[type=tel],
input[type=email],
select,
textarea{

  width:100%;

  border:
    1px solid
    var(--line-strong);

  background:var(--surface);

  border-radius:var(--radius-s);

  padding:
    10px
    13px;

  min-height:45px;

  transition:
    border-color .15s ease,
    box-shadow .15s ease,
    background .15s ease;
}

input:hover,
select:hover,
textarea:hover{
  border-color:
    color-mix(
      in srgb,
      var(--blue) 35%,
      var(--line-strong)
    );
}

input:focus,
select:focus,
textarea:focus{

  border-color:var(--blue);

  box-shadow:
    0 0 0 3px
    var(--blue-soft);

  outline:none;
}

textarea{
  min-height:94px;

  resize:vertical;
}


/* =========================================================
   BARRE DE RECHERCHE
   ========================================================= */

.searchbar{
  display:flex;

  gap:10px;

  margin-bottom:21px;
}

.searchbar input{
  flex:1;

  height:53px;

  min-height:53px;

  padding:
    0
    18px;

  border:
    1px solid
    var(--line);

  border-radius:12px;

  background:var(--surface);

  font-size:1rem;

  box-shadow:
    0 1px 2px rgba(16,48,55,.025),
    0 6px 20px rgba(16,48,55,.035);
}

.searchbar input::placeholder{
  color:#87989d;
}

.searchbar input:focus{
  border-color:var(--blue);

  box-shadow:
    0 0 0 3px
    var(--blue-soft),

    0 7px 20px
    rgba(16,48,55,.055);
}

.searchbar .btn{
  width:58px;

  height:53px;

  min-height:53px;

  padding:0;

  border-radius:12px;

  background:var(--blue);

  border-color:var(--blue);

  color:var(--blue-ink);

  box-shadow:
    0 5px 13px
    rgba(23,107,120,.23);
}


/* =========================================================
   CHIPS / TAGS
   ========================================================= */

.chip{
  display:inline-block;

  font-family:var(--f-cond);

  font-weight:700;

  letter-spacing:.035em;

  background:var(--label);

  color:var(--label-ink);

  border-radius:6px;

  padding:
    2px
    9px;

  font-size:.9rem;

  white-space:nowrap;
}

.tag{
  display:inline-flex;

  align-items:center;

  border:
    1px solid
    var(--line);

  border-radius:999px;

  padding:
    4px
    10px;

  font-size:.82rem;

  line-height:1.3;

  color:var(--muted);

  background:var(--surface-2);
}

.tag.low{
  color:var(--red-ink);

  border-color:
    color-mix(
      in srgb,
      var(--red) 55%,
      var(--line)
    );

  background:var(--red-soft);
}

.tag.warn{
  color:var(--amber-ink);

  border-color:
    color-mix(
      in srgb,
      var(--amber) 55%,
      var(--line)
    );

  background:var(--amber-bg);
}

.tag.sale{
  color:var(--teal-ink);

  border-color:
    color-mix(
      in srgb,
      var(--teal) 55%,
      var(--line)
    );

  background:var(--teal-soft);
}

.tag.off{
  background:var(--muted);

  color:var(--surface);

  border-color:var(--muted);
}


/* =========================================================
   LISTE D'ARTICLES
   ========================================================= */

.items{
  display:flex;

  flex-direction:column;

  gap:11px;

  padding:0;

  margin:0;

  list-style:none;
}

.item{
  display:flex;

  gap:15px;

  align-items:center;

  min-height:94px;

  background:var(--surface);

  border:
    1px solid
    var(--line);

  border-radius:13px;

  padding:
    14px
    16px;

  color:inherit;

  position:relative;

  box-shadow:var(--shadow-xs);

  transition:
    border-color .16s ease,
    background .16s ease,
    box-shadow .16s ease,
    transform .16s ease;
}

.item:hover{
  border-color:
    color-mix(
      in srgb,
      var(--blue) 30%,
      var(--line)
    );

  background:var(--surface);

  box-shadow:var(--shadow-sm);

  text-decoration:none;

  transform:translateY(-2px);
}

.item.inactive{
  opacity:.55;
}

.thumb{
  width:68px;

  height:68px;

  border-radius:11px;

  background:
    linear-gradient(
      145deg,
      var(--surface-2),
      var(--surface-3)
    );

  flex:none;

  object-fit:cover;

  display:grid;

  place-items:center;

  color:var(--muted);

  border:
    1px solid
    var(--line);
}

.thumb svg{
  width:28px;
  height:28px;
}

.item .name{
  font-weight:600;

  font-size:1.09rem;

  overflow:hidden;

  text-overflow:ellipsis;

  white-space:nowrap;
}

.item .qty{
  font-family:var(--f-cond);

  font-weight:700;

  font-size:1.5rem;

  text-align:right;

  min-width:50px;

  line-height:1;

  color:var(--blue);
}

.item .qty small{
  display:block;

  font-weight:600;

  font-size:.75rem;

  color:var(--muted);

  margin-top:4px;
}

.item .sel{
  width:22px;

  height:22px;

  flex:none;
}

.item.select-on{
  border-color:var(--blue);

  background:var(--blue-soft);

  box-shadow:
    0 0 0 2px
    color-mix(
      in srgb,
      var(--blue) 15%,
      transparent
    );
}

/* Chips de filtres rapides (Explorer) : raccourcis visuels vers les cases à cocher du
   panneau "Filtres" avancé, pour les critères les plus fréquents sans avoir à le déplier. */
.chip-filter{
  display:inline-flex;

  align-items:center;

  gap:6px;

  border:1px solid var(--line);

  border-radius:999px;

  padding:7px 13px;

  font-size:.85rem;

  font-weight:600;

  font-family:inherit;

  background:var(--surface);

  color:var(--muted);

  cursor:pointer;

  transition:
    background .15s ease,
    border-color .15s ease,
    color .15s ease;
}

.chip-filter svg{
  width:14px;
  height:14px;
}

.chip-filter:hover{
  border-color:
    color-mix(
      in srgb,
      var(--blue) 30%,
      var(--line)
    );
}

.chip-filter.on{
  background:var(--blue-soft);

  border-color:var(--blue);

  color:var(--blue);
}

/* Sélecteur de propriétaire (fiche article) : puces à coche, une pression pour ajouter/retirer
   chaque propriétaire, sans Ctrl/Cmd+clic comme l'exigeait le <select multiple>. */
.owner-opt svg{
  opacity:0;
  width:0;
  margin-right:-6px;
  transition:
    opacity .15s ease,
    width .15s ease,
    margin-right .15s ease;
}

.owner-opt.on svg{
  opacity:1;
  width:14px;
  margin-right:0;
}

.viewtoggle{
  display:flex;

  gap:4px;
}

.viewtoggle .btn.on{
  background:var(--blue-soft);

  border-color:var(--blue);

  color:var(--blue);
}

/* Vue grille (Explorer) : mêmes <a class="item"> que la liste, réagencés en cartes verticales
   pour repérer un objet à sa photo plutôt qu'à son nom — utile pour un carton mal étiqueté. */
.items.grid-view{
  display:grid;

  grid-template-columns:repeat(auto-fill,minmax(132px,1fr));

  gap:14px;
}

.items.grid-view .item{
  flex-direction:column;

  align-items:stretch;

  min-height:auto;

  padding:10px;

  gap:8px;
}

.items.grid-view .item .thumb{
  width:100%;

  height:auto;

  aspect-ratio:1;

  border-radius:10px;
}

.items.grid-view .item .sel{
  position:absolute;

  top:8px;

  left:8px;

  z-index:2;

  align-self:auto;

  width:24px;

  height:24px;

  margin:0;

  border-radius:50%;

  background:var(--surface);

  box-shadow:var(--shadow-sm);
}

.items.grid-view .item .qty{
  text-align:left;

  min-width:0;
}

@media (min-width:700px){

  .items.grid-view{
    grid-template-columns:repeat(auto-fill,minmax(160px,1fr));
  }
}


/* =========================================================
   DASHBOARD — STATS
   ========================================================= */

.grid.g4{
  gap:15px;
}

.stat{
  min-height:158px;

  padding:20px;

  position:relative;

  overflow:hidden;

  background:var(--surface);

  border:
    1px solid
    var(--line);

  border-radius:14px;

  box-shadow:
    0 1px 2px rgba(16,48,55,.025),
    0 7px 20px rgba(16,48,55,.038);

  transition:
    transform .18s ease,
    box-shadow .18s ease,
    border-color .18s ease;
}

.stat::after{
  content:"";

  position:absolute;

  width:90px;
  height:90px;

  right:-38px;
  bottom:-42px;

  border-radius:50%;

  background:
    color-mix(
      in srgb,
      var(--blue) 6%,
      transparent
    );

  pointer-events:none;
}

.stat:hover{
  transform:translateY(-3px);

  box-shadow:var(--shadow-md);

  border-color:
    color-mix(
      in srgb,
      var(--blue) 25%,
      var(--line)
    );
}

.stat-arrow{
  position:absolute;

  top:14px;
  right:14px;

  color:var(--muted);

  opacity:.5;

  transition:opacity .15s ease, transform .15s ease;
}

.stat-arrow svg{
  width:16px;
  height:16px;
}

a.stat:hover .stat-arrow,
a.stat:active .stat-arrow{
  opacity:.9;

  transform:translateX(2px);
}

.stat .n{
  font-family:var(--f-cond);

  font-weight:700;

  font-size:2.65rem;

  line-height:1;

  letter-spacing:-.045em;

  margin-top:20px;

  color:var(--ink);
}

.stat .l{
  color:var(--muted);

  font-size:.92rem;

  margin-top:6px;
}

.stat-ic{
  display:inline-flex;

  align-items:center;

  justify-content:center;

  width:43px;

  height:43px;

  border-radius:11px;

  margin-bottom:auto;
}

.stat-ic svg{
  width:21px;

  height:21px;
}

.stat.c-blue{
  border-top:
    3px solid
    var(--blue);
}

.stat.c-teal{
  border-top:
    3px solid
    var(--teal);
}

.stat.c-green{
  border-top:
    3px solid
    var(--green);
}

.stat.c-amber{
  border-top:
    3px solid
    var(--amber);
}

.stat.c-blue .stat-ic{
  background:var(--blue-soft);

  color:var(--blue);
}

.stat.c-teal .stat-ic{
  background:var(--teal-soft);

  color:var(--teal-ink);
}

.stat.c-green .stat-ic{
  background:var(--green-soft);

  color:var(--green-ink);
}

.stat.c-amber .stat-ic{
  background:var(--amber-bg);

  color:var(--amber-ink);
}

.stat.c-amber{
  border-color:
    color-mix(
      in srgb,
      var(--amber) 45%,
      var(--line)
    );

  border-top-color:var(--amber);
}

.stat.warn .n{
  color:var(--red-ink);
}


/* =========================================================
   BARRES DE STATISTIQUES
   ========================================================= */

.bars{
  display:flex;

  flex-direction:column;

  gap:14px;
}

.bar{
  display:grid;

  grid-template-columns:
    125px
    1fr
    30px;

  gap:10px;

  align-items:center;

  font-size:.92rem;
}

.bar .track{
  height:9px;

  background:var(--surface-3);

  border-radius:999px;

  overflow:hidden;
}

.bar .fill{
  height:100%;

  background:var(--blue);

  border-radius:999px;

  transition:
    width .3s ease;
}

.bar .lbl{
  overflow:hidden;

  text-overflow:ellipsis;

  white-space:nowrap;
}


/* =========================================================
   ACCUEIL — SECTION REPLIABLE
   ========================================================= */

details.card{
  cursor:default;
}

details.card>summary{
  cursor:pointer;

  list-style:none;

  display:flex;

  align-items:center;

  justify-content:space-between;

  gap:10px;
}

details.card>summary::-webkit-details-marker{
  display:none;
}

details.card>summary::after{
  content:"";

  width:8px;
  height:8px;

  flex:none;

  border-right:2px solid var(--muted);
  border-bottom:2px solid var(--muted);

  transform:rotate(45deg);

  transition:transform .15s ease;
}

details.card[open]>summary{
  margin-bottom:16px;
}

details.card[open]>summary::after{
  transform:rotate(-135deg);
}

details.card>summary h2{
  display:inline;
}


/* =========================================================
   FICHE ARTICLE
   ========================================================= */

.hero{
  display:grid;

  gap:19px;

  min-width:0;
}

.hero h1{
  overflow-wrap:anywhere;
}

@media (min-width:700px){

  .hero{
    grid-template-columns:
      330px
      1fr;

    align-items:start;
  }
}

.photo{
  width:100%;

  aspect-ratio:4/3;

  border-radius:var(--radius);

  background:
    linear-gradient(
      145deg,
      var(--surface-2),
      var(--surface-3)
    );

  object-fit:cover;

  border:
    1px solid
    var(--line);

  display:grid;

  place-items:center;

  color:var(--muted);

  box-shadow:var(--shadow-xs);
}

.photo svg{
  width:50px;
  height:50px;
}

.photo.empty{
  aspect-ratio:16/6;
}

.kv{
  display:grid;

  grid-template-columns:auto 1fr;

  gap:
    9px
    19px;

  margin:0;
}

.kv dt{
  color:var(--muted);
}

.kv dd{
  margin:0;

  font-weight:600;

  overflow-wrap:anywhere;

  min-width:0;
}

.kv dd a{
  display:inline-flex;

  align-items:center;

  gap:6px;

  background:var(--blue-soft);

  color:var(--blue);

  padding:5px 12px 5px 10px;

  border-radius:999px;

  font-weight:600;

  transition:
    background .15s ease,
    box-shadow .15s ease;
}

.kv dd a:hover{
  background:
    color-mix(
      in srgb,
      var(--blue-soft) 65%,
      var(--blue) 14%
    );

  box-shadow:var(--shadow-xs);
}

.kv dd a svg{
  width:16px;
  height:16px;

  flex:none;
}

.qtybox{
  display:flex;

  align-items:center;

  gap:10px;
}

.qtybox .big{
  font-family:var(--f-cond);

  font-weight:700;

  font-size:2.7rem;

  min-width:78px;

  text-align:center;

  color:var(--blue);
}

.qtybox .btn{
  width:52px;

  height:52px;

  justify-content:center;

  font-size:1.5rem;

  padding:0;
}


/* =========================================================
   QR
   ========================================================= */

.qrbox{
  display:flex;

  gap:19px;

  align-items:center;

  flex-wrap:wrap;
}

.qrbox img{
  width:132px;

  height:132px;

  image-rendering:pixelated;

  background:#fff;

  border:
    1px solid
    var(--line);

  border-radius:var(--radius-s);

  box-shadow:var(--shadow-xs);
}


/* =========================================================
   HISTORIQUE
   ========================================================= */

.hist{
  list-style:none;

  margin:0;

  padding:0;

  display:flex;

  flex-direction:column;
}

.hist li{
  padding:
    11px
    0;

  border-bottom:
    1px solid
    var(--line);

  display:grid;

  grid-template-columns:
    82px
    1fr;

  gap:10px;

  font-size:.95rem;
}

.hist li:last-child{
  border:0;
}

.hist .when{
  color:var(--muted);

  font-family:var(--f-cond);

  font-weight:600;
}

.spark{
  width:100%;

  height:70px;
}


/* =========================================================
   SCANNER
   ========================================================= */

.scanwrap{
  position:relative;

  border-radius:var(--radius);

  overflow:hidden;

  background:#000;

  aspect-ratio:3/4;

  max-height:70vh;

  margin:0 auto;

  max-width:520px;

  box-shadow:var(--shadow-lg);
}

.scanwrap video{
  width:100%;

  height:100%;

  object-fit:cover;
}

.scanwrap{
  touch-action:pan-y;
  -webkit-user-select:none;
  user-select:none;
}

.scanwrap video{
  transform-origin:center center;
}

.scanwrap .zoombadge{
  position:absolute;
  top:12px;
  left:50%;
  transform:translateX(-50%);
  z-index:2;
  padding:4px 12px;
  border-radius:999px;
  background:rgba(0,0,0,.6);
  color:#fff;
  font-weight:600;
  font-variant-numeric:tabular-nums;
  pointer-events:none;
  opacity:0;
  transition:opacity .2s ease;
}

.scanwrap .zoombadge.show{
  opacity:1;
}

.scanwrap .frame{
  position:absolute;

  /* Zone réellement analysée par le scanner : garder aligné sur FRAME_X / FRAME_Y dans app.js */
  inset:24% 8%;

  border:
    3px solid
    var(--label);

  border-radius:16px;

  box-shadow:
    0 0 0 999px rgba(0,0,0,.42),

    0 0 30px
    rgba(242,184,75,.3);

  box-shadow:
    0 0 0 999px rgba(0,0,0,.42),

    0 0 30px
    color-mix(in srgb, var(--label) 30%, transparent);

  transition:border-color .12s ease, box-shadow .12s ease;
}

.scanwrap::after{
  content:"";

  position:absolute;

  inset:0;

  background:var(--green);

  opacity:0;

  pointer-events:none;

  transition:opacity .18s ease;
}

.scanwrap .camtools{
  position:absolute;
  right:12px;
  bottom:12px;
  z-index:2;
  display:flex;
  gap:10px;
}

.scanwrap .torchbtn,
.scanwrap .zoombtn,
.scanwrap .soundbtn{
  width:48px;
  height:48px;
  display:grid;
  place-items:center;
  border:0;
  border-radius:50%;
  background:rgba(0,0,0,.55);
  color:#fff;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}

.scanwrap .soundbtn.off{
  opacity:.7;
}

.scanwrap .torchbtn svg,
.scanwrap .soundbtn svg{
  width:24px;
  height:24px;
}

.scanwrap .torchbtn.on{
  background:var(--label);
  color:#1a1a1a;
}

.scanwrap .torchbtn.on svg{
  fill:currentColor;
}

.scanwrap .torchbtn.hint{
  outline:3px solid var(--label);
  outline-offset:3px;
}

@media (prefers-reduced-motion:no-preference){
  .scanwrap .torchbtn.hint{
    animation:torchpulse 1.4s ease-in-out infinite;
  }
}

@keyframes torchpulse{
  0%,100%{ transform:scale(1); }
  50%{ transform:scale(1.14); }
}

.scanadj .stepper{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
}

.scanadj .stepper .btn{
  width:56px;
  height:56px;
  padding:0;
  font-size:1.6rem;
  line-height:1;
}

.scanadj .stepper input{
  width:110px;
  height:56px;
  text-align:center;
  font-size:1.5rem;
  font-weight:600;
  font-variant-numeric:tabular-nums;
}

.scanwrap .zoombtn{
  font:inherit;
  font-weight:600;
  font-size:.95rem;
  font-variant-numeric:tabular-nums;
}

.scanwrap .zoombtn.on{
  background:#fff;
  color:#1a1a1a;
}

.scanwrap .torchbtn:focus-visible,
.scanwrap .zoombtn:focus-visible,
.scanwrap .soundbtn:focus-visible{
  outline:3px solid #fff;
  outline-offset:2px;
}

.scanwrap.busy .frame{
  border-color:#fff;
  box-shadow:0 0 0 999px rgba(0,0,0,.42), 0 0 30px rgba(255,255,255,.55);
}

.scanwrap.ok .frame{
  border-color:var(--green);
  box-shadow:0 0 0 999px rgba(0,0,0,.42), 0 0 30px var(--green);
}

.scanwrap.bad .frame{
  border-color:var(--red);
  box-shadow:0 0 0 999px rgba(0,0,0,.42), 0 0 30px var(--red);
}

.scanwrap.ok::after{
  opacity:.35;
}

.scanwrap.bad::after{
  background:var(--red);
  opacity:.35;
}

.scanwrap .scanresult{
  position:absolute;
  left:50%;
  bottom:calc(24% + 14px);
  transform:translate(-50%, 6px);
  z-index:2;
  display:flex;
  align-items:center;
  gap:10px;
  /* Un élément en position absolue avec left:50% n'a, par défaut, que la moitié de la caméra pour se
     dimensionner : un code-barres de 13 chiffres y passait à la ligne (dernier chiffre seul). On demande
     donc la largeur du contenu, plafonnée à celle du cadre de visée. */
  width:max-content;
  max-width:calc(84% - 16px);
  padding:8px 14px;
  border-radius:14px;
  background:rgba(0,0,0,.78);
  color:#fff;
  opacity:0;
  pointer-events:none;
  transition:opacity .15s ease, transform .15s ease;
}

.scanwrap .scanresult.show{
  opacity:1;
  transform:translate(-50%, 0);
}

.scanwrap .scanresult .ico{
  font-size:1.3rem;
  font-weight:700;
  line-height:1;
}

.scanwrap.ok .scanresult .ico{ color:#6dca9c; }
.scanwrap.bad .scanresult .ico{ color:#ef8173; }

.scanwrap .scanresult .txt{
  display:flex;
  flex-direction:column;
  min-width:0;
}

.scanwrap .scanresult small{
  opacity:.75;
  font-size:.75rem;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.scanwrap .scanresult b{
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  line-clamp:2;
  overflow:hidden;
  overflow-wrap:anywhere;
}

.scanwrap.flash::after{
  opacity:.5;
}

.scanwrap.flash .frame{
  border-color:var(--green);

  box-shadow:
    0 0 0 999px rgba(0,0,0,.42),

    0 0 30px
    var(--green);
}


/* =========================================================
   TOAST
   ========================================================= */

.toast{
  position:fixed;

  left:50%;

  transform:translateX(-50%);

  bottom:88px;

  display:flex;

  align-items:center;

  gap:14px;

  background:var(--ink);

  color:var(--surface);

  padding:
    12px
    14px
    12px
    19px;

  border-radius:11px;

  z-index:60;

  max-width:90vw;

  font-weight:600;

  box-shadow:var(--shadow-md);
}

.toast.err{
  background:var(--red);

  color:#fff;
}

.toast-undo{
  flex-shrink:0;

  border:0;

  background:none;

  color:inherit;

  font-weight:700;

  text-decoration:underline;

  text-underline-offset:3px;

  cursor:pointer;

  padding:6px 2px;

  min-height:34px;
}

@media (min-width:900px){

  .toast{
    bottom:24px;
  }
}


/* =========================================================
   DIALOG
   ========================================================= */

dialog{
  border:
    1px solid
    var(--line);

  border-radius:15px;

  background:var(--surface);

  color:var(--ink);

  padding:23px;

  max-width:min(540px,94vw);

  width:100%;

  box-shadow:var(--shadow-lg);
}

dialog::backdrop{
  background:rgba(7,27,32,.66);

  backdrop-filter:blur(4px);
}

dialog h2{
  margin-bottom:15px;
}


/* =========================================================
   ARBRE
   ========================================================= */

.tree-row{
  display:flex;

  align-items:center;

  gap:8px;

  padding:
    10px
    11px;

  border-bottom:
    1px solid
    var(--line);

  transition:
    background .15s ease,
    padding-left .15s ease;
}

.tree-row:hover{
  background:var(--surface-2);

  padding-left:14px;
}

.tree-row:last-child{
  border:0;
}

.tree-actions{
  flex:none;
}

@media (max-width:699px){

  /* Sur mobile, la ligne d'une catégorie n'affiche plus que son nom et son compteur :
     les actions (Apparence, Sous-catégorie, Renommer, Supprimer) restent disponibles
     sur la fiche de la catégorie, où elles ont la place d'être lisibles. */
  .tree-actions{
    display:none;
  }
}

.cat-dot{
  display:inline-block;

  border-radius:50%;

  flex:none;
}

.cat-swatch{
  width:32px;
  height:32px;

  border-radius:50%;

  border:2px solid transparent;

  cursor:pointer;

  display:grid;
  place-items:center;

  color:#fff;

  font-size:.85rem;

  padding:0;
}

.cat-swatch.on{
  border-color:var(--ink);

  box-shadow:0 0 0 2px var(--surface);
}

.cat-swatch.none{
  background:var(--surface-2);

  color:var(--muted);

  border:1px dashed var(--line-strong);
}

.cat-icon-grid{
  max-height:216px;

  overflow-y:auto;

  padding:2px;

  align-content:flex-start;
}

.cat-icon-swatch{
  width:38px;
  height:38px;
  flex:none;

  border-radius:8px;

  border:1px solid var(--line);

  cursor:pointer;

  display:grid;
  place-items:center;

  color:var(--ink);

  background:var(--surface);

  padding:0;
}

.cat-icon-swatch.on{
  border-color:var(--blue);

  color:var(--blue);

  background:color-mix(in srgb,var(--blue) 12%,transparent);
}

.cat-icon-swatch.none{
  color:var(--muted);

  border-style:dashed;
}

.cat-badge{
  display:inline-flex;

  flex:none;
}


/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty{
  text-align:center;

  padding:
    52px
    16px;

  color:var(--muted);
}

.empty h3{
  color:var(--ink);

  margin-bottom:7px;
}


/* =========================================================
   LOGIN
   ========================================================= */

.loginbox{
  max-width:410px;

  margin:10vh auto 0;

  padding:
    0
    14px;
}

.loginbox .card{
  padding:26px;

  box-shadow:var(--shadow-md);

  border-radius:16px;
}


/* =========================================================
   AVERTISSEMENT
   ========================================================= */

.warnbox{
  border:
    1px solid
    color-mix(
      in srgb,
      var(--label) 70%,
      var(--line)
    );

  background:
    color-mix(
      in srgb,
      var(--label) 13%,
      var(--surface)
    );

  border-radius:var(--radius-s);

  padding:
    13px
    15px;
}

.suggestbox{
  border:1px solid color-mix(in srgb, var(--teal) 55%, var(--line));
  background:var(--teal-soft);
  border-radius:var(--radius-s);
  padding:10px 12px;
  gap:10px;
  align-items:center;
}
.suggestbox b{color:var(--teal-ink)}


/* =========================================================
   CHECKBOX / LISTES
   ========================================================= */

.check{
  display:flex;

  align-items:center;

  gap:12px;

  padding:14px;

  background:var(--surface);

  border:
    1px solid
    var(--line);

  border-radius:var(--radius);

  cursor:pointer;

  transition:
    border-color .15s ease,
    background .15s ease,
    box-shadow .15s ease,
    transform .15s ease;
}

.check:hover{
  border-color:
    color-mix(
      in srgb,
      var(--blue) 25%,
      var(--line)
    );

  background:var(--surface-2);

  box-shadow:var(--shadow-xs);

  transform:translateY(-1px);
}

.check input{
  width:26px;

  height:26px;

  flex:none;

  accent-color:var(--blue);
}

.check.done{
  opacity:.55;

  text-decoration:line-through;
}


/* =========================================================
   PROGRESS
   ========================================================= */

.progress{
  height:9px;

  background:var(--surface-3);

  border-radius:999px;

  overflow:hidden;
}

.progress>div{
  height:100%;

  background:var(--green);

  border-radius:999px;

  transition:
    width .3s ease;
}


/* =========================================================
   GALERIE
   ========================================================= */

.gallery{
  display:flex;

  gap:10px;

  flex-wrap:wrap;

  max-width:100%;

  border-radius:var(--radius);

  transition:background .12s ease, box-shadow .12s ease;
}

.gallery.drag-over{
  background:var(--blue-soft);

  box-shadow:0 0 0 2px var(--blue) inset;
}

.gallery.drag-over .gph.add{
  border-color:var(--blue);

  color:var(--blue);
}

.gph{
  position:relative;

  width:82px;

  height:82px;

  border-radius:10px;

  overflow:hidden;

  border:
    1px solid
    var(--line);

  background:var(--surface-2);

  flex:0 0 auto;

  box-shadow:var(--shadow-xs);
}

.gph.pending{
  border-style:dashed;

  border-color:var(--blue);
}

.gph.pending::after{
  content:"";

  position:absolute;

  bottom:4px;

  left:4px;

  width:8px;

  height:8px;

  border-radius:50%;

  background:var(--blue);
}

.gph img{
  width:100%;

  height:100%;

  object-fit:cover;

  cursor:zoom-in;

  display:block;

  transition:
    transform .2s ease;
}

.gph:hover img{
  transform:scale(1.05);
}

.gph .rm{
  position:absolute;

  top:2px;

  right:2px;

  width:28px;

  height:28px;

  border-radius:50%;

  border:0;

  background:rgba(10,25,30,.7);

  color:#fff;

  font-size:.8rem;

  cursor:pointer;

  line-height:1;

  backdrop-filter:blur(4px);
}

.gph .drag{
  position:absolute;

  bottom:4px;

  left:4px;

  width:23px;

  height:23px;

  border-radius:50%;

  border:0;

  background:rgba(10,25,30,.7);

  color:#fff;

  cursor:grab;

  display:flex;

  align-items:center;

  justify-content:center;

  backdrop-filter:blur(4px);

  touch-action:none;
}

.gph .drag svg{
  width:15px;
  height:15px;
}

.gph.dragging{
  opacity:.5;

  box-shadow:
    0 0 0 2px var(--blue);

  cursor:grabbing;
}

.gph.add{
  display:flex;

  flex-direction:column;

  align-items:center;

  justify-content:center;

  gap:4px;

  color:var(--muted);

  cursor:pointer;

  font-size:.78rem;

  text-align:center;

  padding:4px;

  transition:
    border-color .15s ease,
    background .15s ease,
    color .15s ease,
    transform .15s ease;
}

.gph.add svg{
  width:20px;

  height:20px;
}

.gph.add span{
  font-size:.75rem;
}

.gph.add:hover{
  border-color:var(--blue);

  background:var(--blue-soft);

  color:var(--blue);

  transform:translateY(-1px);
}

.gph.empty{
  display:flex;

  align-items:center;

  justify-content:center;

  color:var(--muted);
}

.gph.empty svg{
  width:24px;

  height:24px;
}

@media (min-width:700px){

  .gph{
    width:96px;

    height:96px;
  }
}


/* =========================================================
   LIGHTBOX
   ========================================================= */

.lb{
  position:relative;

  padding:0;

  max-width:94vw;

  max-height:90vh;

  display:flex;

  align-items:center;

  justify-content:center;

  touch-action:pan-y;
}

.lb img{
  max-width:94vw;

  max-height:90vh;

  object-fit:contain;

  border-radius:var(--radius-s);

  display:block;

  user-select:none;

  -webkit-user-select:none;
}

dialog:has(.lb),
dialog.lb-dialog{
  padding:10px;

  background:transparent;

  border:0;

  box-shadow:none;

  width:auto;

  max-width:96vw;

  max-height:96vh;
}

.lb-close{
  position:absolute;

  top:-14px;

  right:-14px;

  width:36px;

  height:36px;

  border-radius:50%;

  border:0;

  background:var(--ink);

  color:var(--bg);

  font-size:1rem;

  cursor:pointer;

  display:grid;

  place-items:center;

  box-shadow:var(--shadow-md);

  z-index:2;
}

.lb-nav{
  position:absolute;

  top:50%;

  transform:translateY(-50%);

  width:46px;

  height:46px;

  border-radius:50%;

  border:0;

  background:rgba(7,27,32,.55);

  color:#fff;

  font-size:1.5rem;

  line-height:1;

  cursor:pointer;

  display:grid;

  place-items:center;

  z-index:2;

  backdrop-filter:blur(3px);

  transition:background .15s ease;
}

.lb-nav:hover{
  background:rgba(7,27,32,.78);
}

.lb-nav.prev{
  left:8px;
}

.lb-nav.next{
  right:8px;
}

.lb-count{
  position:absolute;

  bottom:10px;

  left:50%;

  transform:translateX(-50%);

  background:rgba(7,27,32,.6);

  color:#fff;

  padding:
    3px
    12px;

  border-radius:999px;

  font-size:.8rem;

  font-family:var(--f-cond);

  font-weight:600;

  z-index:2;
}

@media (max-width:699px){

  .lb-close{
    top:8px;

    right:8px;
  }
}


/* =========================================================
   DOCUMENTS
   ========================================================= */

.doclist{
  list-style:none;

  margin:0;

  padding:0;

  display:flex;

  flex-direction:column;

  gap:8px;
}

.doclist li{
  display:flex;

  align-items:center;

  gap:9px;

  min-width:0;
}

.doclist li svg{
  width:18px;

  height:18px;

  flex:none;

  color:var(--muted);
}

.doclist li a{
  overflow:hidden;

  text-overflow:ellipsis;

  white-space:nowrap;

  flex:1;
}


/* =========================================================
   APPARENCE — PERSONNALISATION
   ========================================================= */

.swatch{
  width:32px;

  height:32px;

  border-radius:50%;

  border:2px solid transparent;

  cursor:pointer;

  padding:0;

  box-shadow:var(--shadow-xs);

  transition:transform .12s ease;
}

.swatch:hover{
  transform:scale(1.08);
}

.swatch.on{
  border-color:var(--ink);

  box-shadow:0 0 0 2px var(--surface),0 0 0 3px var(--line-strong);
}

.swatch-custom-wrap{
  position:relative;

  display:inline-block;

  width:32px;

  height:32px;
}

.swatch.custom{
  width:32px;

  height:32px;

  background:conic-gradient(from 180deg,#c64b3d,#f2b84b,#2d8962,#197e77,#176b78,#6a4c93,#8a3a4a,#c64b3d);
}

.swatch-custom-wrap input[type=color]{
  position:absolute;

  inset:0;

  opacity:0;

  cursor:pointer;

  width:32px;

  height:32px;

  min-height:0;

  padding:0;

  border:0;
}

.fontpacks{
  display:grid;

  grid-template-columns:repeat(auto-fill,minmax(168px,1fr));

  gap:10px;
}

.fontcard{
  border:1px solid var(--line-strong);

  border-radius:var(--radius-s);

  padding:12px 14px;

  background:var(--surface);

  cursor:pointer;

  text-align:left;

  min-height:0;

  transition:border-color .15s ease,box-shadow .15s ease;
}

.fontcard:hover{
  border-color:var(--blue);
}

.fontcard.on{
  border-color:var(--blue);

  box-shadow:0 0 0 1px var(--blue);
}

.fontcard .fc-h{
  font-size:1.22rem;

  line-height:1.15;

  font-weight:700;

  margin-bottom:3px;

  color:var(--ink);
}

.fontcard .fc-b{
  font-size:.78rem;

  color:var(--muted);
}

:root[data-font="systeme"]{
  --f-body:
    -apple-system,
    "Segoe UI Variable Text",
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;

  --f-cond:
    -apple-system,
    "Segoe UI Variable Text",
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
}

:root[data-font="classique"]{
  --f-body:
    Georgia,
    "Iowan Old Style",
    "Times New Roman",
    serif;

  --f-cond:
    Georgia,
    "Iowan Old Style",
    "Times New Roman",
    serif;
}

:root[data-font="arrondie"]{
  --f-body:
    ui-rounded,
    "SF Pro Rounded",
    "Segoe UI",
    system-ui,
    sans-serif;

  --f-cond:
    ui-rounded,
    "SF Pro Rounded",
    "Segoe UI",
    system-ui,
    sans-serif;
}

.toc{
  display:flex;

  gap:8px;

  overflow-x:auto;

  padding-bottom:2px;

  margin-bottom:16px;

  scrollbar-width:none;
}

.toc::-webkit-scrollbar{
  display:none;
}

.toc-link{
  flex:0 0 auto;

  padding:
    7px
    14px;

  border:
    1px solid
    var(--line);

  border-radius:999px;

  background:var(--surface);

  color:var(--muted);

  font-weight:600;

  font-size:.86rem;

  white-space:nowrap;

  cursor:pointer;
}

.toc-link:hover{
  border-color:var(--blue);

  color:var(--blue);
}

.card[id]{
  scroll-margin-top:16px;
}

.subtabs{
  display:flex;

  gap:8px;

  margin-bottom:16px;
}

.subtabs a{
  flex:1;

  text-align:center;

  padding:
    10px
    14px;

  border:
    1px solid
    var(--line);

  border-radius:10px;

  background:var(--surface);

  color:var(--muted);

  font-weight:600;

  font-size:.92rem;

  transition:
    background .15s ease,
    border-color .15s ease,
    color .15s ease;
}

.subtabs a:hover{
  border-color:
    color-mix(
      in srgb,
      var(--blue) 30%,
      var(--line)
    );
}

.subtabs a.on{
  background:var(--blue-soft);

  border-color:var(--blue);

  color:var(--blue);
}

.densitybar{
  display:flex;

  gap:8px;

  flex-wrap:wrap;
}

.densitybar .btn{
  flex:1;

  justify-content:center;

  min-width:120px;
}

.densitybar .btn.on{
  background:var(--blue-soft);

  border-color:var(--blue);

  color:var(--blue);
}

.radiusbar{
  display:flex;

  gap:8px;

  flex-wrap:wrap;
}

.radiusbar button{
  width:54px;

  height:44px;

  border:1px solid var(--line-strong);

  background:var(--surface);

  cursor:pointer;

  transition:border-color .15s ease,box-shadow .15s ease;
}

.radiusbar button.on{
  border-color:var(--blue);

  box-shadow:0 0 0 1px var(--blue);
}

:root[data-radius="sharp"]{
  --radius:6px;
  --radius-s:4px;
  --radius-xs:3px;
}

:root[data-radius="round"]{
  --radius:22px;
  --radius-s:16px;
  --radius-xs:10px;
}

:root[data-density=compact] .card{
  padding:12px;
}

:root[data-density=compact] .btn{
  padding:6px 12px;

  min-height:37px;
}

:root[data-density=compact] .stack{
  gap:9px;
}

:root[data-density=compact] .item{
  min-height:74px;

  padding:10px 12px;
}

:root[data-density=compact] main{
  padding-top:12px;
}

@media (min-width:900px){

  :root[data-density=compact] main{
    padding:16px 32px 40px;
  }
}


/* =========================================================
   RESPONSIVE HELPERS
   ========================================================= */

.m-only{
  display:inline;
}

.d-only{
  display:none;
}

@media (min-width:900px){

  .m-only{
    display:none;
  }

  .d-only{
    display:inline;
  }

  .btn.d-only{
    display:inline-flex;
  }
}

@media (max-width:899px){

  .nav a.desk{
    display:none;
  }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width:699px){

  main{
    padding:
      18px
      12px
      96px;
  }

  h1{
    font-size:1.75rem;
  }

  h2{
    font-size:1.32rem;
  }

  .pagehead{
    margin-bottom:20px;
  }

  .card{
    padding:16px;
  }

  .grid.g4{
    grid-template-columns:
      repeat(
        2,
        minmax(0,1fr)
      );

    gap:10px;
  }

  .stat{
    min-height:130px;

    padding:15px;
  }

  .stat .n{
    font-size:2.1rem;

    margin-top:17px;
  }

  .stat .l{
    font-size:.86rem;
  }

  .stat-ic{
    width:38px;
    height:38px;
  }

  .item{
    min-height:84px;

    padding:
      11px
      12px;

    gap:11px;
  }

  .thumb{
    width:58px;
    height:58px;
  }

  .item .name{
    font-size:1rem;
  }

  .item .qty{
    font-size:1.32rem;

    min-width:40px;
  }

  .searchbar{
    margin-bottom:17px;
  }

  .searchbar input{
    height:49px;

    min-height:49px;

    padding-left:14px;
  }

  .searchbar .btn{
    width:52px;

    height:49px;

    min-height:49px;
  }

  .hero{
    gap:15px;
  }

  .qtybox .big{
    font-size:2.4rem;
  }
}


/* =========================================================
   PETITS ÉCRANS
   ========================================================= */

@media (max-width:420px){

  .g2{
    grid-template-columns:1fr;
  }

  .stat{
    min-height:120px;
  }

  .stat .n{
    font-size:1.92rem;
  }

  .item .sel{
    width:20px;
    height:20px;
  }

  .btn{
    padding-left:12px;
    padding-right:12px;
  }
}


/* =========================================================
   ANIMATIONS
   ========================================================= */

@media (prefers-reduced-motion:no-preference){

  .toast{
    animation:
      pop
      .18s
      ease-out;
  }

  @keyframes pop{

    from{
      opacity:0;

      transform:
        translate(
          -50%,
          8px
        );
    }

  }
}

/* =========================================================
   PLAN (vue de dessus d'un emplacement)
   ========================================================= */

.plan-wrap{
  position:relative;
  width:100%;
  line-height:0;
  background:var(--surface-2);
}
.plan-wrap img{
  width:100%;
  display:block;
}
.plan-wrap.armed{
  cursor:crosshair;
}
.plan-pin{
  position:absolute;
  transform:translate(-50%,-100%);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:2px;
  background:none;
  border:none;
  padding:0;
  margin:0;
  color:var(--teal-ink);
  cursor:pointer;
  line-height:normal; /* .plan-wrap force line-height:0 pour l'image, à ne pas hériter ici */
  filter:drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
.plan-pin svg{
  width:26px;
  height:26px;
  fill:currentColor;
  stroke:var(--surface);
  stroke-width:1.2;
  flex-shrink:0;
}
.plan-pin span{
  display:block;
  line-height:1.4;
  font-size:11px;
  font-weight:600;
  background:var(--surface);
  color:var(--ink);
  padding:2px 7px;
  border-radius:999px;
  box-shadow:var(--shadow-xs);
  white-space:nowrap;
  max-width:120px;
  overflow:hidden;
  text-overflow:ellipsis;
}

@media (min-width:900px){
  .plan-card{
    max-width:560px;
    margin-left:auto;
    margin-right:auto;
  }
}



/* =========================================================
   EXPLORER → ARTICLES : ligne d'article, filtres, sélection
   ========================================================= */

/* Ligne « référence · emplacement » sous le nom (remplace l'ancienne pastille de référence). */
.item .where{
  overflow:hidden;

  text-overflow:ellipsis;

  white-space:nowrap;
}

.item .where .cat-badge{
  display:inline-flex;

  vertical-align:middle;

  margin-right:5px;
}

/* En grille, la vignette est étroite : on laisse la ligne passer sur deux lignes plutôt que de tronquer l'emplacement. */
.items.grid-view .item .where{
  white-space:normal;
}

/* Panneau Filtres : deux colonnes même sur petit écran (au lieu d'une pile de champs pleine largeur). */
#filters-panel .filters-grid{
  grid-template-columns:
    repeat(
      2,
      minmax(0,1fr)
    );

  gap:12px;
}

#filters-panel .filters-grid .field{
  gap:5px;
}

@media (max-width:699px){

  #filters-panel .filters-grid{
    padding:14px;
  }

  #filters-panel .filters-grid .wide{
    grid-column:1 / -1;
  }

  #filters-panel .filters-grid select,
  #filters-panel .filters-grid input[type=text],
  #filters-panel .filters-grid input[type=number]{
    min-height:42px;

    padding:8px 10px;
  }
}

/* Barre d'actions du mode sélection. */
.selbar{
  display:flex;

  align-items:center;

  gap:12px;

  flex-wrap:wrap;
}

.selbar-actions{
  display:flex;

  gap:8px;

  flex-wrap:wrap;
}

/* Mobile / tablette : la barre reste collée en bas, juste au-dessus de la navigation, quelle que soit la
   longueur de la liste ; ses boutons défilent horizontalement plutôt que de s'empiler sur trois rangées. */
@media (max-width:899px){

  .selbar{
    position:fixed;

    left:10px;
    right:10px;

    bottom:
      calc(
        72px +
        env(safe-area-inset-bottom,0px)
      );

    z-index:15;

    flex-direction:column;

    align-items:stretch;

    gap:8px;

    padding:
      10px
      12px
      12px;

    background:var(--surface);

    border:1px solid var(--line);

    border-radius:16px;

    box-shadow:0 8px 28px rgba(16,48,55,.18);
  }

  .selbar-actions{
    flex-wrap:nowrap;

    overflow-x:auto;

    scrollbar-width:none;

    -webkit-overflow-scrolling:touch;
  }

  .selbar-actions::-webkit-scrollbar{
    display:none;
  }

  .selbar-actions .btn{
    flex:none;
  }

  /* évite que la barre fixe masque les derniers articles */
  #results.with-selbar{
    padding-bottom:120px;
  }
}


/* =========================================================
   MENU « ACTIONS » (fiches emplacement et article)
   ========================================================= */

.actions-menu{
  position:relative;
  display:inline-block;
}

.am-pop{
  position:absolute;
  right:0;
  top:calc(100% + 6px);
  z-index:50;
  min-width:250px;
  max-width:min(92vw, 340px);
  padding:6px;
  background:var(--surface);
  border:1px solid var(--line-strong);
  border-radius:var(--radius);
  box-shadow:var(--shadow-md);
}

.am-pop[hidden]{
  display:none;
}

.am-item{
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  min-height:44px;
  padding:9px 12px;
  border:0;
  border-radius:var(--radius-s);
  background:none;
  color:var(--ink);
  font:inherit;
  font-weight:600;
  text-align:left;
  text-decoration:none;
  cursor:pointer;
}

.am-item svg{
  flex:none;
  width:20px;
  height:20px;
  color:var(--muted);
}

.am-item:hover,
.am-item:focus-visible{
  background:var(--surface-2);
  text-decoration:none;
  outline:none;
}

.am-item.danger,
.am-item.danger svg{
  color:var(--red-ink);
}

.am-item.danger:hover,
.am-item.danger:focus-visible{
  background:var(--red-soft);
}

.am-pop hr{
  margin:6px 4px;
  border:0;
  border-top:1px solid var(--line);
}

/* Réglages › Utilisateurs : une ligne légère, les actions sont dans le menu « ⋯ ». */
.user-row{
  flex-wrap:wrap;
  align-items:flex-start;
}

.user-row select[data-role]{
  width:auto;
}

.user-row .actions-menu{
  flex:none;
}

.am-more{
  min-width:44px;
  justify-content:center;
  padding-inline:10px;
}

@media (max-width:699px){
  /* Ligne 1 : nom + « ⋯ » ; ligne 2 : infos ; ligne 3 : rôle en pleine largeur. */
  .user-row .actions-menu{
    order:2;
  }

  .user-row select[data-role]{
    order:3;
    flex:1 0 100%;
    width:100%;
  }
}

/* Galerie vide : une seule ligne « Ajouter une photo » au lieu de deux tuiles. */
.gallery.gallery-empty{
  display:block;
}

.gallery.gallery-empty:empty{
  display:none;
}

.add-photo-line{
  width:100%;
  justify-content:flex-start;
  color:var(--muted);
}

/* Plan absent : ligne repliée. */
.plan-line{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:8px 12px;
  flex-wrap:wrap;
}

.plan-line .muted{
  flex:1 1 auto;
}


/* =========================================================
   PAGE ACHATS : cases à cocher, familles, ajout rapide
   ========================================================= */
.shop-fam{
  margin:10px 0 0;
  font-size:.95rem;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--muted);
}
.shop-fam .muted{ font-weight:400; }
.shop-check{
  width:22px;
  height:22px;
  flex:none;
  accent-color:var(--green);
}
.shop-line{ padding:12px 14px; }
.shop-line.picked{
  background:var(--green-soft);
  border-color:var(--green);
}
.shop-line.picked .grow b{ text-decoration:line-through; text-decoration-thickness:1px; }
.shop-price{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:8px;
  padding-left:34px;
}
.shop-price.hidden{ display:none; }
.shop-add{ position:relative; margin-bottom:14px; }
.shop-sugg{
  position:absolute;
  left:0;
  right:0;
  top:calc(100% + 4px);
  z-index:20;
  margin:0;
  padding:4px;
  list-style:none;
  background:var(--surface);
  border:1px solid var(--line-strong);
  border-radius:var(--radius-s);
  box-shadow:var(--shadow-md);
  max-height:50vh;
  overflow-y:auto;
}
.shop-sugg.hidden{ display:none; }
.shop-sugg li[role=option]{
  padding:10px 12px;
  border-radius:var(--radius-xs);
  cursor:pointer;
}
.shop-sugg li[role=option].active,
.shop-sugg li[role=option]:hover{ background:var(--blue-soft); }
.shop-sugg li.off{ opacity:.55; cursor:default; }
@media (max-width:899px){
  #shop-list.with-selbar{ padding-bottom:120px; }
}
@media (min-width:900px){
  #shop-bar{
    position:sticky;
    top:8px;
    z-index:15;
    margin-bottom:12px;
    padding:10px 14px;
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:var(--radius);
    box-shadow:var(--shadow-sm);
  }
}


/* Réglages → Notifications : une ligne par type, avec interrupteur */
.switchrow{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 0;
  border-top:1px solid var(--line);
  cursor:pointer;
}
.switchrow:first-child{border-top:0}
.switch{
  appearance:none;
  -webkit-appearance:none;
  flex:none;
  width:42px;
  height:24px;
  border-radius:999px;
  background:rgba(127,127,127,.45);
  position:relative;
  cursor:pointer;
  transition:background .15s;
}
.switch::after{
  content:"";
  position:absolute;
  top:3px;
  left:3px;
  width:18px;
  height:18px;
  border-radius:50%;
  background:#fff;
  transition:transform .15s;
}
.switch:checked{background:var(--blue)}
.switch:checked::after{transform:translateX(18px)}
.switch:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.switch:disabled{opacity:.6}


/* =========================================================
   RÉGLAGES — groupes (Moi / Données / Administration)
   ========================================================= */

.settings-body{
  display:flex;

  flex-direction:column;

  gap:30px;

  min-width:0;
}

.sgroup-title{
  margin:0;

  padding-bottom:8px;

  border-bottom:1px solid var(--line);

  font-size:.82rem;

  letter-spacing:.09em;

  text-transform:uppercase;

  color:var(--muted);
}

.ctitle{
  font-size:1.45rem;
}

.toc-group{
  display:contents;
}

.toc-group-title{
  display:none;
}

.toc-link.on{
  border-color:var(--blue);

  background:var(--blue-soft);

  color:var(--blue);
}

.sgroup[id]{
  scroll-margin-top:16px;
}

@media (min-width:900px){

  .settings{
    display:grid;

    grid-template-columns:190px minmax(0,1fr);

    gap:40px;

    align-items:start;
  }

  .settings-body{
    max-width:860px;
  }

  .settings .toc{
    position:sticky;

    top:24px;

    flex-direction:column;

    gap:18px;

    overflow:visible;

    margin:0;

    padding:0;
  }

  .toc-group{
    display:flex;

    flex-direction:column;

    gap:2px;
  }

  .toc-group-title{
    display:block;

    margin-bottom:4px;

    padding:0 10px;

    font-family:var(--f-cond);

    font-size:.75rem;

    font-weight:700;

    letter-spacing:.09em;

    text-transform:uppercase;

    color:var(--muted);
  }

  .settings .toc-link{
    padding:7px 10px;

    border:0;

    border-left:2px solid transparent;

    border-radius:0 var(--radius-s) var(--radius-s) 0;

    background:none;

    text-align:left;

    white-space:normal;
  }

  .settings .toc-link:hover{
    background:var(--surface-2);
  }

  .settings .toc-link.on{
    border-left-color:var(--blue);

    background:var(--blue-soft);
  }
}


/* Réglages → Sessions actives : une ligne par appareil connecté */
.sessrow{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 0;
  border-top:1px solid var(--line);
}
.sessrow:first-child{border-top:0}
.sessrow .grow{min-width:0;overflow-wrap:anywhere}
.sessrow .btn{flex:none}

/* Rappel sauvegarde : pastille sur le sommaire des réglages + ligne discrète sur l'accueil */
.toc-dot{display:inline-block;width:7px;height:7px;margin-left:6px;border-radius:50%;background:var(--amber);vertical-align:middle}
.backup-hint{display:block;margin:-6px 0 16px;color:var(--muted)}

/* Import / restauration : indicateur persistant, aperçu, liste des problèmes */
dialog.busy{max-width:min(92vw,380px);padding:26px 30px}
dialog.busy::backdrop{background:rgba(7,27,32,.72)}
.spinner{width:34px;height:34px;border-radius:50%;border:3px solid var(--line);border-top-color:var(--blue);animation:rg-spin .9s linear infinite}
@keyframes rg-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.spinner{animation-duration:3s}}
.progress{width:min(240px,70vw);height:8px;border-radius:99px;background:var(--line);overflow:hidden}
.progress span{display:block;height:100%;width:0;background:var(--blue);transition:width .2s}
dialog:has(.report){max-width:min(680px,96vw)}
.tablewrap{overflow-x:auto;margin-top:6px}
.previewtable{border-collapse:collapse;width:100%;font-size:.85rem}
.previewtable th,.previewtable td{text-align:left;padding:4px 8px;border-bottom:1px solid var(--line);white-space:nowrap}
.issue-list{margin:0;padding-left:18px;max-height:190px;overflow:auto;font-size:.85rem}
.issue-list li{margin:4px 0}


/* Scanner : voile de confirmation atténué si l'utilisateur demande moins d'animations */
@media (prefers-reduced-motion:reduce){
  .scanwrap::after{ transition:none; }
  .scanwrap.ok::after,
  .scanwrap.bad::after{ opacity:.12; }
}


/* Scanner : le panneau de choix / d'ajustement s'affiche sous la caméra ; on garde de la place pour la
   barre de navigation fixe du bas quand on le fait défiler dans l'écran. */
#scan-choice{
  scroll-margin-bottom:calc(88px + env(safe-area-inset-bottom,0px));
}


/* Journal : filtres en puces (défilent à l'horizontale sur mobile), jours en sections, heure seule dans les lignes. */
.hist-filters{
  display:flex;
  gap:8px;
  margin:0 0 14px;
  padding-bottom:4px;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin;
}

.hist-filters .btn{
  flex:0 0 auto;
  white-space:nowrap;
}

.hist-day h3{
  margin:16px 0 2px;
  font-family:var(--f-cond);
  font-size:.82rem;
  font-weight:600;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--muted);
}

.hist-day:first-child h3{
  margin-top:2px;
}

.hist.grouped li{
  grid-template-columns:48px 1fr;
}


/* Journal : filtres personne / période, export, bouton « Annuler » d'une ligne. */
.hist-tools{
  display:flex;
  flex-wrap:wrap;
  gap:10px 12px;
  align-items:flex-end;
  margin:0 0 14px;
}

.hist-tools label{
  display:flex;
  flex-direction:column;
  gap:3px;
  font-size:.78rem;
  color:var(--muted);
}

.hist-tools select,
.hist-tools input{
  min-height:36px;
  padding:4px 8px;
  border:1px solid var(--line-strong);
  border-radius:8px;
  background:var(--surface);
  color:var(--ink);
  font:inherit;
  font-size:.92rem;
}

.hist-undo{
  margin-left:6px;
  padding:0;
  border:0;
  background:none;
  color:var(--blue);
  font:inherit;
  font-size:.86rem;
  font-weight:600;
  text-decoration:underline;
  cursor:pointer;
}

.hist-undo:disabled{
  opacity:.5;
  cursor:default;
}


/* Commande à deux choix (Scanner : action après un scan). Une seule ligne, l'état actif se lit d'un coup d'œil. */
.seg-row{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
  gap:6px 10px;
}

.seg{
  display:inline-flex;
  gap:2px;
  padding:3px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface-3);
}

.seg button{
  min-height:32px;
  padding:4px 16px;
  border:0;
  border-radius:999px;
  background:transparent;
  color:var(--muted);
  font:inherit;
  font-size:.88rem;
  font-weight:600;
  white-space:nowrap;
  cursor:pointer;
  transition:background .15s ease, color .15s ease;
}

.seg button[aria-pressed="true"]{
  background:var(--blue);
  color:var(--blue-ink);
  box-shadow:0 1px 2px rgba(0,0,0,.2);
}

.seg button:focus-visible{
  outline:2px solid var(--blue);
  outline-offset:2px;
}

/* Réglages → Sauvegardes : une ligne par sauvegarde (date, taille, Télécharger, Restaurer) */
.bk-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.bk-list li{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0}
.bk-list .bk-when{flex:1 1 190px;min-width:0}
.bk-list .bk-contents{display:block}
.bk-config{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.bk-config select{width:auto}

/* ---------- champs mot de passe : bouton Afficher/Masquer et indicateur de robustesse ---------- */
.pwwrap{position:relative;display:flex;align-items:center}
.pwwrap input{padding-right:5.2rem}
.pwtoggle{position:absolute;right:6px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:var(--blue);
  font:inherit;font-size:.8rem;font-weight:600;padding:6px 8px;border-radius:6px;cursor:pointer;min-height:32px}
.pwtoggle:hover{background:var(--blue-soft)}
.pwmeter{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;margin-top:6px}
.pwmeter[data-level=""]{display:none}
.pwbar{flex:1 1 120px;height:6px;border-radius:3px;background:var(--line);overflow:hidden}
.pwbar i{display:block;height:100%;width:0;border-radius:3px;background:var(--red);transition:width .15s ease,background-color .15s ease}
.pwmeter[data-level="1"] .pwbar i{background:var(--amber)}
.pwmeter[data-level="2"] .pwbar i{background:var(--blue)}
.pwmeter[data-level="3"] .pwbar i{background:var(--green)}
.pwmeter .pwlabel{font-weight:600}
.pwmeter .pwtip{flex-basis:100%}
.pwmeter .pwtip:empty{display:none}


/* Réglages : pastille de portée (cet appareil / mon compte / tout le monde) et aides repliables */
.ctitle-row{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px}
.ctitle-row .ctitle{margin:0}
.scope{display:inline-flex;align-items:center;border:1px solid var(--line);border-radius:999px;padding:2px 10px;font-size:.78rem;line-height:1.4;color:var(--muted);background:var(--surface-2);white-space:nowrap}
.scope-account{color:var(--blue);background:var(--blue-soft);border-color:var(--blue)}
.scope-all{color:var(--amber-ink);border-color:var(--amber)}
details.help>summary{cursor:pointer;display:inline-block;color:var(--muted);font-size:.85rem;list-style:none}
details.help>summary::-webkit-details-marker{display:none}
details.help>summary::before{content:"? ";font-weight:600}
details.help[open]>summary{margin-bottom:6px}
details.help>summary:focus-visible{outline:2px solid var(--blue);outline-offset:2px;border-radius:4px}

/* Réglages : sous-sections repliables (carte Double authentification) et blocs (carte Sécurité) */
.subsec{border-top:1px solid var(--line)}
.subsec>summary{cursor:pointer;display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 10px;padding:11px 0;list-style:none;font-weight:600}
.subsec>summary::-webkit-details-marker{display:none}
.subsec>summary::before{content:"▸";display:inline-block;width:1em;color:var(--muted);transition:transform .15s ease}
.subsec[open]>summary::before{transform:rotate(90deg)}
.subsec>summary:focus-visible{outline:2px solid var(--blue);outline-offset:2px;border-radius:4px}
.subsec-body{padding:0 0 12px 1em}
.secblock{border-top:1px solid var(--line);padding-top:14px}
.secblock-t{margin:0;font-size:1rem}
@media (prefers-reduced-motion:reduce){.subsec>summary::before{transition:none}}

/* Zones tactiles : 44 px minimum sur les appareils à pointeur grossier (recommandation iOS/WCAG 2.5.5) */
@media (pointer:coarse){
  .btn.small{min-height:44px}
}

/* Zones tactiles ≥ 44 px sur mobile (pointeur grossier ou écran étroit) : boutons (43 px par défaut), case « Faire
   confiance à cet appareil », liste « Cet appareil n'a pas ma passkey ? », « Annuler » des notifications, champs. */
@media (pointer:coarse),(max-width:699px){
  .btn,.btn.small{min-height:44px}
  input[type=text],input[type=password],input[type=search],input[type=number],input[type=tel],input[type=email],select{min-height:48px}
  .loginbox label.row,dialog label.row{min-height:44px;align-items:center}
  .loginbox input[type=checkbox],dialog input[type=checkbox]{width:22px;height:22px;flex:none}
  .subsec>summary{min-height:44px;align-items:center}
  .toast-undo{min-height:44px;min-width:44px;padding:10px 8px}
}

/* Explorer : bouton « Afficher plus » sous la liste */
.more-wrap{display:flex;justify-content:center;padding:18px 0 6px}
.more-wrap .btn{min-width:min(100%,320px);min-height:44px}

/* Formulaire article : la barre « Enregistrer » reste visible en bas de l'écran pendant qu'on remplit le formulaire.
   position:sticky (et non fixed) : elle garde sa place naturelle en fin de formulaire, ne masque aucun champ
   et n'exige aucun padding supplémentaire. Sur mobile/tablette elle se cale juste au-dessus de la navigation basse. */
.formbar{
  position:sticky;
  bottom:calc(72px + env(safe-area-inset-bottom,0px));
  z-index:10;
  flex-wrap:nowrap;
  padding:10px 12px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:0 8px 28px rgba(16,48,55,.18);
}
.formbar .btn{flex:none}
.formbar .btn.primary{flex:1 1 auto}
@media (min-width:900px){
  .formbar{bottom:12px}
}
/* Le toast (bas de l'écran) ne doit pas recouvrir la barre d'enregistrement */
body:has(.formbar) .toast{bottom:calc(150px + env(safe-area-inset-bottom,0px))}
@media (min-width:900px){
  body:has(.formbar) .toast{bottom:88px}
}

/* Erreurs de champ en ligne (message + aria-invalid). Le pictogramme « ! » évite de ne signaler l'erreur que par la couleur. */
.field-err{
  display:flex;
  align-items:flex-start;
  gap:7px;
  margin:6px 0 0;
  font-size:.9rem;
  line-height:1.35;
  color:var(--red-ink);
}
.field-err::before{
  content:"!";
  flex:none;
  width:17px;
  height:17px;
  margin-top:1px;
  border-radius:50%;
  background:var(--red-ink);
  color:var(--surface);
  font-size:.75rem;
  font-weight:700;
  line-height:17px;
  text-align:center;
}
.field [aria-invalid="true"],
.loginbox [aria-invalid="true"]{
  border-color:var(--red);
  box-shadow:0 0 0 1px var(--red);
}
.lock-count{
  font-variant-numeric:tabular-nums;
}
.form-err{
  margin:0;
  padding:9px 12px;
  border:1px solid color-mix(in srgb,var(--red) 45%,var(--line));
  border-radius:var(--radius-s);
  background:var(--red-soft);
  color:var(--red-ink);
  font-size:.92rem;
}

/* Écrans de connexion : le logo a un fond transparent et des barres bleu nuit, qui disparaissent sur fond sombre.
   En thème sombre on le pose sur une pastille claire (même règle pour le choix automatique et le choix manuel). */
@media (prefers-color-scheme:dark){
  :root:not([data-theme=light]) .login-logo{
    box-sizing:content-box;
    padding:7px;
    border-radius:16px;
    background:#eef4f4;
  }
}
:root[data-theme=dark] .login-logo{
  box-sizing:content-box;
  padding:7px;
  border-radius:16px;
  background:#eef4f4;
}


/* =========================================================
   PROPOSITION DE PASSKEY (après une connexion par mot de passe)
   Carte discrète au-dessus des toasts (bottom:88px), jamais bloquante.
   ========================================================= */

.pk-nudge{
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  bottom:calc(150px + env(safe-area-inset-bottom,0px));
  width:min(420px,92vw);
  box-sizing:border-box;
  z-index:50;
  background:var(--surface);
  color:var(--ink);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:14px 16px;
  box-shadow:var(--shadow-md);
}

.pk-nudge-t{
  margin:0 0 4px;
  font-weight:700;
}

.pk-nudge-b{
  margin:0 0 12px;
  font-size:.92rem;
  color:var(--muted);
}

.pk-nudge-a{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
}

.pk-nudge-never{
  margin-left:auto;
  background:none;
  border-color:transparent;
  color:var(--muted);
}

@media print{
  .pk-nudge{display:none}
}


/* =========================================================
   PAGE D'INVITATION : trois étapes visibles
   ========================================================= */

.inv-steps{
  list-style:none;
  margin:4px 0 16px;
  padding:0;
  display:flex;
  gap:6px;
}

.inv-step{
  flex:1;
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  text-align:center;
  font-size:.82rem;
  color:var(--muted);
}

/* trait entre deux pastilles : coloré quand l'étape précédente est terminée */
.inv-step + .inv-step::before{
  content:"";
  position:absolute;
  top:14px;
  right:50%;
  width:100%;
  height:2px;
  background:var(--line-strong);
}

.inv-step.done + .inv-step::before{
  background:var(--blue);
}

.inv-dot{
  position:relative;
  z-index:1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:30px;
  height:30px;
  box-sizing:border-box;
  border-radius:50%;
  border:2px solid var(--line-strong);
  background:var(--surface);
  font-weight:700;
}

.inv-step.cur .inv-dot{
  background:var(--blue);
  border-color:var(--blue);
  color:var(--blue-ink);
}

.inv-step.done .inv-dot{
  background:var(--blue-soft);
  border-color:var(--blue);
  color:var(--blue);
}

.inv-step.cur .inv-lab{
  color:var(--ink);
  font-weight:700;
}

.inv-panel h2:focus{
  outline:none;
}

.inv-opt{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface-2);
}

/* texte réservé aux lecteurs d'écran */
.inv-sr{
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip:rect(0 0 0 0);
  white-space:nowrap;
}

/* Bouton occupé (voir busyBtn dans app.js) : indicateur discret dans le bouton, inactif tant que l'opération dure. */
.spinner-sm{width:1em;height:1em;flex:none;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:rg-spin .8s linear infinite}
.btn.is-busy,.btn[aria-busy="true"]{opacity:.7;pointer-events:none}
@media (prefers-reduced-motion:reduce){.spinner-sm{animation-duration:2.4s}}


/* État de la sécurité : noms et actions des constats */
.linkish{
  display:inline;
  margin:0;
  padding:0;
  border:0;
  background:none;
  font:inherit;
  color:var(--blue);
  text-decoration:underline;
  text-underline-offset:2px;
  cursor:pointer;
}
.linkish:hover{
  color:var(--blue-hover);
}
.sec-wholist{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:0;
  list-style:none;
}
.sec-who .linkish{
  font-size:.92rem;
}
/* Ligne d'utilisateur désignée par un constat : surlignée un instant (sans animation : « mouvement réduit » respecté) */
.user-row{
  scroll-margin-top:16px;
}
.user-row.row-flash{
  background:var(--amber-bg);
  box-shadow:inset 3px 0 0 var(--amber);
}
.user-row:focus{
  outline:none;
}
.user-row:focus-visible{
  outline:2px solid var(--blue);
  outline-offset:-2px;
}

/* =========================================================
   PALETTES (Réglages → Apparence) — généré, une ambiance complète en clair + sombre.
   data-palette est posé sur <html> ; sans palette, les couleurs ci-dessus s'appliquent.
   ========================================================= */

/* Forêt */
:root[data-palette=foret]{
  --bg:#f3f6f1;
  --surface:#ffffff;
  --surface-2:#eef3ea;
  --surface-3:#e0e9db;
  --ink:#1b2a1c;
  --muted:#556655;
  --line:#d6e0d1;
  --line-strong:#bccab5;
  --blue:#2f6b3a;
  --blue-hover:#25572f;
  --blue-soft:#e2f0e0;
  --blue-ink:#ffffff;
  --nav:#1f3d2a;
  --nav-hover:#2a5238;
  --nav-active:#e3f0df;
  --nav-active-ink:#1d4128;
  --nav-text:#d8e8d6;
  --nav-muted:#9bb89d;
}

@media (prefers-color-scheme:dark){
  :root[data-palette=foret]:not([data-theme=light]){
    --bg:#0f1a12;
    --surface:#18271c;
    --surface-2:#1e3123;
    --surface-3:#2a4030;
    --ink:#eaf3e8;
    --muted:#9db39f;
    --line:#2c4432;
    --line-strong:#41604a;
    --blue:#7bc68a;
    --blue-hover:#93d4a0;
    --blue-soft:#1c3a25;
    --blue-ink:#08170c;
    --nav:#0a1f12;
    --nav-hover:#133020;
    --nav-active:#23472f;
    --nav-active-ink:#e8f6e8;
    --nav-text:#d6e8d8;
    --nav-muted:#8fae94;
    color-scheme:dark;
  }
}

:root[data-palette=foret][data-theme=dark]{
  --bg:#0f1a12;
  --surface:#18271c;
  --surface-2:#1e3123;
  --surface-3:#2a4030;
  --ink:#eaf3e8;
  --muted:#9db39f;
  --line:#2c4432;
  --line-strong:#41604a;
  --blue:#7bc68a;
  --blue-hover:#93d4a0;
  --blue-soft:#1c3a25;
  --blue-ink:#08170c;
  --nav:#0a1f12;
  --nav-hover:#133020;
  --nav-active:#23472f;
  --nav-active-ink:#e8f6e8;
  --nav-text:#d6e8d8;
  --nav-muted:#8fae94;
  color-scheme:dark;
}

/* Sable */
:root[data-palette=sable]{
  --bg:#f7f3ec;
  --surface:#fffdf9;
  --surface-2:#f2ece0;
  --surface-3:#e8dfcd;
  --ink:#2b2419;
  --muted:#6a5e4b;
  --line:#e2d8c4;
  --line-strong:#cdbfa5;
  --blue:#9a5b1f;
  --blue-hover:#7f4915;
  --blue-soft:#f6e7d3;
  --blue-ink:#ffffff;
  --nav:#3b2f20;
  --nav-hover:#4d3e2a;
  --nav-active:#f3e8d6;
  --nav-active-ink:#4a3519;
  --nav-text:#eadfcb;
  --nav-muted:#b7a78a;
}

@media (prefers-color-scheme:dark){
  :root[data-palette=sable]:not([data-theme=light]){
    --bg:#1a1610;
    --surface:#251f17;
    --surface-2:#2d261c;
    --surface-3:#3a3125;
    --ink:#f3ece0;
    --muted:#b0a28a;
    --line:#3c3326;
    --line-strong:#54483a;
    --blue:#e0a35c;
    --blue-hover:#ebb675;
    --blue-soft:#3d2e18;
    --blue-ink:#231605;
    --nav:#14100a;
    --nav-hover:#241d13;
    --nav-active:#43361f;
    --nav-active-ink:#f6ecd9;
    --nav-text:#e9dfcb;
    --nav-muted:#a89a80;
    color-scheme:dark;
  }
}

:root[data-palette=sable][data-theme=dark]{
  --bg:#1a1610;
  --surface:#251f17;
  --surface-2:#2d261c;
  --surface-3:#3a3125;
  --ink:#f3ece0;
  --muted:#b0a28a;
  --line:#3c3326;
  --line-strong:#54483a;
  --blue:#e0a35c;
  --blue-hover:#ebb675;
  --blue-soft:#3d2e18;
  --blue-ink:#231605;
  --nav:#14100a;
  --nav-hover:#241d13;
  --nav-active:#43361f;
  --nav-active-ink:#f6ecd9;
  --nav-text:#e9dfcb;
  --nav-muted:#a89a80;
  color-scheme:dark;
}

/* Ardoise */
:root[data-palette=ardoise]{
  --bg:#f1f3f6;
  --surface:#ffffff;
  --surface-2:#eceff3;
  --surface-3:#dfe4ea;
  --ink:#1d2530;
  --muted:#5a6574;
  --line:#d8dde4;
  --line-strong:#bfc7d1;
  --blue:#3d5a80;
  --blue-hover:#2f4866;
  --blue-soft:#e4eaf2;
  --blue-ink:#ffffff;
  --nav:#25303d;
  --nav-hover:#324052;
  --nav-active:#e6ebf2;
  --nav-active-ink:#25354a;
  --nav-text:#dbe2ec;
  --nav-muted:#9aa8bb;
}

@media (prefers-color-scheme:dark){
  :root[data-palette=ardoise]:not([data-theme=light]){
    --bg:#0f1318;
    --surface:#181e26;
    --surface-2:#1e2630;
    --surface-3:#2a3441;
    --ink:#e9edf3;
    --muted:#9aa6b6;
    --line:#2b3541;
    --line-strong:#404d5d;
    --blue:#8fb0dc;
    --blue-hover:#a5c0e5;
    --blue-soft:#1f3049;
    --blue-ink:#08121f;
    --nav:#0b0f14;
    --nav-hover:#161d26;
    --nav-active:#2a3748;
    --nav-active-ink:#eaf0f8;
    --nav-text:#dae1ec;
    --nav-muted:#8c9bb0;
    color-scheme:dark;
  }
}

:root[data-palette=ardoise][data-theme=dark]{
  --bg:#0f1318;
  --surface:#181e26;
  --surface-2:#1e2630;
  --surface-3:#2a3441;
  --ink:#e9edf3;
  --muted:#9aa6b6;
  --line:#2b3541;
  --line-strong:#404d5d;
  --blue:#8fb0dc;
  --blue-hover:#a5c0e5;
  --blue-soft:#1f3049;
  --blue-ink:#08121f;
  --nav:#0b0f14;
  --nav-hover:#161d26;
  --nav-active:#2a3748;
  --nav-active-ink:#eaf0f8;
  --nav-text:#dae1ec;
  --nav-muted:#8c9bb0;
  color-scheme:dark;
}

/* Océan */
:root[data-palette=ocean]{
  --bg:#eef6fb;
  --surface:#ffffff;
  --surface-2:#e8f1f8;
  --surface-3:#d6e6f2;
  --ink:#0f2638;
  --muted:#4f6679;
  --line:#cfe0ec;
  --line-strong:#b0c9db;
  --blue:#0b6fb8;
  --blue-hover:#095a96;
  --blue-soft:#dbeefb;
  --blue-ink:#ffffff;
  --nav:#0a3a5c;
  --nav-hover:#0f4b75;
  --nav-active:#dcedfa;
  --nav-active-ink:#0b3f66;
  --nav-text:#d3e8f6;
  --nav-muted:#8fb7d3;
}

@media (prefers-color-scheme:dark){
  :root[data-palette=ocean]:not([data-theme=light]){
    --bg:#08141f;
    --surface:#0f2232;
    --surface-2:#142c40;
    --surface-3:#1d3b53;
    --ink:#e8f3fb;
    --muted:#94b2c8;
    --line:#1f3a50;
    --line-strong:#345470;
    --blue:#52b3f0;
    --blue-hover:#75c4f5;
    --blue-soft:#123652;
    --blue-ink:#04131f;
    --nav:#051a2b;
    --nav-hover:#0c2c45;
    --nav-active:#194a6b;
    --nav-active-ink:#e6f4fd;
    --nav-text:#d3e8f6;
    --nav-muted:#84aac4;
    color-scheme:dark;
  }
}

:root[data-palette=ocean][data-theme=dark]{
  --bg:#08141f;
  --surface:#0f2232;
  --surface-2:#142c40;
  --surface-3:#1d3b53;
  --ink:#e8f3fb;
  --muted:#94b2c8;
  --line:#1f3a50;
  --line-strong:#345470;
  --blue:#52b3f0;
  --blue-hover:#75c4f5;
  --blue-soft:#123652;
  --blue-ink:#04131f;
  --nav:#051a2b;
  --nav-hover:#0c2c45;
  --nav-active:#194a6b;
  --nav-active-ink:#e6f4fd;
  --nav-text:#d3e8f6;
  --nav-muted:#84aac4;
  color-scheme:dark;
}

/* Corail */
:root[data-palette=corail]{
  --bg:#fdf4f1;
  --surface:#ffffff;
  --surface-2:#fbece7;
  --surface-3:#f4dbd3;
  --ink:#2e1a17;
  --muted:#765650;
  --line:#f0d9d2;
  --line-strong:#e3bfb5;
  --blue:#c2452f;
  --blue-hover:#a43723;
  --blue-soft:#fde5df;
  --blue-ink:#ffffff;
  --nav:#5a2420;
  --nav-hover:#70302a;
  --nav-active:#fde7e1;
  --nav-active-ink:#6a2a22;
  --nav-text:#f7dcd5;
  --nav-muted:#d6a59b;
}

@media (prefers-color-scheme:dark){
  :root[data-palette=corail]:not([data-theme=light]){
    --bg:#1a0f0e;
    --surface:#271817;
    --surface-2:#301e1c;
    --surface-3:#402a27;
    --ink:#fbeeeb;
    --muted:#c0a29d;
    --line:#432c29;
    --line-strong:#5e403b;
    --blue:#ff8f78;
    --blue-hover:#ffa592;
    --blue-soft:#4a2520;
    --blue-ink:#2a0a05;
    --nav:#140807;
    --nav-hover:#2b1513;
    --nav-active:#4d2823;
    --nav-active-ink:#ffebe6;
    --nav-text:#f5dbd5;
    --nav-muted:#c49a92;
    color-scheme:dark;
  }
}

:root[data-palette=corail][data-theme=dark]{
  --bg:#1a0f0e;
  --surface:#271817;
  --surface-2:#301e1c;
  --surface-3:#402a27;
  --ink:#fbeeeb;
  --muted:#c0a29d;
  --line:#432c29;
  --line-strong:#5e403b;
  --blue:#ff8f78;
  --blue-hover:#ffa592;
  --blue-soft:#4a2520;
  --blue-ink:#2a0a05;
  --nav:#140807;
  --nav-hover:#2b1513;
  --nav-active:#4d2823;
  --nav-active-ink:#ffebe6;
  --nav-text:#f5dbd5;
  --nav-muted:#c49a92;
  color-scheme:dark;
}

/* Violet */
:root[data-palette=violet]{
  --bg:#f6f3fb;
  --surface:#ffffff;
  --surface-2:#f0ecf8;
  --surface-3:#e3dcf1;
  --ink:#231a35;
  --muted:#645879;
  --line:#e0d9ee;
  --line-strong:#c8bddf;
  --blue:#6b3fb5;
  --blue-hover:#57319a;
  --blue-soft:#ece3fa;
  --blue-ink:#ffffff;
  --nav:#2e1d52;
  --nav-hover:#3d2870;
  --nav-active:#ece4fa;
  --nav-active-ink:#36206a;
  --nav-text:#e4dcf5;
  --nav-muted:#ab9bd0;
}

@media (prefers-color-scheme:dark){
  :root[data-palette=violet]:not([data-theme=light]){
    --bg:#120e1c;
    --surface:#1c1630;
    --surface-2:#241c3b;
    --surface-3:#31274f;
    --ink:#f0ebfa;
    --muted:#a89dc4;
    --line:#32284d;
    --line-strong:#4a3d70;
    --blue:#b394f2;
    --blue-hover:#c4aaf6;
    --blue-soft:#2c2150;
    --blue-ink:#150a2b;
    --nav:#0d0818;
    --nav-hover:#1c1230;
    --nav-active:#382a60;
    --nav-active-ink:#f1ebfd;
    --nav-text:#e2d9f4;
    --nav-muted:#9a8cc0;
    color-scheme:dark;
  }
}

:root[data-palette=violet][data-theme=dark]{
  --bg:#120e1c;
  --surface:#1c1630;
  --surface-2:#241c3b;
  --surface-3:#31274f;
  --ink:#f0ebfa;
  --muted:#a89dc4;
  --line:#32284d;
  --line-strong:#4a3d70;
  --blue:#b394f2;
  --blue-hover:#c4aaf6;
  --blue-soft:#2c2150;
  --blue-ink:#150a2b;
  --nav:#0d0818;
  --nav-hover:#1c1230;
  --nav-active:#382a60;
  --nav-active-ink:#f1ebfd;
  --nav-text:#e2d9f4;
  --nav-muted:#9a8cc0;
  color-scheme:dark;
}


/* Cartes de palette (aperçu clair | sombre) */
.palettes{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(132px,1fr));
  gap:10px;
}

.palcard{
  display:block;
  width:100%;
  padding:8px;
  text-align:left;
  font:inherit;
  color:var(--ink);
  background:var(--surface);
  border:1.5px solid var(--line);
  border-radius:var(--radius-s);
  cursor:pointer;
  transition:border-color .15s ease,box-shadow .15s ease;
}

.palcard:hover:not(:disabled){
  border-color:var(--blue);
}

.palcard.on{
  border-color:var(--blue);
  box-shadow:0 0 0 1px var(--blue);
}

.palcard:disabled{
  opacity:.55;
  cursor:not-allowed;
}

.pal-prev{
  display:grid;
  grid-template-columns:1fr 1fr;
  height:46px;
  margin-bottom:7px;
  overflow:hidden;
  border-radius:var(--radius-xs);
  border:1px solid var(--line);
}

.pal-half{
  position:relative;
  background:var(--p-bg);
}

.pal-half::before{
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width:28%;
  background:var(--p-nav);
}

.pal-half::after{
  content:"";
  position:absolute;
  left:40%;
  right:10%;
  top:30%;
  height:14px;
  border-radius:7px;
  background:var(--p-accent);
  box-shadow:0 14px 0 -3px var(--p-surface);
}

.palcard .pc-h{
  display:block;
  font-weight:700;
  font-size:.95rem;
  line-height:1.2;
}

.palcard .pc-b{
  display:block;
  font-size:.75rem;
  color:var(--muted);
}

.lock-note{
  padding:9px 12px;
  border-radius:var(--radius-s);
  background:var(--blue-soft);
  color:var(--ink);
  font-size:.88rem;
}

/* =========================================================
   MISE EN PAGE (Réglages → Apparence) — navigation, accueil, explorer.
   Posés par paintTheme() : data-nav sur <html> (cote = défaut, aucune règle).
   Sous 900 px la barre du bas reste la seule navigation, quel que soit le choix.
   ========================================================= */

/* --- Barre du haut (≥ 900 px) --- */
@media (min-width:900px){
  :root[data-nav=haut] #app{ flex-direction:column; }
  :root[data-nav=haut] .nav{
    position:sticky; top:0; width:auto; height:auto; min-height:0;
    flex-direction:row; align-items:center; gap:4px; padding:10px 28px;
    background:var(--nav); box-shadow:0 6px 22px rgba(10,40,47,.14);
  }
  :root[data-nav=haut] .nav .brand{ padding:0 18px 0 0; font-size:1.5rem; }
  :root[data-nav=haut] .nav .brand::after{ display:none; }
  :root[data-nav=haut] .nav a{ min-height:44px; padding:0 14px; }
  :root[data-nav=haut] .nav a.on::before{ display:none; }
  :root[data-nav=haut] .nav .spacer{ margin:0; }
  :root[data-nav=haut] .nav a.scan{ order:10; margin:0 0 0 8px; min-height:44px; }
  :root[data-nav=haut] main{ padding:30px 40px 50px; width:100%; box-sizing:border-box; }
}

/* --- Barre du bas partout, y compris sur ordinateur (≥ 900 px) --- */
@media (min-width:900px){
  :root[data-nav=bas] #app{ flex-direction:column; }
  :root[data-nav=bas] .nav{
    position:fixed; top:auto; left:0; right:0; bottom:0; width:auto; height:auto; min-height:0;
    flex-direction:row; align-items:stretch; gap:0; padding:0 max(24px,calc((100vw - 760px) / 2)) env(safe-area-inset-bottom);
    background:color-mix(in srgb,var(--surface) 96%,transparent);
    border-top:1px solid var(--line); box-shadow:0 -10px 30px rgba(16,48,55,.09);
  }
  :root[data-nav=bas] .nav .brand,
  :root[data-nav=bas] .nav .spacer{ display:none; }
  :root[data-nav=bas] .nav a{
    flex:1; flex-direction:column; justify-content:center; align-items:center; gap:3px;
    min-height:0; padding:8px 2px 7px; border-radius:0;
    color:var(--muted); font-size:.8rem; font-weight:600; box-shadow:none; background:none;
  }
  :root[data-nav=bas] .nav a:hover{ background:none; color:var(--blue); }
  :root[data-nav=bas] .nav a.on{ color:var(--blue); background:none; box-shadow:none; font-weight:600; }
  :root[data-nav=bas] .nav a.on::before{ display:none; }
  :root[data-nav=bas] .nav a svg{ width:23px; height:23px; }
  :root[data-nav=bas] .nav a.scan{
    margin:0; min-height:0; background:none; box-shadow:none; color:var(--scan-ink);
  }
  :root[data-nav=bas] .nav a.scan:hover{ background:none; transform:none; box-shadow:none; }
  :root[data-nav=bas] .nav a.scan span.pill{
    background:var(--scan); border-radius:999px; padding:5px 15px; margin-top:-17px;
    box-shadow:0 3px 0 rgba(0,0,0,.13),0 6px 14px rgba(0,0,0,.09);
  }
  :root[data-nav=bas] .nav a.scan span:last-child{ color:var(--ink); }
  :root[data-nav=bas] .nav a.desk{ display:flex; }
  :root[data-nav=bas] main{ padding:34px 40px 110px; width:100%; max-width:1100px; margin:0 auto; box-sizing:border-box; }
}

/* --- Accueil en blocs (bento) --- */
.bento{
  display:grid; grid-template-columns:repeat(4,1fr); grid-auto-rows:minmax(104px,auto); gap:12px; margin-bottom:18px;
}
.bt{
  display:flex; flex-direction:column; justify-content:space-between; gap:10px;
  padding:16px; border-radius:22px; text-decoration:none; color:inherit; box-sizing:border-box;
  transition:transform .15s ease,box-shadow .15s ease;
}
.bt:hover{ transform:translateY(-2px); box-shadow:0 10px 24px rgba(10,40,47,.16); }
.bt svg{ width:26px; height:26px; }
.bt .bt-n{ font-size:1.9rem; font-weight:700; line-height:1.05; letter-spacing:-.02em; }
.bt .bt-l{ font-size:.92rem; opacity:.92; }
.bt.big{ grid-column:span 2; grid-row:span 2; }
.bt.big svg{ width:42px; height:42px; }
.bt.big .bt-n{ font-size:2.3rem; }
.bt.t-scan{ background:var(--scan); color:var(--scan-ink); }
.bt.t-a{ background:var(--blue); color:var(--blue-ink); }
.bt.t-b{ background:var(--nav); color:var(--nav-text); }
.bt.t-c{ background:color-mix(in srgb,var(--blue) 16%,var(--surface)); color:var(--ink); border:1px solid var(--line); }
.bt.t-d{ background:var(--surface); color:var(--ink); border:1px solid var(--line); }
@media (max-width:699px){
  .bento{ grid-template-columns:repeat(2,1fr); }
  .bt.big{ grid-column:span 2; grid-row:auto; min-height:120px; }
}

/* --- Accueil en plan de la maison --- */
.plan{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); grid-auto-rows:minmax(96px,auto);
  grid-auto-flow:dense; gap:0; margin-bottom:18px; padding:4px;
}
.room{
  display:flex; flex-direction:column; justify-content:space-between; gap:8px; padding:12px 14px;
  margin:-2px; background:color-mix(in srgb,var(--room,var(--blue)) 14%,var(--surface));
  border:3px solid var(--nav); border-radius:8px; color:var(--ink); text-decoration:none; box-sizing:border-box;
  transition:background .15s ease;
}
.room:hover{ background:color-mix(in srgb,var(--room,var(--blue)) 26%,var(--surface)); }
.room b{ font-size:1.1rem; line-height:1.15; }
.room span{ font-size:.88rem; color:var(--muted); }
.room.big{ grid-column:span 2; grid-row:span 2; }
.room.big b{ font-size:1.5rem; }
.plan .room:nth-child(7n+1){ --room:var(--blue); }
.plan .room:nth-child(7n+2){ --room:#c2452f; }
.plan .room:nth-child(7n+3){ --room:var(--amber); }
.plan .room:nth-child(7n+4){ --room:var(--green); }
.plan .room:nth-child(7n+5){ --room:#6b3fb5; }
.plan .room:nth-child(7n+6){ --room:#0b6fb8; }
.plan .room:nth-child(7n){ --room:var(--teal); }
.plan-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin:18px 0 10px; }

/* --- Explorer : galerie (grandes vignettes) --- */
.gallery-on .items.grid-view{ grid-template-columns:repeat(auto-fill,minmax(168px,1fr)); gap:18px; }
.gallery-on .items.grid-view .item{ border-radius:18px; }
.gallery-on .items.grid-view .item .thumb{ border-radius:14px; }

/* --- Explorer : trois volets (liste + fiche), ordinateur seulement --- */
.panes-pane{ display:none; }
@media (min-width:900px){
  .panes{ display:grid; grid-template-columns:minmax(300px,380px) 1fr; gap:22px; align-items:start; }
  .panes .panes-list{ min-width:0; }
  .panes-pane{
    display:block; position:sticky; top:20px; align-self:start; max-height:calc(100vh - 40px); overflow:auto;
    background:var(--surface); border:1px solid var(--line); border-radius:18px; padding:20px;
  }
  .panes .items .item.pane-on{ background:var(--blue-soft); outline:2px solid var(--blue); outline-offset:-2px; }
}
.pane-photo{
  width:100%; max-height:260px; aspect-ratio:16/9; object-fit:cover; border-radius:14px; background:var(--surface-2);
  display:flex; align-items:center; justify-content:center; color:var(--muted); margin-bottom:14px;
}
.pane-photo svg{ width:34px; height:34px; }
.pane-title{ margin:0 0 4px; font-size:1.6rem; letter-spacing:-.02em; }
.pane-row{ display:flex; align-items:center; justify-content:space-between; gap:14px; padding:10px 0; border-top:1px solid var(--line); font-size:.96rem; }
.pane-row span:first-child{ color:var(--muted); }
.pane-row b{ text-align:right; }
.pane-empty{ color:var(--muted); text-align:center; padding:40px 10px; }

/* --- Réglages : cartes de choix de mise en page --- */
.optgrid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px; }
.optcard{
  display:block; width:100%; padding:10px 12px; text-align:left; font:inherit; color:var(--ink);
  background:var(--surface); border:1.5px solid var(--line); border-radius:var(--radius-s); cursor:pointer;
  transition:border-color .15s ease,box-shadow .15s ease;
}
.optcard:hover:not(:disabled){ border-color:var(--blue); }
.optcard.on{ border-color:var(--blue); box-shadow:0 0 0 1px var(--blue); }
.optcard:disabled{ opacity:.55; cursor:not-allowed; }
.optcard .oc-h{ display:block; font-weight:700; font-size:.95rem; line-height:1.2; }
.optcard .oc-b{ display:block; font-size:.78rem; color:var(--muted); margin-top:2px; }

/* --- Galerie : puces de pièces --- */
.roomchips{ display:flex; flex-wrap:wrap; gap:8px; margin:2px 0 14px; }
.rchip{
  display:inline-flex; align-items:center; gap:7px; min-height:44px; padding:0 16px; border-radius:999px;
  font:inherit; font-weight:600; font-size:.95rem; color:var(--ink); background:var(--surface);
  border:1px solid var(--line); cursor:pointer; transition:background .15s ease,border-color .15s ease;
}
.rchip:hover{ border-color:var(--blue); }
.rchip.on{ background:var(--ink); border-color:var(--ink); color:var(--surface); }
.rchip .rc-n{ font-size:.8rem; font-weight:700; opacity:.7; }

/* --- Trois volets : fiche enrichie --- */
.pane-thumbs{ display:flex; gap:8px; margin:-6px 0 14px; overflow-x:auto; }
.pane-th{ flex:none; width:52px; height:52px; padding:0; border:2px solid transparent; border-radius:10px; overflow:hidden; background:none; cursor:pointer; }
.pane-th.on{ border-color:var(--blue); }
.pane-th img{ width:100%; height:100%; object-fit:cover; display:block; }
.pane-tags{ display:flex; flex-wrap:wrap; gap:6px; margin:2px 0 8px; }
.pane-where{ margin-bottom:6px; font-size:.92rem; }
.pane-where .crumbs{ margin-bottom:0; }
.pane-qty{ display:inline-flex; align-items:center; gap:10px; }
.pane-qty .btn{ min-width:44px; min-height:44px; }
.pane-notes{ margin:10px 0 0; white-space:pre-line; }
.pane-sec{ display:flex; flex-direction:column; gap:6px; margin-top:14px; padding-top:12px; border-top:1px solid var(--line); }
.pane-link{ display:flex; align-items:center; gap:8px; min-height:36px; color:var(--ink); text-decoration:none; font-size:.95rem; }
.pane-link:hover{ color:var(--blue); }
.pane-actions{ margin-top:16px; flex-wrap:wrap; }

/* =========================================================
   MODE DÉMÉNAGEMENT — cartons, scan, bilan
   ========================================================= */
.p14{ padding:14px; }
.row-link{
  display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:48px; padding:0 16px;
  color:var(--ink); text-decoration:none; border-top:1px solid var(--line);
}
.row-link:first-child{ border-top:0; }
.row-link:hover{ background:var(--surface-2); }

.mv-chip{
  display:inline-block; padding:3px 11px; border-radius:999px; font-size:.78rem; font-weight:700; white-space:nowrap;
}
.mv-st-a{ background:#e8eef0; color:#3d5159; }
.mv-st-b{ background:#dbeefb; color:#0b4f85; }
.mv-st-c{ background:#ece3fa; color:#4d2a8f; }
.mv-st-d{ background:#e2f0e0; color:#245a2e; }
.mv-st-x{ background:#fde5df; color:#9a2f1c; }
@media (prefers-color-scheme:dark){
  :root:not([data-theme=light]) .mv-st-a{ background:#2a3a40; color:#cfdde1; }
  :root:not([data-theme=light]) .mv-st-b{ background:#12344f; color:#a9d4f3; }
  :root:not([data-theme=light]) .mv-st-c{ background:#2e2350; color:#d3c3f6; }
  :root:not([data-theme=light]) .mv-st-d{ background:#1c3a22; color:#b4e0b9; }
  :root:not([data-theme=light]) .mv-st-x{ background:#4a2520; color:#ffc7bb; }
}
:root[data-theme=dark] .mv-st-a{ background:#2a3a40; color:#cfdde1; }
:root[data-theme=dark] .mv-st-b{ background:#12344f; color:#a9d4f3; }
:root[data-theme=dark] .mv-st-c{ background:#2e2350; color:#d3c3f6; }
:root[data-theme=dark] .mv-st-d{ background:#1c3a22; color:#b4e0b9; }
:root[data-theme=dark] .mv-st-x{ background:#4a2520; color:#ffc7bb; }

.mv-bar{ display:flex; height:12px; border-radius:6px; overflow:hidden; background:var(--surface-3); }
.mv-seg-livre{ background:#2f6b3a; }
.mv-seg-charge{ background:#6b3fb5; }
.mv-seg-emballe{ background:#0b6fb8; }

.mv-filters{ display:flex; gap:8px; overflow-x:auto; padding:2px 0 4px; }
.mv-filters .rchip{ flex:none; }

.mv-row{
  display:flex; align-items:center; gap:14px; padding:12px 14px; color:var(--ink); text-decoration:none;
}
.mv-row:hover{ border-color:var(--blue); }
.mv-no{
  flex:none; width:46px; height:46px; display:flex; align-items:center; justify-content:center;
  border-radius:13px; background:var(--blue); color:var(--blue-ink); font-weight:700; font-size:1.3rem;
}

.mv-cam{ max-height:300px; }
.mv-fb{ min-height:1.4em; text-align:center; font-weight:600; }
.mv-fb.ok{ color:#245a2e; }
.mv-fb.bad{ color:#9a2f1c; }
:root[data-theme=dark] .mv-fb.ok{ color:#9bd6a3; }
:root[data-theme=dark] .mv-fb.bad{ color:#ffb3a3; }

.mv-big{ text-align:center; display:flex; flex-direction:column; align-items:center; gap:8px; padding:24px 16px; }
.mv-ok{ width:54px; height:54px; border-radius:50%; background:#2f6b3a; color:#fff; display:flex; align-items:center; justify-content:center; }
.mv-ok svg{ width:30px; height:30px; }
.mv-dest{ font-size:2.6rem; font-weight:700; line-height:1.05; letter-spacing:-.02em; }

.mv-kps{ display:grid; grid-template-columns:repeat(auto-fit,minmax(110px,1fr)); gap:10px; margin-bottom:14px; }
.mv-kp{ border-radius:16px; padding:12px 14px; color:#fff; }
.mv-kp.ok{ background:#2f6b3a; }
.mv-kp.bad{ background:#b03a26; }
.mv-kp.warn{ background:#6b3fb5; }
.mv-kpn{ font-size:1.9rem; font-weight:700; line-height:1.1; }
@media print{
  .nav, .mv-tabs, #mv-prt, .toast{ display:none !important; }
  main{ padding:0 !important; }
}

.mv-page > * + *{ margin-top:14px; }
.mv-page > h2{ margin-bottom:0; }
.mv-page > .pagehead + .subtabs,
.mv-page > .pagehead + a{ margin-top:6px; }

#mv-cam-btn[aria-pressed=false]{ opacity:.65; }
#mv-code{ min-width:0; }

/* Maison courante : puce en haut de page quand le compte appartient à plusieurs maisons */
.house-bar{display:flex;justify-content:flex-end;margin:0 0 10px}
.house-chip{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;border:1px solid var(--line-strong);border-radius:999px;font-size:.85rem;color:var(--ink);text-decoration:none;background:var(--surface)}
.house-chip svg{width:16px;height:16px}
.house-chip:hover{border-color:var(--blue);color:var(--blue)}


/* Raccourcis de la date de péremption (formulaire article). */
.quick-dates{
  flex-wrap:wrap;
  gap:6px;
  margin-top:8px;
  align-items:center;
}

.quick-dates input{
  width:104px;
  min-height:36px;
}

/* Sélection multiple sur les fiches emplacement et catégorie : la barre fixe du bas ne masque pas les derniers articles. */
@media (max-width:899px){
  .with-selbar{
    padding-bottom:120px;
  }
}


/* Quantité avec − / + (lots du formulaire article, mode « Remplir ce placard »). */
.stepper{
  display:flex;
  align-items:center;
  gap:8px;
}

.stepper .btn{
  width:44px;
  height:44px;
  padding:0;
  font-size:1.3rem;
  line-height:1;
}

.stepper input{
  width:72px;
  height:44px;
  text-align:center;
  font-size:1.2rem;
  font-weight:600;
  font-variant-numeric:tabular-nums;
}

.lot-row{
  padding:10px;
}

.fill-card .stepper .btn{
  width:56px;
  height:56px;
  font-size:1.6rem;
}

.fill-card .stepper input{
  width:96px;
  height:56px;
  font-size:1.5rem;
}

.fill-head{
  position:sticky;
  top:0;
  z-index:5;
  background:var(--bg);
  padding:8px 0;
}


/* Remplir un emplacement : la caméra ne doit pas repousser la mini-fiche sous la ligne de flottaison (téléphone). */
.fill-page .scanwrap{
  max-height:34vh;
  margin-inline:auto;
}

.fill-page.fill-open .scanwrap{
  max-height:15vh;
}

.fill-page .scanwrap video{
  object-fit:cover;
}


/* Une grille à une colonne ne doit pas s'élargir à la largeur minimale de son contenu (noms ou emplacements longs, étiquettes) :
   sinon la page déborde de l'écran du téléphone, et la barre de navigation du bas, fixée à la largeur de la page, est coupée.
   :where() garde une spécificité nulle : les grilles qui définissent leurs propres colonnes (g2, g3, split…) ne changent pas. */
:where(.grid){
  grid-template-columns:minmax(0,1fr);
}

:where(.grid) > *{
  min-width:0;
}

@media (min-width:900px){
  :where(.grid.split){
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}


/* Bouton de dictée en cours d'écoute. */
#fc-mic.on{
  background:var(--blue-soft);
  border-color:var(--blue);
  color:var(--blue);
}


/* Boutons d'en-tête d'une page (emplacement, catégorie) : une seule ligne compacte, jamais de libellé coupé sur deux lignes ni de hauteurs inégales.
   Libellés courts (« Remplir », « Ajouter ») ; le détail est dans le title / aria-label, et « Actions » est réduit à son icône. */
.head-actions{
  display:flex;
  flex-wrap:nowrap;
  align-items:stretch;
  gap:8px;
}

.head-actions .btn{
  white-space:nowrap;
}

@media (max-width:599px){
  .head-actions{
    width:100%;
  }

  .head-actions > .btn{
    flex:1 1 0;
    min-width:0;
  }
}


/* =========================================================
   CORRECTIFS RESPONSIVE (audit)
   ========================================================= */

/* main est un enfant flex : sans min-width:0 il s'élargit au contenu de ses descendants défilables (page Journal). */
main{ min-width:0; }

/* 320 px : les 3 onglets Articles / Emplacements / Catégories tiennent sur une ligne. */
@media (max-width:359px){
  .subtabs{ gap:6px; }
  .subtabs a{ min-width:0; padding:10px 6px; font-size:.86rem; }
}

/* Accueil : 4 tuiles côte à côte seulement quand il y a la place (menu latéral compris). */
@media (min-width:700px) and (max-width:1199px){
  .grid.g4{ grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* Mobile / tablette : champs à 16 px (Safari iPhone zoome sinon) et liens plus faciles à toucher. */
@media (max-width:899px){
  .sort-inline, #who, #since, #until{ font-size:16px; }
  a.muted.small[data-back]{ display:inline-block; padding:8px 0; }
}
