/* MHA AUTOMATION AI assistant - pairs with chat-widget.js */
.mha-chat-launcher {
  position: fixed; right: 26px; bottom: 96px; z-index: 92; width: 52px; height: 52px;
  border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #38bdf8, #0369a1);
  box-shadow: 0 12px 30px -8px rgba(14, 165, 233, .6); transition: transform .3s, box-shadow .3s;
}
.mha-chat-launcher:hover { transform: translateY(-3px); }
.mha-chat-launcher:focus-visible { outline: 3px solid #bae6fd; outline-offset: 3px; }
.mha-chat-launcher svg { width: 24px; height: 24px; }
.mha-chat-badge {
  position: absolute; top: -3px; right: -4px; padding: 3px 5px; border-radius: 999px;
  background: #ff6b35; color: #fff; font: 700 9px/1 Inter, system-ui, sans-serif; letter-spacing: .04em;
}
/* index.html's back-to-top arrow stacks above the chat launcher once the chat is live */
body.has-mha-chat .back-to-top { bottom: 164px; }

.mha-chat {
  position: fixed; right: 26px; bottom: 164px; z-index: 1000;
  width: 380px; max-width: calc(100vw - 32px); height: min(560px, calc(100vh - 290px));
  display: flex; flex-direction: column; overflow: hidden; background: #fff; border-radius: 18px;
  box-shadow: 0 30px 80px -20px rgba(6, 16, 31, .55);
  font-family: Inter, system-ui, sans-serif;
  opacity: 0; visibility: hidden; transform: translateY(12px) scale(.98); transform-origin: bottom right;
  transition: opacity .25s, transform .25s, visibility .25s;
}
.mha-chat.is-open { opacity: 1; visibility: visible; transform: none; }

.mha-chat__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #0a1628; color: #fff; }
.mha-chat__avatar { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.mha-chat__avatar img { width: 27px; height: 27px; }
.mha-chat__title { font: 700 15px/1.2 'Space Grotesk', Inter, sans-serif; }
.mha-chat__status { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; color: #94a3b8; }
.mha-chat__status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.mha-chat__close { margin-left: auto; padding: 6px; border: 0; border-radius: 8px; background: transparent; color: #cbd5e1; cursor: pointer; display: grid; }
.mha-chat__close:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.mha-chat__log { flex: 1; overflow-y: auto; padding: 16px; background: #f6f8fb; display: flex; flex-direction: column; gap: 10px; }
.mha-chat__msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.55; color: #0b1622; overflow-wrap: anywhere; }
.mha-chat__msg--bot { align-self: flex-start; background: #fff; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px; }
.mha-chat__msg--user { align-self: flex-end; background: #0a1628; color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.mha-chat__msg.is-error { border-color: #fed7aa; background: #fff7ed; }
.mha-chat__msg p { margin: 0 0 6px; }
.mha-chat__msg p:last-child { margin-bottom: 0; }
.mha-chat__msg ul { margin: 4px 0 6px; padding-left: 18px; list-style: disc outside; }
.mha-chat__msg li { margin: 2px 0; display: list-item; }
.mha-chat__msg li::marker { color: #0ea5e9; }
.mha-chat__msg a { color: #0369a1; text-decoration: underline; }

.mha-chat__typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.mha-chat__typing i { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; animation: mha-chat-dot 1.2s infinite ease-in-out; }
.mha-chat__typing i:nth-child(2) { animation-delay: .15s; }
.mha-chat__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes mha-chat-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.mha-chat__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mha-chat__chip {
  padding: 8px 12px; border: 1px solid #bae6fd; border-radius: 999px; background: #f0f9ff; color: #0369a1;
  font: 600 12.5px/1.2 Inter, system-ui, sans-serif; cursor: pointer; text-align: left;
}
.mha-chat__chip:hover { background: #e0f2fe; }

.mha-chat__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #e2e8f0; background: #fff; }
.mha-chat__input {
  flex: 1; max-height: 110px; padding: 10px 12px; resize: none; outline: none;
  border: 1px solid #cbd5e1; border-radius: 12px; font: 14px/1.4 Inter, system-ui, sans-serif; color: #0b1622;
}
.mha-chat__input:focus { border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(56, 189, 248, .18); }
.mha-chat__send {
  flex: 0 0 auto; align-self: flex-end; width: 42px; height: 42px; border: 0; border-radius: 12px;
  background: #ff6b35; color: #fff; cursor: pointer; display: grid; place-items: center;
}
.mha-chat__send:disabled { background: #cbd5e1; cursor: default; }
.mha-chat__foot { padding: 0 14px 11px; background: #fff; text-align: center; font-size: 11px; line-height: 1.45; color: #64748b; }
.mha-chat__foot a { color: #16a34a; font-weight: 600; }

@media (max-width: 760px) {
  .mha-chat-launcher { right: 20px; bottom: 84px; }
  body.has-mha-chat .back-to-top { bottom: 148px; }
  .mha-chat { inset: 0; width: 100%; max-width: none; height: 100%; height: 100dvh; border-radius: 0; }
  body.mha-chat-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .mha-chat, .mha-chat-launcher { transition: none; }
  .mha-chat__typing i { animation: none; }
}
