.ai-widget{position:fixed;right:1.25rem;bottom:1.25rem;z-index:1080;font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;color:#122033}
.ai-widget *{box-sizing:border-box}
.ai-widget__button{min-width:64px;min-height:64px;border:1px solid rgba(138,101,21,.38);border-radius:999px;background:linear-gradient(145deg,#fff7df,#e5c575);color:#263241;box-shadow:0 16px 38px rgba(7,26,53,.22),inset 0 1px 0 rgba(255,255,255,.65);display:inline-flex;align-items:center;gap:.65rem;padding:.85rem 1rem;font-weight:600;letter-spacing:.01em}
.ai-widget__button i{font-size:1.55rem;color:#8a6515}
.ai-widget__button-text{display:flex;flex-direction:column;align-items:flex-start;line-height:1.05}
.ai-widget__button-text small{font-size:.7rem;text-transform:uppercase;letter-spacing:.08em;font-weight:600;color:#56616f}
.ai-widget__panel{position:absolute;right:0;bottom:5.25rem;width:min(420px,calc(100vw - 2rem));height:min(680px,calc(100vh - 7rem));max-height:min(680px,calc(100vh - 7rem));background:#fff;border:1px solid #dce4ee;border-radius:1.35rem;box-shadow:0 24px 70px rgba(7,26,53,.25);overflow:hidden;display:flex;flex-direction:column}
.ai-widget__header{background:#071a35;color:#fff;padding:1rem 1rem .9rem;display:flex;justify-content:space-between;gap:1rem}
.ai-widget__title{display:grid;grid-template-columns:auto 1fr;gap:.65rem;align-items:center}
.ai-widget__title i{color:#d4a73e;font-size:1.35rem}
.ai-widget__title strong{display:block}
.ai-widget__title small{color:#d7e2ef}
.ai-widget__close{width:38px;height:38px;border:1px solid rgba(255,255,255,.25);border-radius:999px;background:transparent;color:#fff}
.ai-widget__notice{padding:.5rem .9rem;background:#e8f0ff;color:#173d78;font-size:.74rem;line-height:1.35;border-bottom:1px solid #dce4ee}
.ai-widget__consent{flex:1 1 auto;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:.75rem;padding:1.35rem;background:#fff8df;color:#3d3211}.ai-widget__consent i{font-size:2rem;color:#8a6515}.ai-widget__consent h3{font-size:1.1rem;margin:0}.ai-widget__consent p{margin:0;line-height:1.55}.ai-widget__consent button{border:0;border-radius:999px;background:#8a6515;color:#fff;font-weight:800;padding:.7rem 1rem}
.ai-widget__voice{background:#fff;border-bottom:1px solid #dce4ee;padding:.75rem 1rem;display:grid;gap:.6rem}.ai-widget__voice-status{display:flex;align-items:center;gap:.5rem;color:#475569;font-size:.84rem}.ai-widget__voice-status i{color:#8a6515;font-size:1.05rem}.ai-widget__voice-actions{display:grid;grid-template-columns:1fr 1fr auto auto;gap:.45rem}.ai-widget__voice-actions button{border-radius:.8rem;border:1px solid #d4deea;background:#fff;color:#122033;font-weight:800;padding:.62rem .7rem}.ai-widget__voice-connect{background:#f8fafc!important}.ai-widget__voice-talk{background:#071a35!important;color:#fff!important;border-color:#071a35!important;display:inline-flex;align-items:center;justify-content:center;gap:.35rem;touch-action:none;user-select:none}.ai-widget__voice-talk.recording{background:#b42318!important;border-color:#8f1b12!important;color:#fff!important;box-shadow:0 0 0 4px rgba(180,35,24,.18)}.ai-widget__voice-talk.locked{background:#8a6515!important;border-color:#6f4f0f!important}.ai-widget__voice-send-recording{background:#146c43!important;border-color:#146c43!important;color:#fff!important;display:inline-flex;align-items:center;justify-content:center;gap:.35rem}.ai-widget__voice-close{width:42px}.ai-widget__voice-actions button:disabled{opacity:.55;cursor:not-allowed}.ai-widget__voice small{color:#64748b;font-size:.78rem}.ai-widget__voice-lock-hint{display:block;color:#7a5700!important;background:#fff8df;border:1px solid #f1d891;border-radius:.65rem;padding:.4rem .55rem}
.ai-widget__messages{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:1rem;background:#f8fafc}
.ai-widget__message{max-width:86%;margin-bottom:.8rem}
.ai-widget__message small{display:block;color:#64748b;margin:0 0 .2rem;font-size:.78rem}
.ai-widget__message p{margin:0;padding:.8rem .95rem;border-radius:1rem;background:#edf1f6;color:#122033;font-size:.94rem;line-height:1.45}
.ai-widget__message--user{margin-left:auto}
.ai-widget__message--user p{background:#071a35;color:#fff}
.ai-widget__message--system{max-width:100%;text-align:center}.ai-widget__message--system p{display:inline-block;background:#fff8df;color:#59400b;font-size:.84rem;padding:.55rem .75rem}
.ai-widget__citations{list-style:none;margin:.4rem 0 0;padding:0;color:#345f96;font-size:.8rem}
.ai-widget__typing{color:#64748b;font-size:.9rem;padding:.25rem 0}
.ai-widget__suggestions{display:flex;gap:.45rem;flex-wrap:wrap;padding:.75rem 1rem 0;background:#fff}
.ai-widget__suggestions button{border:1px solid #dce4ee;border-radius:999px;background:#fff;color:#122033;padding:.45rem .7rem;font-size:.88rem}
.ai-widget__composer{display:flex;gap:.5rem;padding:1rem;background:#fff;border-top:1px solid #dce4ee}
.ai-widget__composer input{min-width:0;flex:1;border:1px solid #cbd5e1;border-radius:.8rem;padding:.7rem .85rem}
.ai-widget__send{width:44px;border:0;border-radius:.8rem;background:#8a6515;color:#fff}
.ai-widget__contact{padding:1rem;background:#fff;border-top:1px solid #dce4ee}
.ai-widget__contact h3{font-size:1rem;margin:0 0 .35rem}
.ai-widget__contact p{font-size:.9rem;color:#64748b;margin:0 0 .75rem}
.ai-widget__contact label{font-weight:700;font-size:.86rem;margin:.45rem 0 .2rem}
.ai-widget__contact input{width:100%;border:1px solid #cbd5e1;border-radius:.75rem;padding:.65rem .75rem}
.ai-widget__contact button{margin-top:.8rem;width:100%;border:0;border-radius:.8rem;background:#8a6515;color:#fff;font-weight:800;padding:.75rem}
.ai-widget__status{padding:.55rem 1rem;background:#fff8df;color:#59400b;font-size:.86rem;border-top:1px solid #f1d891}
.ai-widget__toast{position:absolute;right:0;bottom:5.25rem;width:min(360px,calc(100vw - 2rem));background:#146c43;color:#fff;padding:.85rem 1rem;border-radius:.8rem;box-shadow:0 18px 45px rgba(7,26,53,.2)}
.ai-widget :focus-visible{outline:3px solid #f5b800;outline-offset:3px}
.app-toast{bottom:6rem}
body.dark-theme .ai-widget__panel,body.dark-theme .ai-widget__composer,body.dark-theme .ai-widget__suggestions,body.dark-theme .ai-widget__contact,body.dark-theme .ai-widget__voice{background:#102039;color:#edf4ff;border-color:#60728a}
body.dark-theme .ai-widget__consent{background:#1d314d;color:#edf4ff}
body.dark-theme .ai-widget__messages{background:#091425}
body.dark-theme .ai-widget__message p{background:#233650;color:#edf4ff}
body.dark-theme .ai-widget__message--user p{background:#d4a73e;color:#101828}
body.dark-theme .ai-widget__message--system p{background:#1d314d;color:#edf4ff}body.dark-theme .ai-widget__voice-status,body.dark-theme .ai-widget__voice small{color:#c7d2e2}
body.dark-theme .ai-widget__suggestions button,body.dark-theme .ai-widget__composer input,body.dark-theme .ai-widget__contact input,body.dark-theme .ai-widget__voice-actions button{background:#091425;color:#edf4ff;border-color:#60728a}
body.high-contrast .ai-widget__button,body.high-contrast .ai-widget__send,body.high-contrast .ai-widget__contact button,body.high-contrast .ai-widget__voice-actions button{background:#000;color:#fff;border:2px solid #000}
body.high-contrast .ai-widget__panel{border:2px solid #000;box-shadow:none}
@media(max-width:575px){.ai-widget{right:1rem;bottom:1rem}.ai-widget__button-text{display:none}.ai-widget__panel{position:fixed;left:1rem;right:1rem;bottom:5.25rem;width:auto;max-height:calc(100vh - 6.5rem)}.ai-widget__voice-actions{grid-template-columns:1fr 1fr auto}.ai-widget__voice-send-recording{grid-column:1/-1}}
@media(prefers-reduced-motion:reduce){.ai-widget *{transition-duration:.01ms!important;animation-duration:.01ms!important}}

/* Controlli voce compatti */
.ai-widget__voice{padding:.55rem .85rem;gap:.45rem}
.ai-widget__voice-status{font-size:.76rem;gap:.35rem}
.ai-widget__voice-status i{font-size:.92rem}
.ai-widget__voice-actions{gap:.32rem;grid-template-columns:minmax(0,1fr) minmax(0,.8fr) auto auto}
.ai-widget__voice-actions button{border-radius:.62rem;font-size:.78rem;line-height:1.1;padding:.4rem .48rem;min-height:32px}
.ai-widget__voice-talk{gap:.25rem}
.ai-widget__voice-talk i,.ai-widget__voice-send-recording i{font-size:.86rem}
.ai-widget__voice-close{width:34px;min-width:34px;padding:.35rem!important}
.ai-widget__voice small{font-size:.7rem}
.ai-widget__voice-lock-hint{padding:.32rem .45rem}
@media(max-width:575px){.ai-widget__voice-actions{grid-template-columns:1fr 1fr auto}.ai-widget__voice-send-recording{grid-column:1/-1}}

/* Barra input stile chat mobile: testo, voce e invio nello stesso gruppo */
.ai-widget__composer{display:block;padding:.7rem .85rem;background:#fff;border-top:1px solid #dce4ee}
.ai-widget__composer-row{display:flex;align-items:center;gap:.42rem;background:#f8fafc;border:1px solid #dce4ee;border-radius:999px;padding:.35rem .4rem .35rem .72rem}
.ai-widget__composer input{border:0;background:transparent;border-radius:0;padding:.45rem .25rem;min-height:34px}
.ai-widget__composer input:focus{outline:0;box-shadow:none}
.ai-widget__send,.ai-widget__voice-inline,.ai-widget__voice-inline-send,.ai-widget__voice-inline-close{width:34px;height:34px;min-width:34px;border:0;border-radius:999px;display:inline-grid;place-items:center;padding:0}
.ai-widget__send{background:#8a6515;color:#fff}
.ai-widget__voice-inline{background:#edf2f7;color:#34465f;border:1px solid #d8e1ec;touch-action:none;user-select:none}
.ai-widget__voice-inline.connected{background:#eaf1fb;color:#17477f}
.ai-widget__voice-inline.connecting{background:#fff8df;color:#8a6515}
.ai-widget__voice-inline.recording{background:#b42318;color:#fff;box-shadow:0 0 0 4px rgba(180,35,24,.14)}
.ai-widget__voice-inline.locked{background:#8a6515;color:#fff}
.ai-widget__voice-inline-send{background:#146c43;color:#fff}
.ai-widget__voice-inline-close{background:#fff0f0;color:#a61e2c;border:1px solid #f3c4c8}
.ai-widget__composer-meta{min-height:1rem;margin:.35rem .4rem 0;color:#64748b;font-size:.7rem;line-height:1.25;display:flex;gap:.5rem;flex-wrap:wrap}
.ai-widget__composer-audio-note{color:#7a5700}
body.dark-theme .ai-widget__composer-row{background:#091425;border-color:#60728a}
body.dark-theme .ai-widget__voice-inline{background:#1d314d;color:#edf4ff;border-color:#60728a}
body.dark-theme .ai-widget__voice-inline-close{background:#3a1e25;color:#ffd7dc;border-color:#79414a}
body.dark-theme .ai-widget__composer-meta{color:#c7d2e2}
body.high-contrast .ai-widget__voice-inline,body.high-contrast .ai-widget__voice-inline-send,body.high-contrast .ai-widget__voice-inline-close{background:#000;color:#fff;border:2px solid #000}
@media(max-width:575px){.ai-widget__composer{padding:.65rem}.ai-widget__composer-row{gap:.35rem;padding:.3rem .35rem .3rem .62rem}.ai-widget__send,.ai-widget__voice-inline,.ai-widget__voice-inline-send,.ai-widget__voice-inline-close{width:32px;height:32px;min-width:32px}}

html[dir="rtl"] .ai-widget__panel{text-align:right}
html[dir="rtl"] .ai-widget__title,html[dir="rtl"] .ai-widget__message small,html[dir="rtl"] .ai-widget__composer-meta{direction:rtl}
html[dir="rtl"] .ai-widget__message--user{margin-right:auto;margin-left:0}
html[dir="rtl"] .ai-widget__composer-row{padding:.35rem .72rem .35rem .4rem}
