.ai-fab-wrap {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
/* ── NurseBot launcher (animated mascot button) ─────────────────────────── */
.nb-launcher {
  position: relative;
  color: var(--ac-green, #3AAFA9); /* scrubs color via currentColor */
  background: transparent;
  border: none;
  width: 120px;
  height: 120px;
  cursor: pointer;
  padding: 0;
  border-radius: 28px;
}

.nb-svg {
  display: block;
  width: 120px;
  height: 120px;
  overflow: visible;
}

.nb-float {
  animation: nb-float 3.2s ease-in-out infinite;
}

.nb-arm-l {
  transform-origin: 62px 130px;
  animation: nb-swing 3.2s ease-in-out infinite;
}

.nb-arm-r {
  transform-origin: 138px 130px;
  animation: nb-wave 4s ease-in-out infinite;
}

.nb-head {
  transform-origin: 100px 110px;
  animation: nb-tilt 6s ease-in-out infinite;
}

.nb-heart {
  transform-box: fill-box;
  transform-origin: center;
  animation: nb-beat 1.6s ease-in-out infinite;
}

.nb-ecg-s {
  stroke-dasharray: 46;
  animation: nb-ecg-s 1.6s linear infinite;
}

.nb-eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: nb-blink 4s ease-in-out infinite;
  transition: opacity .15s;
}
.nb-eyes {
  transition: transform .12s ease-out;
}

.nb-eye-happy { opacity: 0; transition: opacity .15s; }
.nb-smile { transition: opacity .15s; }
.nb-smile-big { opacity: 0; transition: opacity .15s; }

@keyframes nb-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes nb-tilt {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-4deg); }
  75% { transform: rotate(4deg); }
}
@keyframes nb-blink {
  0%, 44%, 50%, 100% { transform: scaleY(1); }
  47% { transform: scaleY(.1); }
}
@keyframes nb-wave {
  0%, 50%, 100% { transform: rotate(0deg); }
  58% { transform: rotate(-20deg); }
  66% { transform: rotate(8deg); }
  74% { transform: rotate(-20deg); }
  82% { transform: rotate(6deg); }
}
@keyframes nb-swing {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(8deg); }
}
@keyframes nb-beat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.3); }
  24% { transform: scale(1); }
  36% { transform: scale(1.2); }
  48% { transform: scale(1); }
}
@keyframes nb-ecg-s {
  0% { stroke-dashoffset: 46; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -46; }
}

/* Floating heart — brief periodic "cute" pop above the launcher, triggered
   from ai-fab-drag.js; purely decorative, no layout impact since it's
   absolutely positioned and invisible until animated. Offset raised to
   clear the taller 120px mascot (was tuned for the old 58px circular icon).
   Named nb-idle-pop (not nb-pop) to stay distinct from the 3 hover-triggered
   hearts below, which share the nb-pop class for a different effect. */
.nb-idle-pop {
  position: absolute;
  bottom: 126px;
  right: 18px;
  fill: #3AAFA9;
  opacity: 0;
  pointer-events: none;
}
.nb-idle-pop.nb-idle-pop-animate {
  animation: nbPopHeart 2.2s ease-out;
}
@keyframes nbPopHeart {
  0%   { opacity: 0; transform: translateY(0) scale(0.6); }
  15%  { opacity: 1; transform: translateY(-6px) scale(1); }
  70%  { opacity: 1; transform: translateY(-26px) scale(1); }
  100% { opacity: 0; transform: translateY(-36px) scale(0.8); }
}

/* ── Speech bubble — cycling idle prompts beside the launcher ───────────── */
.nb-tip {
  position: absolute;
  right: 130px;
  bottom: 40px;
  width: 180px;
  height: 46px;
  padding: 0;
  border-radius: 18px 18px 4px 18px;
  background: #12172B;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(18, 23, 43, .18);
  animation: nb-tip-in .5s cubic-bezier(.2, .9, .3, 1.3) .8s both;
}
.nb-tip::after {
  content: '';
  position: absolute;
  right: -8px;
  bottom: 12px;
  border: 8px solid transparent;
  border-left-color: #12172B;
  border-right: 0;
}
.nb-tip-idle {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 16px;
  opacity: 0;
  animation: nb-cycle 9s ease-in-out infinite;
}
.nb-tip-idle:nth-child(1) { animation-delay: 1s; }
.nb-tip-idle:nth-child(2) { animation-delay: 4s; }
.nb-tip-idle:nth-child(3) { animation-delay: 7s; }
.nb-tip-hover {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 0 16px;
}
.nb-root.is-hover .nb-tip-idle {
  animation: none;
  opacity: 0;
}
.nb-root.is-hover .nb-tip-hover {
  display: grid;
  opacity: 1;
}
.nb-root.is-open .nb-tip {
  display: none;
}

