.ak-chatbot,
.ak-chatbot * {
  box-sizing: border-box;
}

.ak-chatbot {
  position: fixed;
  z-index: 10020;
  bottom: max(20px, env(safe-area-inset-bottom));
  right: max(20px, env(safe-area-inset-right));
  color: #26344a;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

.ak-chatbot [hidden] {
  display: none !important;
}

.ak-chat-launcher {
  position: relative;
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  padding: 2px;
  overflow: visible;
  border: 2px solid #b9e7ff;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 32%, #fff 0, #f0faff 68%, #d8efff 100%);
  box-shadow: 0 8px 26px #061b3740, 0 0 0 5px #46b7ff20;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.ak-chat-launcher:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 30px #061b374d, 0 0 0 7px #46b7ff24;
}

.ak-chat-launcher .ak-chat-image {
  display: block;
  width: 100%;
  height: 100%;
}

.ak-chat-launcher img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ak-chat-launcher-dot {
  position: absolute;
  right: 1px;
  bottom: 3px;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #35c98b;
  box-shadow: 0 0 0 3px #35c98b25;
}

.ak-chat-panel {
  position: absolute;
  bottom: 88px;
  right: 0;
  display: flex;
  width: min(370px, calc(100vw - 40px));
  height: min(540px, calc(100dvh - 130px));
  min-height: 370px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 70px #07152c38;
  animation: ak-chat-enter 180ms ease-out both;
}

.ak-chat-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  background: linear-gradient(120deg, #17275b, #126bc1);
  color: #fff;
}

.ak-chat-header > .ak-chat-image {
  display: block;
  width: 46px;
  height: 46px;
  flex: none;
  overflow: hidden;
  border: 1px solid #ffffff80;
  border-radius: 50%;
  background: #fff;
}

.ak-chat-header > .ak-chat-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ak-chat-header-copy {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.ak-chat-header-copy strong {
  font-size: 14px;
  font-weight: 750;
}

.ak-chat-header-copy small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #d6e9ff;
  font-size: 11px;
}

.ak-chat-header-copy small i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4be09b;
  box-shadow: 0 0 0 3px #4be09b29;
}

.ak-chat-close {
  display: grid;
  width: 34px;
  height: 34px;
  flex: none;
  place-items: center;
  border: 1px solid #ffffff55;
  border-radius: 10px;
  background: #ffffff12;
  color: #fff;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}

.ak-chat-messages {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 16px 14px 12px;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.ak-chat-message {
  width: fit-content;
  max-width: 88%;
  padding: 10px 12px;
  border: 1px solid #e3eaf2;
  border-radius: 14px 14px 14px 5px;
  background: #f3f7fb;
  color: #334258;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.ak-chat-message p {
  margin: 0;
  white-space: pre-line;
}

.ak-chat-message.is-user {
  align-self: flex-end;
  border-color: #176bc1;
  border-radius: 14px 14px 5px 14px;
  background: #176bc1;
  color: #fff;
}

.ak-chat-message-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.ak-chat-message-links a {
  display: inline-flex;
  min-height: 29px;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid #a9d3f4;
  border-radius: 999px;
  background: #fff;
  color: #0869bf;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.ak-chat-message-links a:hover {
  border-color: #0879d5;
  background: #eaf6ff;
}

.ak-chat-suggestions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 13px 11px;
  scrollbar-width: thin;
}

.ak-chat-suggestions button {
  min-height: 30px;
  flex: none;
  padding: 5px 9px;
  border: 1px solid #dbe6f0;
  border-radius: 999px;
  background: #fff;
  color: #45556b;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

.ak-chat-suggestions button:hover {
  border-color: #78bdf0;
  background: #f0f8ff;
  color: #116bb8;
}

.ak-chat-form {
  display: flex;
  gap: 8px;
  padding: 11px 12px;
  border-top: 1px solid #e6edf4;
  background: #fff;
}

.ak-chat-form input {
  width: 0;
  min-width: 0;
  height: 42px;
  flex: 1;
  padding: 0 12px;
  border: 1px solid #dce5ef;
  border-radius: 12px;
  outline: none;
  background: #f8fafc;
  color: #26344a;
  font-size: 12px;
}

.ak-chat-form input:focus {
  border-color: #4aa9f1;
  box-shadow: 0 0 0 3px #4aa9f126;
}

.ak-chat-form > button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: #1376ce;
  color: #fff;
  cursor: pointer;
}

.ak-chat-form > button:hover {
  background: #0e5fa9;
}

.ak-chat-form > button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.ak-chat-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.dashboard-page .ak-chat-panel {
  border-color: #39434f;
  background: #1d2229;
}

.dashboard-page .ak-chat-messages {
  background: #1d2229;
}

.dashboard-page .ak-chat-message {
  border-color: #3a444f;
  background: #282f38;
  color: #e0e7f0;
}

.dashboard-page .ak-chat-message.is-user {
  border-color: #2479c5;
  background: #1e4b75;
  color: #f4f9ff;
}

.dashboard-page .ak-chat-message-links a {
  border-color: #386b96;
  background: #1d3850;
  color: #83c4ff;
}

.dashboard-page .ak-chat-message-links a:hover {
  background: #244c6d;
}

.dashboard-page .ak-chat-suggestions {
  background: #1d2229;
}

.dashboard-page .ak-chat-suggestions button {
  border-color: #3a444f;
  background: #252c34;
  color: #c6d0dc;
}

.dashboard-page .ak-chat-suggestions button:hover {
  border-color: #3983bd;
  background: #1d3850;
  color: #83c4ff;
}

.dashboard-page .ak-chat-form {
  border-color: #38424d;
  background: #1d2229;
}

.dashboard-page .ak-chat-form input {
  border-color: #3a444f;
  background: #252c34;
  color: #eef3f9;
}

.dashboard-page .ak-chat-form input::placeholder {
  color: #929eac;
}

@keyframes ak-chat-enter {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 520px) {
  .ak-chatbot {
    bottom: max(14px, env(safe-area-inset-bottom));
    right: max(14px, env(safe-area-inset-right));
  }

  .ak-chat-launcher {
    width: 66px;
    height: 66px;
  }

  .ak-chat-panel {
    bottom: 78px;
    width: min(370px, calc(100vw - 28px));
    height: min(520px, calc(100dvh - 108px));
    min-height: 340px;
    border-radius: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ak-chat-launcher,
  .ak-chat-panel {
    animation: none;
    transition: none;
  }
}
