/* Anteprima prima dell'invio (12/11/2026, js/components/anteprimaInvio.js): finestra al centro, sopra tutto */
.aiv-overlay { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(15, 23, 42, .45); animation: aiv-entra .12s ease-out; }
@keyframes aiv-entra { from { opacity: 0; } to { opacity: 1; } }
.aiv-finestra { width: 560px; max-width: 100%; max-height: calc(100vh - 32px); display: flex; flex-direction: column; overflow: hidden;
  background: #fff; color: #111827; border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.aiv-testa { display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid #eef0f3; }
.aiv-testa h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.aiv-testa p { margin: 2px 0 0; font-size: .8rem; color: #6b7280; }
.aiv-testa > div { flex: 1; min-width: 0; }
.aiv-canale { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); font-size: 1.2rem; }
.aiv-chiudi { border: 0; background: transparent; color: #9ca3af; font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.aiv-chiudi:hover { color: #374151; }
.aiv-corpo { padding: 14px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.aiv-testa-msg { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; }
.aiv-riga { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.aiv-et { flex: 0 0 64px; color: #6b7280; font-weight: 600; font-size: .8rem; }
.aiv-riga > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.aiv-oggetto { font-weight: 600; }
.aiv-quando { color: #b45309; }
.aiv-quando .aiv-et { color: #d97706; }
.aiv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.aiv-chips-resto { display: contents; }
.aiv-chips-resto[hidden] { display: none; }
.aiv-chip { display: inline-flex; flex-direction: column; padding: 4px 10px; border-radius: 10px; background: #f3f4f6; line-height: 1.25; max-width: 100%; }
.aiv-chip b { font-size: .82rem; font-weight: 600; overflow-wrap: anywhere; }
.aiv-chip small { font-size: .72rem; color: #6b7280; }
.aiv-altri { border: 1px dashed #c7cbd3; background: transparent; border-radius: 10px; padding: 4px 10px; font-size: .8rem; cursor: pointer; color: #4b5563; }
.aiv-nota { font-size: .8rem; color: #4b5563; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 8px; padding: 6px 10px; }
.aiv-nota i { color: #64748b; margin-right: 4px; }
.aiv-bolla { align-self: flex-start; max-width: 100%; padding: 9px 12px; border-radius: 10px; font-size: .92rem; line-height: 1.45; overflow-wrap: anywhere; white-space: normal;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.aiv-bolla.aiv-whatsapp { background: #d9fdd3; color: #111b21; border-top-right-radius: 2px; align-self: flex-end; }
.aiv-bolla.aiv-ebay { background: #eef2ff; color: #1f2937; align-self: flex-end; }
.aiv-bolla.aiv-email { background: #f9fafb; border: 1px solid #e5e7eb; align-self: stretch; }
.aiv-bolla a { color: #027eb5; }
.aiv-vuoto { color: #9ca3af; }
.aiv-html { width: 100%; min-height: 160px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; }
.aiv-allegati { display: flex; flex-wrap: wrap; gap: 8px; }
.aiv-file { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid #e5e7eb; border-radius: 10px; max-width: 100%; font-size: .82rem; }
.aiv-file img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.aiv-file i { font-size: 1.4rem; color: #6366f1; }
.aiv-file span { display: flex; flex-direction: column; min-width: 0; }
.aiv-file b { font-weight: 600; overflow-wrap: anywhere; }
.aiv-file small { color: #6b7280; font-size: .72rem; }
.aiv-audio { width: 100%; }
.aiv-audio audio { flex: 1; min-width: 0; height: 36px; }
.aiv-perdest { display: flex; flex-direction: column; gap: 8px; }
.aiv-pd { border: 1px solid #e5e7eb; border-radius: 10px; padding: 8px 10px; }
.aiv-pd summary { cursor: pointer; font-weight: 600; font-size: .86rem; }
.aiv-pd summary small { color: #6b7280; font-weight: 400; }
.aiv-pd .aiv-bolla { margin-top: 8px; }
.aiv-piede { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 18px 16px; border-top: 1px solid #eef0f3; }
.aiv-nonmostrare { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: #6b7280; cursor: pointer; }
.aiv-pulsanti { display: flex; gap: 8px; margin-left: auto; }
.aiv-pulsanti .btn { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 600px) {
  .aiv-overlay { padding: 0; align-items: flex-end; }
  .aiv-finestra { width: 100%; max-height: 92vh; border-radius: 14px 14px 0 0; }
  .aiv-pulsanti { width: 100%; }
  .aiv-pulsanti .btn { flex: 1; justify-content: center; }
}
[data-theme="dark"] .aiv-finestra { background: #1f2937; color: #e5e7eb; }
[data-theme="dark"] .aiv-testa, [data-theme="dark"] .aiv-piede { border-color: #374151; }
[data-theme="dark"] .aiv-testa p, [data-theme="dark"] .aiv-et, [data-theme="dark"] .aiv-chip small, [data-theme="dark"] .aiv-nonmostrare, [data-theme="dark"] .aiv-file small { color: #9ca3af; }
[data-theme="dark"] .aiv-chip { background: #374151; }
[data-theme="dark"] .aiv-nota { background: #111827; border-color: #374151; color: #cbd5e1; }
[data-theme="dark"] .aiv-bolla.aiv-whatsapp { background: #005c4b; color: #e9edef; }
[data-theme="dark"] .aiv-bolla.aiv-ebay { background: #312e81; color: #e0e7ff; }
[data-theme="dark"] .aiv-bolla.aiv-email { background: #111827; border-color: #374151; color: #e5e7eb; }
[data-theme="dark"] .aiv-bolla a { color: #53bdeb; }
[data-theme="dark"] .aiv-file, [data-theme="dark"] .aiv-pd { border-color: #374151; }
[data-theme="dark"] .aiv-quando { color: #fbbf24; }
