/* BARON-VAULT : mode fixe réel (aucun défilement vertical), sombre par défaut sans être noir, mode clair, orange comme couleur. */
:root{
  --bg:#1b1d22; --surface:#23262c; --surface2:#2b2f36; --line:#383d46; --fg:#eceef1; --muted:#9ea4ae;
  --orange:#e8873a; --orange-doux:rgba(232,135,58,.15); --sur-orange:#1b1d22;
  --bleu:#6b9bd9; --vert:#5fb98a; --jaune:#d9b443; --rouge:#d9645a;
  --sans:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --mono:ui-monospace,"SF Mono",Menlo,Consolas,"Roboto Mono",monospace;
  --barre:48px; --pied:46px; --r:14px;
  color-scheme:dark;
}
:root[data-theme="light"]{
  --bg:#f2f1ee; --surface:#ffffff; --surface2:#f7f6f3; --line:#dedcd6; --fg:#17181b; --muted:#646a73;
  --orange:#c0661f; --orange-doux:rgba(192,102,31,.11); --sur-orange:#ffffff;
  --bleu:#3b6fb3; --vert:#2f8a5c; --jaune:#a07f12; --rouge:#b8423a; color-scheme:light;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0;overflow:hidden;overscroll-behavior:none}
body{background:var(--bg);color:var(--fg);font:14px/1.4 var(--sans);-webkit-tap-highlight-color:transparent}
#app{height:100dvh;width:100vw;position:relative;overflow:hidden}
[hidden]{display:none!important}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid var(--orange);outline-offset:2px}
svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.mono{font-family:var(--mono);font-variant-numeric:tabular-nums}
.lbl{font-size:10.5px;letter-spacing:.09em;text-transform:uppercase;color:var(--muted);font-weight:650}
.logo{display:inline-grid;place-items:center;width:28px;height:28px;border-radius:8px;background:var(--orange);color:var(--sur-orange);font-weight:800;font-size:12px;letter-spacing:.04em;flex:none}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:40px;padding:0 14px;border-radius:10px;border:1px solid var(--line);background:var(--surface2);font-weight:650;font-size:12.5px;letter-spacing:.05em}
.btn.plein{background:var(--orange);border-color:var(--orange);color:var(--sur-orange)}
.btn.lien{border:0;background:none;color:var(--muted);text-decoration:underline;min-height:32px}
.btn:disabled{opacity:.5;cursor:default}
.ico{display:inline-grid;place-items:center;width:40px;height:40px;border-radius:10px;color:var(--fg);flex:none}
.ico:hover{background:var(--surface2)}
.msg{min-height:20px;margin:0;font-size:13px;color:var(--muted);text-align:center}
.msg.mal{color:var(--rouge)}

/* ---------- écrans d'accès ---------- */
.ecran{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:max(14px,env(safe-area-inset-top)) 16px max(14px,env(safe-area-inset-bottom))}
.boite{width:100%;max-width:340px;display:flex;flex-direction:column;gap:clamp(8px,2dvh,16px);align-items:stretch;text-align:center}
.marque-grande{display:flex;align-items:center;justify-content:center;gap:10px}
.marque-grande h1{margin:0;font-size:20px;letter-spacing:.12em}
.sous{margin:0;color:var(--muted);font-size:13px}
#f-connexion{display:flex;flex-direction:column;gap:6px;text-align:left}
#f-connexion input{height:44px;border-radius:10px;border:1px solid var(--line);background:var(--surface);color:var(--fg);padding:0 12px;font-size:15px;margin-bottom:6px}
#f-connexion .btn{margin-top:6px;min-height:46px}
.points{display:flex;justify-content:center;gap:10px}
.points i{width:14px;height:14px;border-radius:50%;border:2px solid var(--line)}
.points i.on{background:var(--orange);border-color:var(--orange)}
.points.secoue{animation:secoue .3s}
@keyframes secoue{25%{transform:translateX(-7px)}75%{transform:translateX(7px)}}
.clavier{display:grid;grid-template-columns:repeat(3,1fr);gap:clamp(6px,1.4dvh,10px)}
.clavier button{height:clamp(46px,8.5dvh,60px);border-radius:12px;background:var(--surface);border:1px solid var(--line);font-size:22px;font-family:var(--mono)}
.clavier button:active{background:var(--orange-doux);border-color:var(--orange)}
.clavier button:disabled{opacity:.4}