@keyframes nb-tip-in {
  from { opacity: 0; transform: translateX(12px) scale(.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes nb-cycle {
  0%        { opacity: 0; transform: translateY(6px); }
  4%, 28%   { opacity: 1; transform: translateY(0); }
  33%, 100% { opacity: 0; transform: translateY(-6px); }
}

/* ── Hover effects on the robot ──────────────────────────────────────────── */
.nb-svg {
  transition: transform .25s cubic-bezier(.3, 1.5, .5, 1);
}
.nb-root.is-hover .nb-svg {
  transform: translateY(-8px) scale(1.08);
}

/* Eyes turn into happy arcs */
.nb-root.is-hover .nb-eye { opacity: 0; }
.nb-root.is-hover .nb-eye-happy { opacity: 1; }

/* Smile gets bigger */
.nb-root.is-hover .nb-smile-big { opacity: 1; }
.nb-root.is-hover .nb-smile { opacity: 0; }

/* Right arm waves faster */
.nb-root.is-hover .nb-arm-r {
  animation: nb-wave-fast .6s ease-in-out infinite;
}

/* Heart beats faster */
.nb-root.is-hover .nb-heart {
  animation-duration: .7s;
}

/* Floating hearts pop up (hover only — distinct from .nb-idle-pop above) */
.nb-pop {
  position: absolute;
  width: 14px;
  height: 14px;
  color: #D6336C;
  opacity: 0;
  pointer-events: none;
}
.nb-pop svg {
  display: block;
  width: 14px;
  height: 14px;
  fill: currentColor;
}
.nb-root.is-hover .nb-pop {
  animation: nb-pop 1.2s ease-out infinite;
}
.nb-pop-1 { left: 14px; top: 26px; }
.nb-pop-2 { left: 96px; top: 14px; animation-delay: .35s !important; }
.nb-pop-3 { left: 52px; top: -4px; animation-delay: .7s !important; }

@keyframes nb-wave-fast {
  0%, 100% { transform: rotate(-22deg); }
  50%       { transform: rotate(10deg); }
}
@keyframes nb-pop {
  0%   { opacity: 0; transform: translateY(8px) scale(.5); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-26px) scale(1.1); }
}
.ai-chat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 10000;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 24px;
}
.ai-chat-overlay.open { display: flex; }
.ai-chat-modal {
  width: 390px;
  height: 540px;
  background: #fff;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0,0,0,0.14), 0 8px 32px rgba(58,175,169,0.15);
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
}
.ai-chat-header {
  background: linear-gradient(135deg, #3AAFA9, #2B9E98);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.ai-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-chat-icon {
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
}
.ai-chat-title {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}
.nb-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 0 0 rgba(74,222,128,0.6);
  animation: nbStatusPulse 2s infinite;
}
@keyframes nbStatusPulse {
  0%   { box-shadow: 0 0 0 0 rgba(74,222,128,0.6); }
  70%  { box-shadow: 0 0 0 5px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}
.ai-chat-sub {
  color: rgba(255,255,255,0.78);
  font-size: 11px;
  margin-top: 2px;
}
.ai-chat-close {
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.ai-chat-close:hover { background: rgba(255,255,255,0.28); }
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #EAF6F5;
  scrollbar-width: thin;
  scrollbar-color: rgba(58,175,169,0.4) transparent;
}
.ai-chat-messages::-webkit-scrollbar { width: 6px; }
.ai-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ai-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(58,175,169,0.4);
  border-radius: 3px;
}
.nb-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nb-chip {
  background: #fff;
  border: 1.5px solid #3AAFA9;
  color: #3AAFA9;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nb-chip:hover {
  background: #3AAFA9;
  color: #fff;
}
.ai-msg-row { display: flex; }
.ai-msg-row.bot { justify-content: flex-start; }
.ai-msg-row.user { justify-content: flex-end; }
.ai-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
}
.ai-msg-row.bot .ai-bubble {
  background: #fff;
  color: #1C3030;
  border-bottom-left-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.ai-msg-row.user .ai-bubble {
  background: #3AAFA9;
  color: #fff;
  border-bottom-right-radius: 3px;
}
.ai-severity-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 6px;
}
.ai-sev-high { background: #FDE8E2; color: #D95F3B; }
.ai-sev-medium { background: #FFF3D6; color: #F0A500; }
.ai-sev-low { background: #E8F5E9; color: #4CAF50; }
.ai-guidance-step {
  display: block;
  margin-bottom: 4px;
}
.ai-chat-disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 16px;
  background: #fff;
  border-top: 1px solid #EAF6F5;
  text-align: center;
  flex-shrink: 0;
}
.ai-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #dcecea;
  background: #fff;
  flex-shrink: 0;
}
.ai-chat-input {
  flex: 1;
  border: 1px solid #dcecea;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.15s;
}
.ai-chat-input:focus { border-color: #3AAFA9; }
.ai-chat-send {
  background: #3AAFA9;
  border: none;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: background 0.15s;
  flex-shrink: 0;
}
.ai-chat-send:hover { background: #2B9E98; }
.ai-loading-dots {
  display: flex;
  gap: 5px;
  padding: 4px 0;
}
.ai-loading-dots span {
  width: 7px;
  height: 7px;
  background: #3AAFA9;
  border-radius: 50%;
  animation: aiDotPulse 1.2s infinite;
}
.ai-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiDotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}
