.agent-widget { position: fixed; right: 24px; bottom: 24px; z-index: 470; pointer-events: none; }
.agent-launcher,
.agent-panel,
.agent-scrim { pointer-events: auto; }
.agent-launcher { position: relative; z-index: 2; min-width: 214px; min-height: 64px; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 11px; padding: 9px 12px 9px 10px; color: #fff; text-align: left; background: linear-gradient(135deg, #075fd8, #063a8d); border: 1px solid rgb(255 255 255 / 18%); border-radius: 19px; box-shadow: 0 18px 40px rgb(4 35 80 / 28%); cursor: pointer; transition: transform 200ms ease, box-shadow 200ms ease, opacity 180ms ease; }
.agent-launcher:hover { box-shadow: 0 22px 48px rgb(4 35 80 / 34%); transform: translateY(-3px); }
.agent-launcher-icon,
.agent-avatar { position: relative; display: grid; place-items: center; overflow: visible; background: #fff; border-radius: 14px; }
.agent-launcher-icon { width: 44px; height: 44px; }
.agent-launcher-icon img { width: 30px; height: 30px; object-fit: contain; }
.agent-launcher-icon i,
.agent-avatar i { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; background: #20bf7a; border: 2px solid #fff; border-radius: 50%; }
.agent-launcher-copy { display: grid; gap: 2px; }
.agent-launcher-copy small { color: #bcd8ff; font-size: .59rem; }
.agent-launcher-copy strong { font-size: .75rem; }
.agent-unread { width: 20px; height: 20px; display: grid; place-items: center; color: #723300; background: #ffb37c; border-radius: 50%; font-size: .62rem; font-weight: 800; box-shadow: 0 0 0 4px rgb(255 179 124 / 16%); }
.agent-widget.is-open .agent-launcher { opacity: 0; pointer-events: none; transform: translateY(8px) scale(.95); }

.agent-panel { position: absolute; right: 0; bottom: 78px; z-index: 2; width: min(390px, calc(100vw - 32px)); height: min(580px, calc(100svh - 128px)); display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid #d8e1ee; border-radius: 24px; box-shadow: 0 30px 80px rgb(2 23 56 / 28%); opacity: 0; visibility: hidden; transform: translateY(18px) scale(.97); transform-origin: bottom right; transition: opacity 200ms ease, transform 240ms cubic-bezier(.2,.8,.2,1), visibility 0s linear 240ms; }
.agent-widget.is-open .agent-panel { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.agent-header { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr) 38px; align-items: center; gap: 12px; padding: 18px; overflow: hidden; color: #fff; background: radial-gradient(circle at 90% 10%, rgb(255 255 255 / 20%), transparent 32%), linear-gradient(135deg, #075fd8, #062c6d); }
.agent-header::after { position: absolute; right: -30px; bottom: -55px; width: 130px; height: 130px; border: 1px solid rgb(255 255 255 / 13%); border-radius: 50%; content: ""; }
.agent-avatar { width: 48px; height: 48px; z-index: 1; }
.agent-avatar img { width: 33px; height: 33px; object-fit: contain; }
.agent-header > div { z-index: 1; min-width: 0; }
.agent-header h2 { margin: 3px 0 2px; font-family: "Plus Jakarta Sans", sans-serif; font-size: .9rem; }
.agent-header p { margin: 0; color: #bcd4f5; font-size: .61rem; }
.agent-online { display: inline-flex; align-items: center; gap: 5px; color: #8ff0c2; font-size: .57rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.agent-online::before { width: 6px; height: 6px; background: currentColor; border-radius: 50%; content: ""; }
.agent-close { position: relative; z-index: 1; width: 38px; height: 38px; display: grid; place-items: center; color: #fff; background: rgb(255 255 255 / 10%); border: 1px solid rgb(255 255 255 / 14%); border-radius: 11px; cursor: pointer; }
.agent-close svg { width: 17px; height: 17px; }
.agent-close > span { display: none; }
.agent-close::before,
.agent-close::after { position: absolute; width: 14px; height: 2px; background: currentColor; border-radius: 999px; content: ""; transform: rotate(45deg); }
.agent-close::after { transform: rotate(-45deg); }
.agent-context { display: flex; align-items: center; gap: 8px; padding: 9px 15px; color: #38506f; background: #edf5ff; border-bottom: 1px solid #dce9f8; font-size: .6rem; line-height: 1.45; }
.agent-context svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--brand-blue); }
.agent-messages { flex: 1; display: flex; flex-direction: column; gap: 13px; padding: 17px; overflow-y: auto; overscroll-behavior: contain; background: linear-gradient(#f8fafc, #fff); scrollbar-width: thin; scrollbar-color: #c5d0df transparent; }
.agent-message { display: flex; align-items: flex-end; gap: 8px; animation: agent-message-in 260ms ease both; }
.agent-message > div { max-width: 82%; }
.agent-message p { margin: 0; padding: 11px 13px; font-size: .69rem; line-height: 1.55; overflow-wrap: anywhere; }
.agent-message small { display: block; margin-top: 4px; color: #8290a3; font-size: .53rem; }
.agent-message.bot p { color: #17233a; background: #edf1f7; border-radius: 5px 15px 15px 15px; }
.agent-message.user { justify-content: flex-end; }
.agent-message.user > div { display: grid; justify-items: end; }
.agent-message.user p { color: #fff; background: var(--brand-blue); border-radius: 15px 5px 15px 15px; box-shadow: 0 8px 20px rgb(7 95 216 / 15%); }
.agent-message-avatar { width: 28px; height: 28px; display: grid; flex: 0 0 auto; place-items: center; background: #fff; border: 1px solid #dce4ee; border-radius: 9px; }
.agent-message-avatar img { width: 19px; height: 19px; object-fit: contain; }
.agent-message.typing p { display: flex; gap: 4px; padding-block: 15px; }
.agent-message.typing p i { width: 6px; height: 6px; background: #7f8da1; border-radius: 50%; animation: agent-typing 1s ease-in-out infinite; }
.agent-message.typing p i:nth-child(2) { animation-delay: 120ms; }
.agent-message.typing p i:nth-child(3) { animation-delay: 240ms; }
.agent-prompts { display: flex; gap: 7px; padding: 10px 14px 5px; overflow-x: auto; scrollbar-width: none; background: #fff; }
.agent-prompts button { min-height: 32px; flex: 0 0 auto; padding: 7px 10px; color: #0752b8; background: #f1f6fd; border: 1px solid #cfdef2; border-radius: 999px; font-size: .59rem; font-weight: 700; cursor: pointer; }
.agent-prompts button:hover { color: #fff; background: var(--brand-blue); border-color: var(--brand-blue); }
.agent-composer { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 7px; padding: 10px 14px; background: #fff; }
.agent-composer input { min-width: 0; padding: 11px 13px; color: var(--ink-950); background: #f7f9fc; border: 1px solid #dbe2ec; border-radius: 12px; outline: 0; font: inherit; font-size: .68rem; }
.agent-composer input:focus { background: #fff; border-color: #79a9e9; box-shadow: 0 0 0 4px rgb(7 95 216 / 8%); }
.agent-composer button { position: relative; display: grid; place-items: center; color: #fff; background: var(--brand-blue); border: 0; border-radius: 12px; cursor: pointer; }
.agent-composer button > span { display: none; }
.agent-composer button::before { width: 10px; height: 10px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; content: ""; transform: translateX(-2px) rotate(45deg); }
.agent-composer button::after { position: absolute; width: 14px; height: 2px; background: currentColor; content: ""; transform: translateX(-2px); }
.agent-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 15px 13px; color: #69788d; background: #fff; border-top: 1px solid #edf0f4; font-size: .56rem; }
.agent-footer > span { display: inline-flex; align-items: center; gap: 6px; }
.agent-footer > span i { width: 6px; height: 6px; background: #20bf7a; border-radius: 50%; }
.agent-footer button { display: inline-flex; align-items: center; gap: 6px; padding: 0; color: var(--brand-blue); background: transparent; border: 0; font-size: .59rem; font-weight: 800; cursor: pointer; }
.agent-footer button svg { width: 14px; height: 14px; }
.agent-scrim { position: fixed; inset: 0; z-index: 1; display: none; background: rgb(2 16 39 / 54%); border: 0; opacity: 0; }
@keyframes agent-message-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes agent-typing { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

@media (max-width: 620px) {
  .agent-widget { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); }
  .agent-launcher { min-width: 58px; width: 58px; min-height: 58px; grid-template-columns: 1fr; padding: 7px; border-radius: 18px; }
  .agent-launcher-icon { width: 42px; height: 42px; margin: auto; }
  .agent-launcher-copy { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .agent-unread { position: absolute; top: -5px; right: -5px; }
  .agent-panel { position: fixed; right: 0; bottom: 0; left: 0; width: 100%; height: min(680px, 92svh); border-right: 0; border-bottom: 0; border-left: 0; border-radius: 24px 24px 0 0; transform: translateY(35px); transform-origin: bottom; }
  .agent-widget.is-open .agent-panel { transform: none; }
  .agent-scrim { display: block; }
  .agent-widget.is-open .agent-scrim { opacity: 1; }
  body.agent-open { overflow: hidden; }
  .agent-messages { padding-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .agent-message,
  .agent-message.typing p i { animation: none; }
}
