#matita-root { --matita-launcher-size:4.1rem; --matita-surface:#f4f7fb; --matita-ink:#20324a; }
#matita-root.matita-size--small { --matita-launcher-size:3.25rem; }
#matita-root.matita-size--large { --matita-launcher-size:5.25rem; }

.matita-launcher { position:fixed; z-index:1100; right:1.25rem; bottom:1.25rem; display:grid; place-items:center; width:var(--matita-launcher-size); height:var(--matita-launcher-size); padding:.22rem; border:3px solid #fff; border-radius:50%; color:#fff; background:var(--matita-color); box-shadow:0 12px 28px rgba(15,31,55,.25); cursor:pointer; transition:transform .18s ease, box-shadow .18s ease; }
.matita-launcher--left { right:auto; left:1.25rem; }
.matita-launcher:hover { transform:translateY(-2px) scale(1.02); box-shadow:0 16px 34px rgba(15,31,55,.3); }
.matita-launcher:focus-visible { outline:3px solid #fff; outline-offset:3px; }
.matita-avatar { display:grid; place-items:center; width:100%; height:100%; overflow:hidden; border-radius:50%; color:var(--matita-color); background:#fff; font-weight:800; }
.matita-avatar img { width:100%; height:100%; object-fit:cover; }

.matita-window { position:fixed; z-index:1101; right:1.25rem; bottom:calc(var(--matita-launcher-size) + 1rem); display:grid; grid-template-rows:auto minmax(180px,1fr) auto; width:min(380px,calc(100vw - 2rem)); height:min(535px,calc(100vh - 7.5rem)); overflow:hidden; border:1px solid rgba(26,53,88,.12); border-radius:1.25rem; color:var(--matita-ink); background:#fff; box-shadow:0 24px 64px rgba(13,30,54,.28); font-family:var(--font-body,system-ui,sans-serif); }
.matita-window--left { right:auto; left:1.25rem; }
.matita-window[hidden] { display:none; }

.matita-header { display:flex; align-items:center; gap:.7rem; min-height:4.7rem; padding:.85rem 1rem; color:#fff; background:linear-gradient(135deg,var(--matita-color),color-mix(in srgb,var(--matita-color) 78%,#14233b)); }
.matita-header .matita-avatar { flex:0 0 3rem; width:3rem; height:3rem; border:2px solid rgba(255,255,255,.86); box-shadow:0 3px 12px rgba(0,0,0,.15); }
.matita-header__text { min-width:0; flex:1; }
.matita-header strong,.matita-header small { display:block; }
.matita-header strong { font-size:1rem; letter-spacing:.01em; }
.matita-header small { margin-top:.14rem; opacity:.9; font-size:.76rem; line-height:1.25; }
.matita-close { display:grid; place-items:center; flex:0 0 2rem; width:2rem; height:2rem; padding:0; border:1px solid rgba(255,255,255,.35); border-radius:50%; color:inherit; background:rgba(255,255,255,.12); cursor:pointer; font-size:1.25rem; line-height:1; }
.matita-close:hover { background:rgba(255,255,255,.24); }

.matita-messages { overflow:auto; padding:1rem; background:linear-gradient(180deg,#f4f7fb 0%,#f8fafc 100%); scrollbar-color:rgba(92,115,144,.5) transparent; scrollbar-width:thin; }
.matita-message { max-width:84%; margin:0 0 .72rem; padding:.72rem .82rem; border-radius:1rem; white-space:pre-wrap; font-size:.91rem; line-height:1.5; box-shadow:0 2px 8px rgba(33,56,87,.05); }
.matita-message--bot { border:1px solid #e0e7f0; border-top-left-radius:.28rem; background:#fff; }
.matita-message--user { margin-left:auto; border-top-right-radius:.28rem; color:#fff; background:var(--matita-color); box-shadow:0 4px 12px color-mix(in srgb,var(--matita-color) 25%,transparent); }
.matita-links { display:grid; gap:.4rem; margin:.15rem 0 .85rem; }
.matita-links a { padding:.55rem .65rem; border:1px solid color-mix(in srgb,var(--matita-color) 22%,#dbe4f0); border-radius:.65rem; color:var(--matita-color); background:#fff; font-size:.82rem; font-weight:650; text-decoration:none; }
.matita-links a:hover { background:#f7faff; text-decoration:underline; }
.matita-confirmation { display:flex; flex-wrap:wrap; gap:.45rem; margin:.1rem 0 .85rem; }
.matita-confirmation button { padding:.48rem .62rem; border:1px solid var(--matita-color); border-radius:.58rem; color:#fff; background:var(--matita-color); cursor:pointer; font:700 .78rem/1 var(--font-body,system-ui,sans-serif); }
.matita-confirmation .matita-confirmation-no { color:var(--matita-color); background:#fff; }

.matita-form { display:flex; gap:.55rem; padding:.75rem; border-top:1px solid #e3e9f1; background:#fff; }
.matita-form input { min-width:0; flex:1; padding:.7rem .78rem; border:1px solid #cad6e4; border-radius:.72rem; color:var(--matita-ink); background:#fff; font:inherit; outline:0; }
.matita-form input:focus { border-color:var(--matita-color); box-shadow:0 0 0 3px color-mix(in srgb,var(--matita-color) 18%,transparent); }
.matita-form button { padding:.68rem .85rem; border:0; border-radius:.7rem; color:#fff; background:var(--matita-color); box-shadow:0 3px 8px color-mix(in srgb,var(--matita-color) 28%,transparent); cursor:pointer; font:700 .84rem/1 var(--font-body,system-ui,sans-serif); }
.matita-form button:hover:not(:disabled) { filter:brightness(.95); }
.matita-form button:disabled { opacity:.6; cursor:wait; }

@media (max-width:560px) { .matita-window,.matita-window--left { right:.75rem; left:.75rem; bottom:calc(var(--matita-launcher-size) + .75rem); width:auto; height:min(560px,calc(100vh - 6.25rem)); }.matita-launcher--left { left:.75rem; right:auto; }.matita-header { min-height:4.35rem; }.matita-header .matita-avatar { flex-basis:2.7rem; width:2.7rem; height:2.7rem; } }