/* ---------- coffre ---------- */
.coffre{flex-direction:column;align-items:stretch;justify-content:flex-start;padding:0}
.barre{height:calc(var(--barre) + env(safe-area-inset-top));padding:env(safe-area-inset-top) max(6px,env(safe-area-inset-right)) 0 max(8px,env(safe-area-inset-left));display:flex;align-items:center;gap:2px;border-bottom:1px solid var(--line);background:var(--surface);flex:none}
.marque{display:flex;align-items:center;gap:8px;margin-right:auto;min-width:0}
.marque b{font-size:13px;letter-spacing:.08em;white-space:nowrap}
#filtre-famille{height:34px;min-width:0;flex:0 1 150px;max-width:150px;border-radius:9px;border:1px solid var(--line);background:var(--surface2);color:var(--fg);font-size:11.5px;padding:0 6px;margin-right:2px}
.zone-recherche{padding:6px 10px;background:var(--surface);border-bottom:1px solid var(--line);flex:none}
.zone-recherche input{width:100%;height:36px;border-radius:9px;border:1px solid var(--line);background:var(--surface2);color:var(--fg);padding:0 10px;font-size:14px}
.pager{flex:1;min-height:0;display:flex;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;scrollbar-width:none;overscroll-behavior-x:contain}
.pager::-webkit-scrollbar{display:none}
.page{flex:0 0 100%;width:100%;height:100%;scroll-snap-align:start;scroll-snap-stop:always;display:grid;gap:10px;padding:10px max(10px,env(safe-area-inset-right)) 10px max(10px,env(safe-area-inset-left));min-height:0}
.vide{margin:auto;color:var(--muted);text-align:center;padding:20px}
.pied{height:calc(var(--pied) + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);display:flex;align-items:center;justify-content:center;gap:18px;border-top:1px solid var(--line);background:var(--surface);flex:none}
.compteur{font-size:12.5px;color:var(--muted);min-width:84px;text-align:center}

