/* =============================================================================
   Tout déposer, de partout (js/depot.js) et scan rapide sur téléphone (js/scan.js).
   - voile plein écran pendant un glisser-déposer ;
   - panneau de suivi : chaque fichier lu → classé → rattaché (ou « à vérifier ») ;
   - adresse e-mail de dépôt (Dépenses, Documents) ;
   - bouton rond de scan au-dessus de Sophystia (téléphone) et feuille de recadrage.
   Bleu = rangé / validé ; orange = à vérifier ; rouge = refusé (alerte). Formes rondes, symboles monochromes. Plus aucun jaune.
   ============================================================================= */

/* ---------- voile du glisser-déposer ---------- */
.dz-voile { position: fixed; inset: 0; z-index: 900; pointer-events: none; opacity: 0; padding: 18px;
  background: color-mix(in srgb, var(--bg) 62%, transparent); -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
  transition: opacity .18s var(--ease, ease); }
.dz-voile.on { opacity: 1; }
.dz-voile.on.local { opacity: 0; }                 /* une zone de la page reçoit elle-même le fichier */
.dz-voile-cadre { height: 100%; border-radius: var(--r-xl); border: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 5%, transparent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px; }
.dz-voile-ico { width: 76px; height: 76px; border-radius: 50%; background: var(--accent-fort); color: #fff; display: grid; place-items: center;
  margin-bottom: 8px; transform: translateY(6px); transition: transform .4s var(--spring, ease); }
.dz-voile.on .dz-voile-ico { transform: none; }
.dz-voile-ico .dz-svg { width: 34px; height: 34px; }
.dz-voile-cadre b { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -.025em; color: var(--ink); }
.dz-voile-cadre span:last-child { font-size: 14.5px; color: var(--ink-2); }

/* ---------- panneau de suivi ---------- */
.dz-svg { display: block; width: 18px; height: 18px; flex-shrink: 0; }
.dz-panneau { position: fixed; right: 22px; bottom: 84px; z-index: 90; width: min(400px, calc(100vw - 44px)); max-height: min(62vh, 560px);
  display: flex; flex-direction: column; background: var(--card); color: var(--ink); border: 0; border-radius: var(--r-xl, 28px);
  box-shadow: var(--sh-float); overflow: hidden; animation: dz-entree .45s var(--spring, ease) both; }
