/* Due Torri — assistente AI: pulsante discreto e pannello (blu notte, accenti azzurri, rosso solo per l'azione) */
.ai-btn { position: fixed; right: 20px; bottom: 20px; z-index: 95; display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px 0 14px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; background: #0F2A4A; color: #fff; font: 600 .82rem/1 "Barlow Condensed", "Arial Narrow", sans-serif; letter-spacing: .12em; text-transform: uppercase; box-shadow: 0 10px 30px -10px rgba(10, 29, 51, .7); cursor: pointer; transition: transform .2s, background .2s; }
.ai-btn:hover { background: #163A63; transform: translateY(-2px); }
.ai-btn svg { width: 22px; height: 22px; color: #A9CDE6; }
.ai-btn[aria-expanded="true"] { background: #163A63; }
.ai-panel { position: fixed; right: 20px; bottom: 80px; z-index: 96; width: min(380px, calc(100vw - 32px)); max-height: min(620px, calc(100svh - 120px)); display: flex; flex-direction: column; border-radius: 18px; background: #fff; color: #1F2933; box-shadow: 0 30px 70px -20px rgba(10, 29, 51, .55), 0 0 0 1px rgba(15, 42, 74, .12); overflow: hidden; font: 400 .95rem/1.5 "Archivo", Arial, sans-serif; }
.ai-panel[hidden] { display: none; }
.ai-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: #0F2A4A; color: #fff; }
.ai-head b { display: block; font: 400 1.25rem/1 "Anton", Impact, sans-serif; letter-spacing: .02em; text-transform: uppercase; }
.ai-head small { display: block; margin-top: 3px; color: #A9CDE6; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.ai-close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.ai-close:hover { background: rgba(255, 255, 255, .2); }
.ai-note { margin: 0; padding: 10px 16px; background: #F4F6F9; color: #5B6672; font-size: .8rem; line-height: 1.45; }
.ai-log { flex: 1; min-height: 120px; overflow-y: auto; padding: 14px 16px; display: grid; align-content: start; gap: 10px; overscroll-behavior: contain; }
.ai-msg { max-width: 92%; padding: 10px 13px; border-radius: 14px; }
.ai-bot { justify-self: start; background: #F4F6F9; border-bottom-left-radius: 4px; }
.ai-me { justify-self: end; background: #0F2A4A; color: #fff; border-bottom-right-radius: 4px; }
.ai-bot b { display: block; color: #0F2A4A; }
.ai-bot p { margin: 4px 0 0; }
.ai-wait { color: #5B6672; font-style: italic; }
.ai-more { display: inline-block; margin-top: 6px; color: #2E6B94; font-weight: 600; text-decoration: none; }
.ai-more:hover { text-decoration: underline; }
.ai-hand p { margin: 0 0 8px; }
.ai-hand a { display: inline-flex; align-items: center; min-height: 38px; margin: 0 6px 6px 0; padding: 0 14px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .85rem; }
.ai-cta { background: #D62828; color: #fff; }
.ai-cta:hover { background: #B71F1F; }
.ai-alt { border: 1.5px solid rgba(15, 42, 74, .35); color: #0F2A4A; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; }
.ai-chips[hidden] { display: none; }
.ai-chip { min-height: 34px; padding: 0 12px; border: 1.5px solid rgba(15, 42, 74, .25); border-radius: 999px; background: #fff; color: #0F2A4A; font: 500 .82rem "Archivo", Arial, sans-serif; cursor: pointer; }
.ai-chip:hover { border-color: #2E6B94; color: #2E6B94; }
.ai-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(15, 42, 74, .12); }
.ai-form input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1.5px solid rgba(15, 42, 74, .25); border-radius: 999px; font: 400 1rem "Archivo", Arial, sans-serif; color: #1F2933; outline: none; }
.ai-form input:focus { border-color: #2E6B94; }
.ai-form button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #0F2A4A; color: #fff; font-size: 1.1rem; cursor: pointer; }
.ai-foot { padding: 8px 16px 12px; color: #5B6672; font-size: .78rem; }
.ai-foot a { color: #2E6B94; font-weight: 600; }
.ai-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 720px) {
  .ai-btn { right: 12px; bottom: calc(74px + env(safe-area-inset-bottom)); height: 44px; padding: 0 14px 0 12px; }
  .ai-panel { right: 8px; left: 8px; width: auto; bottom: calc(126px + env(safe-area-inset-bottom)); max-height: calc(100svh - 160px); }
}
@media (prefers-reduced-motion: reduce) { .ai-btn { transition: none; } }
.ai-btn { opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity .3s, transform .3s, background .2s; }
.ai-btn.ai-show { opacity: 1; pointer-events: auto; transform: none; }
.ai-btn.ai-show:hover { transform: translateY(-2px); }

/* percorso di contatto guidato */
.ai-stato { margin: 0; padding: 8px 16px; font-size: .78rem; font-weight: 600; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.ai-stato::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ai-stato.on { background: #EAF4EC; color: #1E6B34; } .ai-stato.on::before { background: #2E9B4E; }
.ai-stato.off { background: #F4F6F9; color: #5B6672; } .ai-stato.off::before { background: #9AA5B1; }
.ai-bot > div > p:first-child { margin: 0 0 8px; }
.ai-acts, .ai-opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai-acts .ai-cta, .ai-acts .ai-alt { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border-radius: 999px; font: 600 .86rem "Archivo", Arial, sans-serif; text-decoration: none; cursor: pointer; }
.ai-acts .ai-cta { border: 0; } .ai-acts .ai-alt { background: #fff; }
.ai-acts button:disabled, .ai-opt:disabled { opacity: .55; cursor: default; }
.ai-opt { min-height: 38px; padding: 0 13px; border: 1.5px solid rgba(15, 42, 74, .25); border-radius: 999px; background: #fff; color: #0F2A4A; font: 500 .85rem "Archivo", Arial, sans-serif; cursor: pointer; text-align: left; }
.ai-opt:hover:not(:disabled) { border-color: #2E6B94; color: #2E6B94; }
.ai-opt.on { background: #0F2A4A; border-color: #0F2A4A; color: #fff; opacity: 1; }
.ai-mini { display: flex; gap: 6px; }
.ai-mini input, .ai-dati input:not([type=radio]) { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border: 1.5px solid rgba(15, 42, 74, .25); border-radius: 10px; background: #fff; font: 400 1rem "Archivo", Arial, sans-serif; color: #1F2933; }
.ai-mini input:focus, .ai-dati input:focus { outline: 2px solid #3A7CA5; outline-offset: 1px; }
.ai-mini button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: #0F2A4A; color: #fff; cursor: pointer; }
.ai-dati { display: grid; gap: 4px; }
.ai-dati label { font-size: .8rem; font-weight: 600; color: #0F2A4A; margin-top: 4px; }
.ai-dati fieldset { border: 0; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.ai-dati legend { font-size: .8rem; font-weight: 600; color: #0F2A4A; margin-bottom: 2px; }
.ai-dati .ai-radio { font-weight: 400; color: #1F2933; display: inline-flex; align-items: center; gap: 5px; margin: 0; }
.ai-dati .ai-cta { margin-top: 8px; min-height: 42px; border: 0; border-radius: 999px; font: 600 .9rem "Archivo", Arial, sans-serif; cursor: pointer; }
.ai-err { margin: 4px 0 0; color: #B71F1F; font-size: .82rem; }
.ai-err[hidden] { display: none; }
.ai-riep dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 8px 0; font-size: .86rem; }
.ai-riep dt { color: #5B6672; } .ai-riep dd { margin: 0; color: #1F2933; font-weight: 600; overflow-wrap: anywhere; }
.ai-priv { margin: 0; font-size: .76rem; color: #5B6672; } .ai-priv a { color: #2E6B94; }
.ai-ok { background: #EAF4EC; color: #1E6B34; font-weight: 600; }
.ai-form[hidden] { display: none; }
.ai-cta:focus-visible, .ai-alt:focus-visible, .ai-opt:focus-visible { outline: 2px solid #3A7CA5; outline-offset: 2px; }
.ai-dati select { height: 42px; padding: 0 10px; border: 1.5px solid rgba(15, 42, 74, .25); border-radius: 10px; background: #fff; font: 400 1rem "Archivo", Arial, sans-serif; color: #1F2933; }
.ai-dati select:focus { outline: 2px solid #3A7CA5; outline-offset: 1px; }

/* foto e dettatura */
.ai-ico { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 1.5px solid rgba(15, 42, 74, .25); border-radius: 50%; background: #fff; color: #0F2A4A; cursor: pointer; padding: 0; }
.ai-ico svg { width: 22px; height: 22px; }
.ai-ico:hover { border-color: #2E6B94; color: #2E6B94; }
.ai-ico[hidden] { display: none; }
.ai-mic.on { background: #D62828; border-color: #D62828; color: #fff; animation: aiRec 1.2s ease-in-out infinite; }
@keyframes aiRec { 50% { box-shadow: 0 0 0 6px rgba(214, 40, 40, .2); } }
@media (prefers-reduced-motion: reduce) { .ai-mic.on { animation: none; } }
.ai-form { gap: 6px; }
.ai-foto-msg img { display: block; max-width: 180px; max-height: 180px; border-radius: 10px; }
.ai-me:has(.ai-foto-msg) { padding: 4px; background: #0F2A4A; }
.ai-dom { margin: 4px 0 0; padding-left: 18px; font-size: .9rem; }
.ai-dom li { margin: 2px 0; }

/* conversazione a voce: stato sopra la casella, microfono "acceso" anche mentre l'assistente risponde */
.ai-mic[aria-pressed="true"]:not(.on) { background: #0F2A4A; border-color: #0F2A4A; color: #fff; }
.ai-voce-stato { margin: 0; padding: 6px 16px 0; font-size: .8rem; font-weight: 600; color: #B71F1F; }
.ai-voce-stato[hidden] { display: none; }