/* ---------- carte ---------- */
.carte{container-type:size;min-height:0;min-width:0;display:flex;flex-direction:column;gap:clamp(4px,1dvh,9px);background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:clamp(10px,2dvh,16px) 14px;cursor:pointer;overflow:hidden;position:relative;text-align:left}
.carte:hover{border-color:var(--orange)}
.carte.eph{border-color:var(--orange);box-shadow:inset 0 0 0 1px var(--orange)}
.c-tete{display:flex;align-items:flex-start;gap:8px}
.c-tete h3{margin:0;font-size:clamp(14px,2.3dvh,18px);line-height:1.25;font-weight:700;letter-spacing:.01em;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;flex:1;min-width:0;word-break:break-word}
.signal{flex:none;font-size:10px;font-weight:750;letter-spacing:.07em;text-transform:uppercase;border-radius:6px;padding:3px 7px;border:1px solid currentColor;white-space:nowrap}
.signal.vert{color:var(--vert)} .signal.jaune{color:var(--jaune)} .signal.bleu{color:var(--bleu)} .signal.rouge{color:var(--rouge)} .signal.orange{color:var(--orange)}
.c-fam{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.chip{font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;font-weight:650;color:var(--muted);border:1px solid var(--line);border-radius:6px;padding:2px 6px;white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}
.c-champs{flex:1;min-height:0;display:flex;flex-direction:column;justify-content:flex-start;gap:clamp(5px,1.2dvh,10px);margin-top:clamp(2px,1dvh,10px)}
.c-champ{min-width:0;display:flex;flex-direction:column;gap:1px;padding:clamp(4px,1dvh,8px) 10px;border-radius:10px;background:var(--surface2)}
.c-val{font-size:clamp(12.5px,1.9dvh,14.5px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.c-val.sec{font-family:var(--mono);letter-spacing:.12em;color:var(--muted)}
.c-val.absent{color:var(--muted);font-style:italic}
.c-bas{display:flex;gap:8px}
/* carte basse (ordinateur, plusieurs rangées) : étiquette et valeur sur une même ligne */
@container (max-height:470px){
  .c-champ{flex-direction:row;align-items:baseline;gap:8px;padding:6px 10px}
  .c-champ .lbl{flex:none;width:44%;max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .c-champs{gap:6px}
  .c-tete h3{-webkit-line-clamp:2}
}
@container (max-height:340px){ .c-fam{display:none} .c-champ{padding:4px 10px} }
.c-bas .btn{flex:1;min-height:clamp(36px,6dvh,44px)}

/* ---------- fiche en grand / journal ---------- */
.voile{position:absolute;inset:0;z-index:20;background:rgba(0,0,0,.45);display:flex;align-items:stretch;justify-content:center}
.feuille{width:100%;max-width:760px;height:100%;background:var(--bg);display:flex;flex-direction:column;border-left:1px solid var(--line);border-right:1px solid var(--line)}
.d-tete{display:flex;align-items:center;gap:8px;padding:calc(6px + env(safe-area-inset-top)) 10px 6px;border-bottom:1px solid var(--line);background:var(--surface);flex:none}
.d-titres{flex:1;min-width:0}
.d-titres h2{margin:0;font-size:clamp(15px,2.4dvh,19px);line-height:1.2;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;word-break:break-word}
.d-champs{flex:1;min-height:0;display:flex;flex-direction:column;gap:clamp(5px,1dvh,10px);padding:clamp(8px,1.6dvh,14px) 12px;overflow:hidden}
.d-champ{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:clamp(6px,1.2dvh,10px) 12px;display:flex;flex-direction:column;gap:4px;min-height:0;flex:0 1 auto}
.d-champ.grand{flex:0 1 auto}
.d-ligne{display:flex;align-items:center;gap:6px}
.d-ligne .lbl{flex:1}
.d-val{font-size:clamp(13px,2dvh,15px);word-break:break-all;overflow:auto;min-height:0;max-height:22dvh;user-select:text}
.d-val.sec{font-family:var(--mono);color:var(--fg)}
.d-val.absent{color:var(--muted);font-style:italic;word-break:normal}
.d-champ .mini{min-height:30px;padding:0 9px;font-size:11px}
.d-edit{display:flex;flex-direction:column;gap:6px}
.d-edit textarea{width:100%;min-height:64px;max-height:20dvh;resize:none;border-radius:9px;border:1px solid var(--orange);background:var(--surface2);color:var(--fg);padding:8px;font:13.5px/1.35 var(--mono)}
.d-edit .rang{display:flex;gap:8px}
.d-edit .rang .btn{flex:1}
.d-pied{display:flex;align-items:center;justify-content:space-between;padding:4px 10px calc(4px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--surface);flex:none}
.j-liste{list-style:none;margin:0;padding:8px 12px calc(10px + env(safe-area-inset-bottom));overflow:auto;flex:1;min-height:0;display:flex;flex-direction:column;gap:6px}
.j-liste li{background:var(--surface);border:1px solid var(--line);border-left:3px solid var(--line);border-radius:10px;padding:8px 10px;display:flex;flex-direction:column;gap:2px;font-size:13px}
.j-liste li.MODIFICATION,.j-liste li.ANNULATION{border-left-color:var(--orange)}
.j-liste li.SYNCHRO-SHEETS{border-left-color:var(--vert)}
.j-liste li.ECHEC-CODE{border-left-color:var(--rouge)}
.j-liste li .rang{display:flex;gap:8px;align-items:center;justify-content:space-between}

/* ---------- messages et infobulles ---------- */
.toasts{position:absolute;left:50%;bottom:calc(var(--pied) + 12px + env(safe-area-inset-bottom));transform:translateX(-50%);z-index:40;display:flex;flex-direction:column;gap:6px;width:min(92vw,420px);pointer-events:none}
.toast{background:var(--surface2);border:1px solid var(--line);border-left:3px solid var(--orange);border-radius:10px;padding:9px 12px;font-size:13px;box-shadow:0 8px 24px rgba(0,0,0,.3)}
.toast.ok{border-left-color:var(--vert)} .toast.mal{border-left-color:var(--rouge)}
.bulle{position:fixed;z-index:60;max-width:240px;background:var(--fg);color:var(--bg);font-size:12px;line-height:1.3;padding:6px 9px;border-radius:7px;pointer-events:none;box-shadow:0 6px 18px rgba(0,0,0,.3)}
@media (prefers-reduced-motion:reduce){*{animation:none!important;scroll-behavior:auto!important}}
@media (max-width:440px){.marque b{display:none}}
@media (min-width:700px){.marque b{font-size:14px} #filtre-famille{max-width:220px;font-size:12.5px}}