.dz-panneau.sortie { animation: dz-sortie .25s var(--ease, ease) both; }
@keyframes dz-entree { from { transform: translateY(14px) scale(.98); opacity: 0; } }
@keyframes dz-sortie { to { transform: translateY(10px); opacity: 0; } }
html.sp-ouvert .dz-panneau { right: 476px; }        /* Sophystia ouverte à droite : le suivi se range à côté */
.dz-tete { display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px 16px; border-bottom: 1px solid var(--line); }
.dz-tete-ico { width: 36px; height: 36px; border-radius: 50%; background: var(--card-3); display: grid; place-items: center; flex-shrink: 0; }
.dz-tete-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dz-tete-t b { font-family: var(--display); font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.dz-resume { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-fermer { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); display: grid; place-items: center;
  cursor: pointer; flex-shrink: 0; }
.dz-fermer:hover { background: var(--card-2); color: var(--ink); }
.dz-liste { list-style: none; margin: 0; padding: 6px 0; overflow-y: auto; overscroll-behavior: contain; }
.dz-item { display: flex; gap: 12px; padding: 12px 16px; }
.dz-item + .dz-item { border-top: 1px solid var(--line); }
.dz-pastille { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; margin-top: 1px;
  background: var(--card-2); color: var(--ink-2); }
.dz-pastille .dz-svg { width: 20px; height: 20px; }
.dz-pastille.fait { background: var(--black); color: var(--on-black); }
.dz-pastille.verifier { background: var(--amber-soft); color: var(--amber-text); }
.dz-pastille.refuse { background: var(--danger-soft); color: var(--danger); }
.dz-pastille.attente { background: var(--card-2); color: var(--ink-2); }
.dz-pastille .spin { width: 15px; height: 15px; color: var(--ink-2); }
.dz-corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dz-nom { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-msg { margin: 0; font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.dz-item[data-etat="envoi"] .dz-msg { font-weight: 500; color: var(--ink-2); }
.dz-item[data-etat="refuse"] .dz-msg { color: var(--danger); font-weight: 500; }
/* lu → classé → rattaché : trois pas reliés */
.dz-etapes { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; margin: 2px 0 0; padding: 0; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.dz-etapes li { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dz-etapes li + li::before { content: ""; width: 14px; height: 1.5px; margin: 0 6px; border-radius: 1px; background: var(--line-2); }
.dz-etapes li { --point: var(--line-2); }
.dz-etapes i { width: 7px; height: 7px; border-radius: 50%; background: var(--point); flex-shrink: 0; }
.dz-etapes li.fait { color: var(--ink-2); --point: var(--accent); }
.dz-etapes li.en-cours { color: var(--ink); --point: var(--ink-2); }
.dz-etapes li.en-cours i { animation: dz-pouls 1s ease-in-out infinite; }
.dz-etapes li.verifier { color: var(--amber-text); --point: var(--amber); }
.dz-etapes li.attente { color: var(--ink-2); --point: var(--ink-3); }
.dz-etapes li.non { color: var(--danger); --point: var(--danger); }
@keyframes dz-pouls { 50% { transform: scale(.55); opacity: .5; } }
.dz-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dz-btn { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: var(--pill); border: 1px solid var(--line-2); background: var(--card);
  color: var(--ink); font: 600 12.5px var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; }
.dz-btn:hover { background: var(--card-2); }
.dz-btn.fort { background: var(--black); color: var(--on-black); border-color: transparent; }
.dz-btn:disabled { opacity: .5; pointer-events: none; }

/* ---------- adresse e-mail de dépôt ---------- */
#dp-adresse:empty, #dc-adresse:empty { display: none; }
.dz-adresse { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; padding: 14px 14px 14px 16px; border-radius: var(--r-lg);
  background: var(--card); border: 0; box-shadow: var(--sh-card); }
.dz-adresse-ico { width: 40px; height: 40px; border-radius: 50%; background: var(--card-3); color: var(--ink); display: grid; place-items: center; flex-shrink: 0; }
.dz-adresse-ico .dz-svg { width: 20px; height: 20px; }
.dz-adresse-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dz-adresse-t b { font-size: 14px; }
.dz-adresse-aide { font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }
.dz-adresse-val { margin-top: 4px; align-self: flex-start; max-width: 100%; padding: 5px 12px; border-radius: var(--pill); background: var(--card-3);
  font: 600 13px/1.35 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--ink); overflow-wrap: anywhere; user-select: all; }
.dz-adresse-act { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.dz-adresse-changer { border: 0; background: none; padding: 4px 6px; font: 600 12px var(--text); color: var(--ink-3); cursor: pointer; border-radius: var(--pill); }
.dz-adresse-changer:hover { color: var(--ink); }
.dz-adresse.compacte { margin: 0 0 18px; }

/* ---------- scan rapide : bouton rond (téléphone seulement) ---------- */
.sc-bouton, #sc-photo { display: none; }
.sc-svg { display: block; width: 24px; height: 24px; }
@media (max-width: 820px) {
  .sc-bouton { position: fixed; z-index: 61; right: 14px; bottom: calc(max(12px, env(safe-area-inset-bottom) - 8px) + 52px + 12px);
    width: 52px; height: 52px; border: 0; border-radius: 50%; padding: 0; display: grid; place-items: center; cursor: pointer;
    color: var(--ink); background: var(--verre, var(--card)); -webkit-backdrop-filter: blur(24px) saturate(1.9); backdrop-filter: blur(24px) saturate(1.9);
    box-shadow: var(--verre-ombre, var(--sh-float)); transition: transform .45s var(--ressort, ease), opacity .2s; touch-action: manipulation;
    -webkit-tap-highlight-color: transparent; }
  /* arête de verre, comme Sophystia juste dessous */
  .sc-bouton::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
    background: linear-gradient(150deg, var(--verre-arete, transparent), var(--verre-arete-2, transparent) 28%, transparent 46%, transparent 62%, var(--verre-arete-2, transparent) 82%, var(--verre-arete, transparent));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
  .sc-bouton .sc-svg { width: 25px; height: 25px; position: relative; }
  .sc-bouton:active { transform: scale(1.1); }
  /* suivi du dépôt ouvert : le bouton reste sous le pouce, juste au-dessus du panneau */
  html.dz-ouvert .sc-bouton { bottom: calc(max(12px, env(safe-area-inset-bottom) - 8px) + 52px + 10px + var(--dz-h, 0px) + 10px); }
  html.clavier .sc-bouton, html.feuille-ouverte .sc-bouton, html.sp-ouvert .sc-bouton, html.sc-ouvert .sc-bouton,
  body.lecture-seule .sc-bouton, body.espace-salarie .sc-bouton, body:not(:has(#tabbar .onglets)) .sc-bouton { opacity: 0; pointer-events: none; transform: scale(.6); }

  /* le suivi au-dessus de la barre d'onglets, sur toute la largeur */
  .dz-panneau { left: 10px; right: 10px; width: auto; bottom: calc(max(12px, env(safe-area-inset-bottom) - 8px) + 52px + 10px); max-height: 56vh; border-radius: 28px; }
  html.sp-ouvert .dz-panneau { right: 10px; }
  .dz-item { padding: 12px 14px; }
  .dz-btn { height: 36px; padding: 0 15px; font-size: 13px; }
  .dz-adresse { flex-wrap: wrap; align-items: flex-start; }
  .dz-adresse-t { flex: 1 1 calc(100% - 54px); }
  .dz-adresse-act { flex: 1 1 100%; flex-direction: row; align-items: center; justify-content: space-between; padding-left: 54px; }
  .dz-voile { display: none; }
}

/* ---------- feuille de recadrage (plein écran, toujours sombre : la photo ressort) ---------- */
.sc-feuille { position: fixed; inset: 0; z-index: 400; display: flex; flex-direction: column; background: #0B0C0F; color: #F5F5F7;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); opacity: 0; transform: translateY(18px);
  transition: opacity .25s var(--ease, ease), transform .35s var(--ressort-doux, ease); touch-action: none; }
.sc-feuille.on { opacity: 1; transform: none; }
html.sc-ouvert, html.sc-ouvert body { overflow: hidden; }
.sc-haut { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; padding: 10px 14px 4px; }
.sc-titre { text-align: center; font: 700 16.5px var(--text); letter-spacing: -.01em; }
.sc-rond { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.sc-rond:disabled { opacity: .35; }
.sc-rond .sc-svg { width: 22px; height: 22px; }
.sc-scene { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
.sc-cadre { position: relative; }
.sc-image { display: block; width: 100%; height: 100%; border-radius: 6px; }
.sc-quad { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.sc-masque { fill: rgba(0, 0, 0, .55); fill-rule: evenodd; }
.sc-contour { fill: none; stroke: #3B9BFF; stroke-width: 2.5; stroke-linejoin: round; }
.sc-coin { position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; border-radius: 50%; touch-action: none; cursor: grab; outline: none; }
.sc-coin::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: #fff; border: 3px solid #3B9BFF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5); transition: transform .2s var(--ressort, ease); }
.sc-coin.tire::after, .sc-coin:focus-visible::after { transform: scale(1.35); }
.sc-aide, .sc-vide { margin: 4px 16px 0; text-align: center; font-size: 13px; color: rgba(245, 245, 247, .62); }
.sc-vide { display: none; }
.sans-page .sc-cadre, .sans-page .sc-aide { display: none; }
.sans-page .sc-vide { display: block; position: absolute; inset: auto 0 50%; transform: translateY(50%); font-size: 15px; color: rgba(245, 245, 247, .8); }
.sc-pages { display: flex; gap: 10px; padding: 12px 16px 0; overflow-x: auto; min-height: 0; }
.sc-pages:empty { display: none; }
.sc-vignette { position: relative; flex-shrink: 0; width: 52px; height: 68px; border-radius: 10px; overflow: hidden; background: #222; }
.sc-vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-vignette i { position: absolute; left: 4px; bottom: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(0, 0, 0, .62); font: 700 11px/1 var(--text); font-style: normal; color: #fff; }
.sc-retirer { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0; background: rgba(0, 0, 0, .62);
  color: #fff; display: grid; place-items: center; cursor: pointer; }
.sc-retirer .sc-svg { width: 14px; height: 14px; }
.sc-bas { display: flex; gap: 10px; padding: 14px 16px 16px; }
.sc-pill { flex: 1; height: 52px; border-radius: var(--pill); border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 15.5px var(--text); cursor: pointer; background: rgba(255, 255, 255, .14); color: #fff; }
.sc-pill .sc-svg { width: 20px; height: 20px; }
.sc-pill.fort { background: #fff; color: #0B0B0F; }
.sc-pill:disabled { opacity: .4; }
.sc-pill .spin { color: #0B0B0F; }
@media (prefers-reduced-motion: reduce) {
  .dz-panneau, .dz-panneau.sortie, .dz-etapes li.en-cours i { animation: none; }
  .sc-feuille, .dz-voile, .dz-voile-ico { transition: none; }
}

/* 30/11 : le scan est LA fonction principale sur téléphone → bouton plein, à l'accent de la nouvelle identité, toujours visible */
@media (max-width: 820px) {
  .sc-bouton { width: 52px; height: 52px; color: #fff; background: linear-gradient(160deg, #2B8CFF, #0071E3 60%, #005BBF);
    -webkit-backdrop-filter: none; backdrop-filter: none;
    box-shadow: 0 10px 24px -8px rgba(0, 113, 227, .65), 0 2px 6px rgba(0, 0, 0, .12), inset 0 1px 0 rgba(255, 255, 255, .35); }
  .sc-bouton::before { display: none; }
  .sc-bouton .sc-svg { width: 25px; height: 25px; }
}
