/* Hallmark · component: AI assistant widget · genre: technical precision · theme: existing Rexia
 * states: default · hover · focus · active · disabled · loading · error · success
 * contrast: preserved from the existing design system
 * pre-emit critique: P4 H4 E4 S5 R5 V4
 */
.rx-assistant {
  --rx-blue: #00d9f5;
  --rx-blue-deep: #087b9b;
  --rx-gold: #ffd400;
  --rx-ink: #e7f2ff;
  --rx-muted: #8da1b8;
  --rx-surface: #0b111b;
  --rx-surface-raised: #111b2b;
  --rx-line: rgba(78, 192, 214, .22);
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 2147482000;
  font: 14px/1.45 Roboto, Arial, sans-serif;
  color: var(--rx-ink);
}
.rx-assistant *, .rx-assistant *::before, .rx-assistant *::after { box-sizing: border-box; }
.rx-assistant button, .rx-assistant textarea { font: inherit; }
.rx-assistant .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.rx-assistant__launcher { position: relative; display: grid; place-items: center; width: 92px; height: 92px; margin-left: auto; padding: 0; border: 0; border-radius: 0; color: #fff; cursor: pointer; background: transparent; box-shadow: none; transition: transform .22s ease, border-radius .28s ease, background-color .22s ease, box-shadow .22s ease; }
.rx-assistant__launcher:hover { transform: translateY(-3px); box-shadow: none; }
.rx-assistant__launcher:active { transform: translateY(0) scale(.96); }
.rx-assistant__launcher:focus-visible, .rx-assistant button:focus-visible, .rx-assistant textarea:focus-visible { outline: 3px solid rgba(0,217,245,.3); outline-offset: 3px; }
.rx-assistant__launcher svg { position: absolute; width: 29px; height: 29px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: opacity .2s ease, transform .28s ease; }
.rx-assistant__launcher-image { position: absolute; width: 92px; height: 92px; object-fit: contain; transform: translateY(-5px) scale(1); filter: drop-shadow(0 5px 8px rgba(0,0,0,.7)); transition: opacity .2s ease, transform .28s ease; image-rendering: pixelated; }
.rx-assistant__launcher-close { opacity: 0; transform: rotate(-75deg) scale(.7); }
.rx-assistant.is-open .rx-assistant__launcher { width: 74px; height: 74px; border: 1px solid rgba(0,217,245,.55); border-radius: 50%; background: radial-gradient(circle at 50% 35%, #15283d, #07101b 72%); box-shadow: 0 0 0 5px rgba(0,217,245,.07), 0 16px 36px rgba(0,0,0,.6), inset 0 1px rgba(255,255,255,.08); }
.rx-assistant.is-open .rx-assistant__launcher-image { opacity: 0; transform: translateY(-5px) rotate(30deg) scale(.68); }
.rx-assistant.is-open .rx-assistant__launcher-close { opacity: 1; transform: rotate(0) scale(1); }
.rx-assistant__launcher-pulse { display: none; }
.rx-assistant.is-open .rx-assistant__launcher-pulse { display: none; }
.rx-assistant__panel { position: absolute; right: 0; bottom: 90px; width: min(390px, calc(100vw - 28px)); height: min(620px, calc(100vh - 132px)); height: min(620px, calc(100svh - 132px)); display: grid; grid-template-rows: auto minmax(0,1fr) auto auto; overflow: hidden; border: 1px solid rgba(35,145,169,.5); border-radius: 18px; background: var(--rx-surface); box-shadow: 0 0 0 1px rgba(0,0,0,.8), 0 26px 70px rgba(0,0,0,.68), inset 0 1px rgba(255,255,255,.04); opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(16px) scale(.96); transform-origin: right bottom; transition: opacity .2s ease, transform .32s cubic-bezier(.2,.8,.2,1), visibility .32s; }
.rx-assistant.is-open .rx-assistant__panel { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0) scale(1); }
.rx-assistant__header { display: grid; grid-template-columns: 48px 1fr 36px; align-items: center; gap: 10px; min-height: 74px; padding: 10px 14px 10px 12px; color: #fff; border-bottom: 1px solid rgba(0,217,245,.22); background: linear-gradient(120deg, #0d1c2a, #102b38 75%); }
.rx-assistant__brand-icon { display: grid; place-items: center; width: 46px; height: 46px; overflow: visible; border: 0; border-radius: 0; background: transparent; }
.rx-assistant__brand-icon img { width: 54px; height: 54px; object-fit: contain; transform: translateY(2px); image-rendering: pixelated; }
.rx-assistant__header strong { display: block; color: #dffbff; font-size: 15px; letter-spacing: .01em; }
.rx-assistant__header span span { display: block; margin-top: 2px; font-size: 11px; color: var(--rx-muted); }
.rx-assistant__header i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #73e6a5; box-shadow: 0 0 0 3px rgba(115,230,165,.14); }
.rx-assistant__close { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 12px; color: #fff; background: transparent; cursor: pointer; }
.rx-assistant__close:hover { color: var(--rx-blue); background: rgba(0,217,245,.08); }
.rx-assistant__close svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.rx-assistant__conversation { min-height: 0; overflow-y: auto; padding: 20px 18px 12px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #25495b transparent; background: radial-gradient(circle at 50% 0, rgba(24,51,70,.42), transparent 210px), #090f18; }
.rx-assistant__intro { display: grid; grid-template-columns: 30px 1fr; align-items: end; gap: 9px; animation: rx-assistant-rise .42s .08s both; }
.rx-assistant__avatar { display: grid; place-items: center; width: 32px; height: 32px; overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.rx-assistant__avatar img { width: 39px; height: 39px; object-fit: contain; image-rendering: pixelated; }
.rx-assistant__bubble { max-width: 286px; padding: 13px 15px; border: 1px solid rgba(87,120,153,.2); border-radius: 15px 15px 15px 5px; background: var(--rx-surface-raised); color: #b8c8d9; }
.rx-assistant__bubble strong { display: block; margin-bottom: 4px; color: var(--rx-gold); font-size: 14px; }
.rx-assistant__bubble p { margin: 0; font-size: 13px; }
.rx-assistant__topics { margin: 24px 0 18px 39px; animation: rx-assistant-rise .42s .15s both; }
.rx-assistant__eyebrow { display: block; margin-bottom: 9px; color: var(--rx-blue); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.rx-assistant__topic-list { display: flex; flex-wrap: wrap; gap: 7px; }
.rx-assistant__topic-list button { padding: 8px 11px; border: 1px solid rgba(70,143,165,.32); border-radius: 999px; color: #c9d8e8; background: #101925; box-shadow: 0 2px 5px rgba(0,0,0,.18); cursor: pointer; font-size: 12px; font-weight: 700; transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease; }
.rx-assistant__topic-list button:hover { color: #061018; background: var(--rx-blue); border-color: var(--rx-blue); transform: translateY(-1px); }
.rx-assistant__topics.is-hidden { display: none; }
.rx-assistant__message { display: flex; gap: 8px; margin: 12px 0; animation: rx-assistant-rise .25s both; }
.rx-assistant__message.is-user { justify-content: flex-end; }
.rx-assistant__message-content { max-width: 83%; padding: 11px 13px; border: 1px solid rgba(87,120,153,.2); border-radius: 15px 15px 15px 5px; color: #c5d2e0; background: var(--rx-surface-raised); white-space: pre-wrap; overflow-wrap: anywhere; }
.rx-assistant__message-content strong { color: #f4f9ff; font-weight: 700; }
.rx-assistant__message-content a { color: var(--rx-blue); text-decoration: underline; text-decoration-color: rgba(0,217,245,.5); text-underline-offset: 2px; overflow-wrap: anywhere; }
.rx-assistant__message-content a:hover { color: #8af3ff; text-decoration-color: currentColor; }
.rx-assistant__message.is-user .rx-assistant__message-content { border-color: rgba(0,217,245,.46); border-radius: 15px 15px 5px 15px; color: #eafcff; background: #0b4050; }
.rx-assistant__message.is-pending .rx-assistant__message-content { color: var(--rx-muted); }
.rx-assistant__typing { display: inline-flex; gap: 4px; align-items: center; height: 12px; }
.rx-assistant__typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--rx-blue); animation: rx-assistant-dot 1.1s infinite ease-in-out; }
.rx-assistant__typing i:nth-child(2) { animation-delay: .14s; }.rx-assistant__typing i:nth-child(3) { animation-delay: .28s; }
.rx-assistant__composer { display: grid; grid-template-columns: 1fr 44px; align-items: end; gap: 8px; padding: 12px 14px 7px; border-top: 1px solid var(--rx-line); background: #0b111b; }
.rx-assistant__input-wrap { display: block; }
.rx-assistant__input-wrap textarea { display: block; width: 100%; max-height: 92px; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; resize: none; padding: 11px 14px; border: 1px solid rgba(70,143,165,.3); border-radius: 14px; outline: 0; color: var(--rx-ink); background: #080e16; line-height: 20px; transition: border-color .18s, background .18s; }
.rx-assistant__input-wrap textarea::-webkit-scrollbar { width: 0; height: 0; display: none; }
.rx-assistant__input-wrap textarea:focus { border-color: rgba(0,217,245,.72); background: #0c1520; }
.rx-assistant__input-wrap textarea::placeholder { color: #708297; }
.rx-assistant__send { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #39e8ff; border-radius: 14px; color: #061018; background: var(--rx-blue); cursor: pointer; box-shadow: 0 0 18px rgba(0,217,245,.16); transition: transform .18s, opacity .18s; }
.rx-assistant__send:hover { transform: translateY(-1px); }.rx-assistant__send:disabled { opacity: .5; cursor: wait; transform: none; }
.rx-assistant__send svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rx-assistant__notice { margin: 0; padding: 2px 18px 10px; color: #63758a; background: #0b111b; font-size: 10px; text-align: center; }
@keyframes rx-assistant-pulse { 0% { opacity: .75; transform: scale(.88); } 72%,100% { opacity: 0; transform: scale(1.14); } }
@keyframes rx-assistant-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes rx-assistant-dot { 0%,60%,100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
@media (max-width: 560px) {
  .rx-assistant { right: max(6px, env(safe-area-inset-right)); bottom: max(6px, env(safe-area-inset-bottom)); }
  .rx-assistant__panel {
    position: fixed;
    top: calc(var(--rx-viewport-top, 0px) + max(6px, env(safe-area-inset-top)));
    left: calc(var(--rx-viewport-left, 0px) + 6px);
    right: auto;
    bottom: auto;
    width: calc(var(--rx-viewport-width, 100vw) - 12px);
    height: calc(var(--rx-viewport-height, 100dvh) - max(12px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
    max-height: none;
    border-radius: 16px;
    transform-origin: center bottom;
  }
  .rx-assistant.is-open .rx-assistant__launcher { display: none; }
  .rx-assistant__launcher { width: 86px; height: 86px; }
  .rx-assistant__launcher-image { width: 86px; height: 86px; }
  .rx-assistant__conversation { padding: 14px 14px 10px; }
  .rx-assistant__header { min-height: 64px; padding-block: 7px; }
  .rx-assistant__composer { padding: 9px 10px 6px; }
  .rx-assistant__notice { padding: 2px 12px max(8px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .rx-assistant *, .rx-assistant *::before, .rx-assistant *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
