.chatbox-toggle,
.chatbox-panel,
.chatbox-panel * { box-sizing: border-box; }

.chatbox-toggle {
  position: fixed; right: 24px; bottom: 24px; z-index: 1100;
  width: 58px; height: 58px; padding: 16px; border: 0; border-radius: 18px;
  color: #fff; background: linear-gradient(145deg, #0891b2, #0f766e);
  box-shadow: 0 14px 32px rgba(15, 118, 110, .32); cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.chatbox-toggle:hover { transform: translateY(-2px); box-shadow: 0 18px 38px rgba(15,118,110,.4); }
.chatbox-toggle svg, .chatbox-send svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.chatbox-panel {
  position: fixed; right: 24px; bottom: 96px; z-index: 1101;
  display: flex; flex-direction: column; width: min(390px, calc(100vw - 32px)); height: min(620px, calc(100vh - 128px));
  overflow: hidden; border: 1px solid rgba(148,163,184,.35); border-radius: 22px;
  color: #0f172a; background: rgba(255,255,255,.98); box-shadow: 0 24px 70px rgba(15,23,42,.25);
  font-family: Inter, system-ui, sans-serif; text-shadow: none;
  animation: chatbox-in .2s ease-out;
}
.chatbox-panel[hidden] { display: none; }
@keyframes chatbox-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.chatbox-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; color: #fff; background: linear-gradient(135deg,#0f766e,#155e75); }
.chatbox-agent { display: flex; align-items: center; gap: 11px; }
.chatbox-avatar, .message-avatar { display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; font-size: 12px; font-weight: 800; }
.chatbox-avatar { width: 38px; height: 38px; color: #0f766e; background: #ecfeff; }
.chatbox-agent strong { display: block; font-size: 15px; line-height: 1.3; }
.chatbox-agent span { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: #ccfbf1; font-size: 11px; }
.chatbox-agent span i { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; }
.chatbox-header-actions { display: flex; gap: 5px; }
.chatbox-header-actions button { width: 32px; height: 32px; border: 0; border-radius: 10px; color: #fff; background: transparent; font-size: 22px; cursor: pointer; }
.chatbox-header-actions button:hover { background: rgba(255,255,255,.15); }

.chatbox-messages { flex: 1; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding: 18px 16px; background: #f8fafc; }
.chat-message { display: flex; align-items: flex-end; gap: 8px; }
.chat-message.user { justify-content: flex-end; }
.message-avatar { width: 29px; height: 29px; color: #0f766e; background: #ccfbf1; }
.message-bubble { max-width: 82%; padding: 11px 13px; border: 1px solid #e2e8f0; border-radius: 15px 15px 15px 4px; color: #1e293b; background: #fff; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 2px 8px rgba(15,23,42,.04); }
.chat-message.user .message-bubble { border: 0; border-radius: 15px 15px 4px 15px; color: #fff; background: #0f766e; }
.chat-message.error .message-bubble { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
.typing { display: inline-flex; gap: 4px; padding: 5px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #64748b; animation: typing 1s infinite alternate; }
.typing i:nth-child(2) { animation-delay: .2s; }.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes typing { to { opacity: .25; transform: translateY(-3px); } }

.chatbox-suggestions { display: flex; gap: 7px; overflow-x: auto; padding: 10px 14px 4px; background: #fff; }
.chatbox-suggestions button { flex: 0 0 auto; padding: 7px 10px; border: 1px solid #bae6fd; border-radius: 999px; color: #155e75; background: #f0f9ff; font-size: 11.5px; cursor: pointer; }
.chatbox-suggestions button:hover { background: #e0f2fe; }
.chatbox-form { display: flex; align-items: flex-end; gap: 9px; padding: 10px 14px 7px; background: #fff; }
.chatbox-form textarea { flex: 1 1 auto; min-width: 0; max-height: 100px; resize: none; padding: 11px 13px; border: 1px solid #cbd5e1; border-radius: 14px; outline: none; color: #0f172a; background: #f8fafc; font: inherit; font-size: 13.5px; line-height: 1.4; }
.chatbox-form textarea:focus { border-color: #0891b2; box-shadow: 0 0 0 3px rgba(8,145,178,.1); }
.chatbox-send { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; padding: 10px; border: 0; border-radius: 50%; color: #fff; background: linear-gradient(135deg,#0f766e,#0891b2); box-shadow: 0 6px 14px rgba(15,118,110,.25); cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, filter .15s ease; }
.chatbox-send:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15,118,110,.32); filter: brightness(1.04); }
.chatbox-send:active { transform: translateY(0) scale(.96); }
.chatbox-send:focus-visible { outline: 3px solid rgba(8,145,178,.25); outline-offset: 2px; }
.chatbox-send:disabled { opacity: .5; cursor: wait; }
.chatbox-disclaimer { margin: 0; padding: 0 14px 11px; color: #94a3b8; background: #fff; font-size: 10.5px; text-align: center; }

@media (max-width: 560px) {
  .chatbox-toggle { right: 16px; bottom: 16px; }
  .chatbox-panel { inset: 12px; width: auto; height: auto; border-radius: 18px; }
}
