.aia-assistant {
  --aia-chat-accent: #08bce8;
  --aia-chat-ink: #09263a;
  position: fixed;
  z-index: 500;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--aia-chat-ink);
}

.aia-assistant button,
.aia-assistant input { font: inherit; }

.aia-assistant__launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 7px 16px 7px 7px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 999px;
  color: #083047;
  background: rgba(248,253,255,.88);
  box-shadow: 0 18px 46px rgba(15,82,112,.2);
  backdrop-filter: blur(18px) saturate(1.3);
  cursor: pointer;
}

.aia-assistant__launcher:hover { transform: translateY(-2px); }
.aia-assistant__launcher:focus-visible,
.aia-assistant button:focus-visible,
.aia-assistant input:focus-visible { outline: 3px solid rgba(8,188,232,.3); outline-offset: 2px; }

.aia-assistant__launcher-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, #07bde9, #087ca8);
  box-shadow: 0 9px 22px rgba(8,174,218,.3);
}
.aia-assistant__launcher-mark::before { content: "A"; color: #fff; font: 800 20px/1 "Manrope", sans-serif; }
.aia-assistant__launcher-mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: inherit;
  animation: aia-orbit 5s linear infinite;
}
.aia-assistant__launcher-copy { display: grid; gap: 3px; text-align: left; }
.aia-assistant__launcher-copy b { font: 800 .72rem/1 "Manrope", sans-serif; letter-spacing: .11em; }
.aia-assistant__launcher-copy small { color: #5e7b89; font-size: .68rem; }
.aia-assistant__status-dot { width: 7px; height: 7px; margin-left: 1px; border-radius: 50%; background: #12bd80; box-shadow: 0 0 0 5px rgba(18,189,128,.11); }
.aia-assistant.is-local .aia-assistant__status-dot { background: #f0a344; box-shadow: 0 0 0 5px rgba(240,163,68,.12); }

.aia-assistant__panel {
  position: absolute;
  left: 0;
  bottom: 68px;
  display: grid;
  grid-template-rows: auto minmax(120px, 1fr) auto auto auto auto;
  width: min(390px, calc(100vw - 36px));
  height: min(610px, calc(100vh - 110px));
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.95);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(8,188,232,.14), transparent 34%),
    rgba(246,252,255,.96);
  box-shadow: 0 35px 100px rgba(12,70,98,.25);
  backdrop-filter: blur(28px) saturate(1.35);
  transform-origin: left bottom;
  animation: aia-panel-in .28s ease both;
}
.aia-assistant__panel[hidden] { display: none; }

.aia-assistant__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 17px 14px;
  border-bottom: 1px solid rgba(8,112,151,.1);
}
.aia-assistant__avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  aspect-ratio: 1;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(145deg, #07bde9, #087ca8);
  box-shadow: 0 11px 26px rgba(8,174,218,.27);
}
.aia-assistant__avatar::before { content: "A"; font: 800 22px/1 "Manrope", sans-serif; }
.aia-assistant.is-thinking .aia-assistant__avatar::after,
.aia-assistant.is-speaking .aia-assistant__avatar::after,
.aia-assistant.is-listening .aia-assistant__avatar::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 2px solid rgba(8,188,232,.3);
  border-top-color: var(--aia-chat-accent);
  border-radius: 20px;
  animation: aia-orbit .9s linear infinite;
}
.aia-assistant__identity { display: grid; gap: 4px; }
.aia-assistant__identity strong { font: 800 .82rem/1 "Manrope", sans-serif; letter-spacing: .09em; }
.aia-assistant__identity span { color: #5d7a89; font-size: .72rem; }
.aia-assistant__close { margin-left: auto; width: 34px; aspect-ratio: 1; border: 0; border-radius: 50%; color: #4b6c7c; background: rgba(255,255,255,.7); cursor: pointer; }

.aia-assistant__log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 17px;
  scroll-behavior: smooth;
}
.aia-msg { display: grid; gap: 4px; max-width: 88%; }
.aia-msg--user { align-self: end; justify-items: end; }
.aia-msg--assistant,
.aia-msg--welcome { align-self: start; }
.aia-msg__role { color: #78909c; font: 800 .56rem/1 "Manrope", sans-serif; letter-spacing: .14em; }
.aia-msg__text { padding: 11px 13px; border-radius: 15px 15px 15px 4px; color: #294e60; background: rgba(255,255,255,.88); box-shadow: 0 8px 24px rgba(20,82,109,.08); font-size: .86rem; line-height: 1.5; white-space: pre-wrap; }
.aia-msg--user .aia-msg__text { border-radius: 15px 15px 4px 15px; color: #fff; background: linear-gradient(135deg, #087ca8, #08bce8); }
.aia-msg--welcome .aia-msg__text { color: #0a708f; background: rgba(8,188,232,.1); }
.aia-msg__dots { display: inline-flex; gap: 4px; }
.aia-msg__dots i { width: 5px; height: 5px; border-radius: 50%; background: #08aeda; animation: aia-dot 1s ease-in-out infinite; }
.aia-msg__dots i:nth-child(2) { animation-delay: .14s; }
.aia-msg__dots i:nth-child(3) { animation-delay: .28s; }

/* EU AI Act Art. 50 disclosure gate — shown before the composer unlocks. */
/* While the gate is up the log is empty, so the notice takes the whole panel. */
.aia-assistant.is-consenting .aia-assistant__log { display: none; }

.aia-consent {
  display: grid;
  gap: 9px;
  overflow-y: auto;
  margin: 11px 15px;
  padding: 14px 15px;
  border: 1px solid rgba(8,151,194,.22);
  border-radius: 16px;
  color: #294e60;
  background: rgba(8,188,232,.09);
}
.aia-consent[hidden] { display: none; }
.aia-consent__title { margin: 0; color: #0a708f; font: 800 .74rem/1.35 "Manrope", sans-serif; letter-spacing: .05em; }
.aia-consent p { margin: 0; font-size: .74rem; line-height: 1.5; }
.aia-consent p[lang="en"] { color: #4b6c7c; }
.aia-consent a { color: #0a789c; text-underline-offset: 2px; }
.aia-consent__check { display: flex; gap: 8px; align-items: flex-start; font-size: .73rem; line-height: 1.45; cursor: pointer; }
.aia-consent__check input { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 1px; accent-color: #087ca8; cursor: pointer; }
/* Sticky so ACCEPT stays reachable when the notice scrolls on small screens. */
.aia-consent__actions { position: sticky; bottom: -14px; display: flex; gap: 8px; margin: 0 -15px -14px; padding: 10px 15px 14px; border-top: 1px solid rgba(8,151,194,.18); background: #e5f6fd; }
.aia-consent__accept,
.aia-consent__decline { padding: 9px 13px; border: 0; border-radius: 12px; font: 800 .68rem/1 "Manrope", sans-serif; letter-spacing: .06em; cursor: pointer; }
.aia-consent__accept { color: #fff; background: linear-gradient(135deg, #087ca8, #08bce8); }
.aia-consent__accept:disabled { opacity: .4; cursor: not-allowed; }
.aia-consent__decline { color: #4b6c7c; background: rgba(255,255,255,.8); }

.aia-assistant__badge { display: inline-block; margin-left: 5px; padding: 1px 5px; border-radius: 5px; color: #fff; background: #087ca8; font: 800 .58rem/1.5 "Manrope", sans-serif; font-style: normal; letter-spacing: .08em; vertical-align: middle; }

.aia-assistant__prompts { display: flex; gap: 7px; overflow-x: auto; padding: 0 17px 11px; }
.aia-assistant__prompts[hidden] { display: none; }
.aia-assistant__prompt { flex: 0 0 auto; padding: 8px 11px; border: 1px solid rgba(8,151,194,.15); border-radius: 999px; color: #0a789c; background: rgba(255,255,255,.78); font-size: .7rem; font-weight: 700; cursor: pointer; }

.aia-assistant__form { display: grid; grid-template-columns: 1fr auto auto; gap: 7px; padding: 12px 13px 9px; border-top: 1px solid rgba(8,112,151,.1); }
.aia-assistant__input { width: 100%; min-width: 0; padding: 11px 12px; border: 1px solid rgba(7,121,162,.16); border-radius: 13px; outline: 0; color: #12394c; background: rgba(255,255,255,.84); }
.aia-assistant__input::placeholder { color: #8097a2; }
.aia-assistant__action { min-width: 42px; border: 0; border-radius: 13px; color: #0a789c; background: rgba(8,188,232,.1); font-weight: 800; cursor: pointer; }
.aia-assistant__action--send { color: #fff; background: linear-gradient(135deg, #087ca8, #08bce8); }
.aia-assistant__action.is-active { color: #fff; background: #12a978; }
.aia-assistant__action:disabled { opacity: .38; cursor: not-allowed; }

.aia-assistant__foot { display: flex; align-items: center; gap: 9px; padding: 0 15px 13px; color: #718a96; font-size: .62rem; line-height: 1.35; }
.aia-assistant__foot button { border: 0; padding: 0; color: #0a789c; background: none; font-size: inherit; font-weight: 800; cursor: pointer; }
.aia-assistant__foot span { margin-left: auto; text-align: right; }
.aia-assistant__foot span a { color: inherit; text-underline-offset: 2px; }

@keyframes aia-panel-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes aia-orbit { to { transform: rotate(360deg); } }
@keyframes aia-dot { 50% { transform: translateY(-3px); opacity: .45; } }

@media (max-width: 600px) {
  .aia-assistant { left: 10px; bottom: max(10px, env(safe-area-inset-bottom)); }
  .aia-assistant__launcher-copy small { display: none; }
  .aia-assistant__launcher { min-height: 49px; padding-right: 13px; }
  .aia-assistant__launcher-mark { width: 35px; }
  .aia-assistant__panel { bottom: 59px; width: calc(100vw - 20px); height: min(560px, calc(100vh - 82px)); border-radius: 23px; }
  /* Tighter notice so the checkbox and ACCEPT both fit without scrolling. */
  .aia-consent { gap: 7px; margin: 9px 11px; padding: 12px; }
  .aia-consent p { font-size: .69rem; line-height: 1.42; }
  .aia-consent__title { font-size: .7rem; }
  .aia-consent__check { font-size: .69rem; line-height: 1.35; }
  .aia-consent__actions { margin: 0 -12px -12px; padding: 8px 12px 12px; }
  .aia-consent__accept, .aia-consent__decline { padding: 8px 10px; font-size: .64rem; }
}

@media (prefers-reduced-motion: reduce) {
  .aia-assistant *, .aia-assistant *::before, .aia-assistant *::after { animation: none !important; scroll-behavior: auto !important; }
}
