/* ---------- AI CHAT WIDGET ---------- */
.chat-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  width: 62px; height: 62px; border: 0; border-radius: 50%;
  background: var(--yellow, #ffd522); color: #10131b; cursor: pointer;
  display: grid; place-items: center; font-size: 27px;
  box-shadow: 0 12px 32px #0b315355, 0 0 0 6px #ffd52222;
  transition: transform .2s, box-shadow .2s;
}
.chat-fab:hover { transform: translateY(-3px) scale(1.04); }
.chat-fab-close { display: none; font-size: 30px; line-height: 1; }
.chat-fab.open .chat-fab-open { display: none; }
.chat-fab.open .chat-fab-close { display: block; }

.chat-panel {
  position: fixed; right: 24px; bottom: 100px; z-index: 60;
  width: min(390px, calc(100vw - 32px)); height: min(620px, calc(100svh - 130px));
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 26px; box-shadow: 0 24px 70px #06122bb8;
  opacity: 0; transform: translateY(18px) scale(.98); pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.chat-panel.open { opacity: 1; transform: none; pointer-events: auto; }

.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 16px; color: #fff;
  background: linear-gradient(135deg, #197fe0, #083f91);
}
.chat-avatar {
  width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center;
  border-radius: 14px; background: var(--yellow, #ffd522); font-size: 22px;
  box-shadow: 0 4px 12px #0004;
}
.chat-title { flex: 1; min-width: 0; line-height: 1.15; }
.chat-title strong { display: block; font-size: 14px; letter-spacing: .02em; }
.chat-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; opacity: .85; }
.chat-status i { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px #4ade8044; }
.chat-icon-btn {
  width: 34px; height: 34px; flex: 0 0 34px; border: 0; border-radius: 50%;
  background: #ffffff22; color: #fff; font-size: 19px; cursor: pointer;
  display: grid; place-items: center; transition: background .2s;
}
.chat-icon-btn:hover { background: #ffffff3d; }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column;
  gap: 10px; background: #f6f1e6; scroll-behavior: smooth;
}
.chat-msg { max-width: 84%; padding: 10px 13px; border-radius: 16px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.chat-msg.user { align-self: flex-end; background: #1683ed; color: #fff; border-bottom-right-radius: 5px; }
.chat-msg.assistant { align-self: flex-start; background: #fff; color: #10131b; border: 1px solid #e7e0d2; border-bottom-left-radius: 5px; box-shadow: 0 2px 8px #001b3a10; }
.chat-msg.assistant.thinking { color: #8a8f9b; font-style: italic; }
.chat-msg .chat-attention { display: block; margin-top: 7px; padding-top: 7px; border-top: 1px dashed #d8d0c0; font-size: 11.5px; color: #8a6d1f; }

.chat-quick { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 14px 4px; background: #f6f1e6; }
.chat-quick button {
  border: 1px solid #e0d8c6; border-radius: 999px; padding: 7px 12px;
  background: #fff; color: #4a4f59; font-size: 11.5px; font-weight: 700; cursor: pointer;
  transition: border-color .2s, color .2s;
}
.chat-quick button:hover { border-color: #1683ed; color: #1683ed; }

.chat-input { display: flex; gap: 8px; padding: 10px 12px 8px; background: #fff; border-top: 1px solid #eee7d9; }
.chat-input input {
  flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid #e2dccf; border-radius: 999px;
  font: inherit; font-size: 13px; outline: none; background: #fbf8f1;
}
.chat-input input:focus { border-color: #1683ed; background: #fff; }
.chat-input button {
  width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 50%;
  background: #1683ed; color: #fff; font-size: 19px; cursor: pointer;
  display: grid; place-items: center; transition: background .2s, transform .2s;
}
.chat-input button:hover { background: #0f6fd0; transform: scale(1.05); }
.chat-input button:disabled { opacity: .55; cursor: default; transform: none; }

.chat-note { padding: 7px 14px 11px; background: #fff; font-size: 10.5px; color: #9aa0ab; text-align: center; }

@media (max-width: 650px) {
  .chat-fab { right: 16px; bottom: 16px; width: 56px; height: 56px; font-size: 24px; }
  .chat-panel {
    right: 0; left: 0; bottom: 0; width: auto; height: 100svh;
    border-radius: 0; box-shadow: none;
  }
  .chat-messages, .chat-quick { padding-left: 12px; padding-right: 12px; }
}
