/* =========================================================
   HYPERVEX — foto nella chat (parte 2 di «Foto dal cliente»). JS: js/chat-photo.js. Doc: docs/FOTO-DAL-CLIENTE.md
   Telefoni vecchi (iOS 13.4 / Chrome 80): niente aspect-ratio, niente inset (si usa left/top/right/bottom e il trucco del padding).
   ========================================================= */

/* ---- la bolla con le foto ---- */
.msg.img{ padding:5px 5px 8px; max-width:min(84%,340px); }
.msg.img .w{ padding:0 9px; }
.msg.img .msg-menu-btn{ top:9px; right:9px; z-index:2; background:rgba(0,0,0,.5); color:#fff; opacity:.92; }
.msg.img .msg-flag{ margin:4px 0 0 7px; }
.cp-grid{ display:grid; gap:4px; border-radius:14px; overflow:hidden; max-width:100%; }
.cp-grid.g1{ grid-template-columns:1fr; width:230px; }
.cp-grid.g2{ grid-template-columns:1fr 1fr; width:250px; }
.cp-grid.g3{ grid-template-columns:repeat(3,1fr); width:270px; }
.cp-grid.g4{ grid-template-columns:1fr 1fr; width:250px; }
.cp-ph{ position:relative; display:block; width:100%; height:0; padding:0 0 133% 0; border:0; background:#161a24; overflow:hidden; cursor:zoom-in; }
.cp-grid.g1 .cp-ph{ padding-bottom:125%; }
.cp-grid.g3 .cp-ph{ padding-bottom:150%; }
.cp-ph img{ position:absolute; left:0; top:0; width:100%; height:100%; object-fit:cover; display:block; }
.cp-cap-t{ padding:7px 9px 0; font-size:14.5px; font-weight:700; line-height:1.4; overflow-wrap:anywhere; word-break:break-word; }

/* ---- l'anteprima prima di mandare (dentro il foglio) ---- */
.cp-tray .cp-hint{ font-size:12.5px; color:var(--txt-3); margin:-4px 0 12px; }
.cp-thumbs{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; }
.cp-th{ position:relative; width:76px; height:100px; }
.cp-th img{ width:100%; height:100%; object-fit:cover; border-radius:12px; border:1px solid var(--line); display:block; }
.cp-x{ position:absolute; top:-7px; right:-7px; width:26px; height:26px; border-radius:50%; background:var(--surface-3); border:1px solid var(--line); display:grid; place-items:center; color:var(--txt); }
.cp-x svg{ width:13px; height:13px; }
.cp-add{ width:76px; height:100px; border-radius:12px; border:1.5px dashed var(--line); color:var(--txt-3); display:grid; place-items:center; background:transparent; }
.cp-add svg{ width:24px; height:24px; }
.cp-cap{ margin-bottom:12px; }
.cp-tray .acts, .cp-save .acts{ display:flex; gap:9px; }
.cp-tray .acts .btn, .cp-save .acts .btn{ flex:1; }

/* ---- il visore a tutto schermo (sotto i fogli e le conferme, che stanno a 70) ---- */
body.cp-lock{ overflow:hidden; }
.cp-viewer{ position:fixed; left:0; top:0; right:0; bottom:0; z-index:65; background:#030304; display:flex; flex-direction:column; color:#fff; }
.cp-vbar{ display:flex; align-items:center; justify-content:space-between; padding:calc(12px + var(--safe-t,0px)) 14px 8px; }
.cp-vwho b{ display:block; font-size:15px; font-weight:800; line-height:1.2; }
.cp-vwho span{ font-size:12px; color:var(--txt-3); font-weight:700; }
.cp-vx{ width:40px; height:40px; border-radius:50%; background:var(--surface-2); display:grid; place-items:center; color:#fff; }
.cp-vimg{ position:relative; flex:1; min-height:0; margin:4px 12px; display:flex; align-items:center; justify-content:center; }
.cp-vimg img{ max-width:100%; max-height:100%; object-fit:contain; border-radius:14px; display:block; }
.cp-vcount{ position:absolute; top:8px; right:8px; padding:2px 9px; border-radius:9px; background:rgba(0,0,0,.6); font-size:12px; font-weight:800; }
.cp-vnav{ position:absolute; top:50%; margin-top:-22px; width:44px; height:44px; border-radius:50%; background:rgba(0,0,0,.55); color:#fff; display:grid; place-items:center; }
.cp-vnav.prev{ left:8px; }
.cp-vnav.prev svg{ transform:rotate(180deg); }
.cp-vnav.next{ right:8px; }
.cp-vcap{ margin:6px 16px 0; font-size:14px; color:var(--txt-2); text-align:center; font-weight:700; overflow-wrap:anywhere; }
.cp-vact{ display:flex; gap:9px; padding:10px 14px calc(16px + var(--safe-b,0px)); max-width:560px; width:100%; margin:0 auto; }
.cp-vact .btn{ flex:1; }
.cp-vact .btn:first-child:not(:last-child){ flex:.7; }   /* «Scarica» piu' stretto: «Salva nel Foto check» sta meglio */

/* ---- «Salva nel Foto check» (foglio dentro il visore) ---- */
.cp-save{ position:absolute; left:0; right:0; top:0; bottom:0; z-index:3; background:rgba(0,0,0,.6); display:flex; align-items:flex-end; justify-content:center; }
.cp-save .cp-sheet{ width:100%; max-width:520px; padding:16px 14px calc(16px + var(--safe-b,0px)); background:var(--surface); border-radius:22px 22px 0 0; border-top:1px solid var(--line); }
.cp-save h3{ margin:0 0 4px; font-size:17px; font-weight:800; }
.cp-lab{ font-size:12px; color:var(--txt-3); font-weight:800; margin:12px 0 6px; text-transform:uppercase; letter-spacing:.5px; }
.cp-chips{ display:flex; gap:7px; flex-wrap:wrap; }
.cp-chip{ padding:9px 14px; border-radius:12px; background:var(--surface-2); border:1px solid var(--line); font-size:14px; font-weight:800; color:var(--txt); }
.cp-chip.on{ background:var(--red-soft); border-color:var(--red); color:var(--red-hot); }
.cp-sel{ width:100%; }
.cp-note{ margin:10px 0 14px; padding:9px 11px; border-radius:11px; background:rgba(255,176,32,.1); border:1px solid rgba(255,176,32,.35); color:#ffd37d; font-size:12.5px; line-height:1.35; font-weight:700; }
