/* AssessKeep support chat — scoped so it cannot shift page layout */
.ak-chat,
.ak-chat * {
  box-sizing: border-box;
  font-style: normal !important;
}

.ak-chat {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1b2a23;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.ak-chat-launcher {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 4000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  height: 44px;
  padding: 0 16px 0 14px;
  border: 0;
  border-radius: 999px;
  background: #1e4a37;
  color: #fff;
  font: 600 15px/1 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(27, 42, 35, 0.18);
}

.ak-chat-launcher:hover,
.ak-chat-launcher:focus-visible {
  background: #153728;
}

.ak-chat-launcher:focus-visible {
  outline: 2px solid #b5532f;
  outline-offset: 3px;
}

.ak-chat-launcher[aria-expanded="true"] {
  display: none;
}

.ak-chat-launcher svg {
  display: block;
  flex: 0 0 auto;
}

.ak-chat-panel {
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 4001;
  display: flex;
  flex-direction: column;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100dvh - 48px);
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(27, 42, 35, 0.16);
  overflow: hidden;
}

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

.ak-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid #d1d5db;
  background: #fff;
}

.ak-chat-title {
  margin: 0;
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  color: #1e4a37;
}

.ak-chat-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #3a4740;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.ak-chat-close:hover,
.ak-chat-close:focus-visible {
  background: #e4ece5;
  color: #1b2a23;
}

.ak-chat-close:focus-visible {
  outline: 2px solid #1e4a37;
  outline-offset: 1px;
}

.ak-chat-log {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.ak-chat-msg {
  max-width: 100%;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.ak-chat-msg p {
  margin: 0 0 0.6em;
}

.ak-chat-msg p:last-child {
  margin-bottom: 0;
}

.ak-chat-msg a {
  color: #1e4a37;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ak-chat-msg-user {
  align-self: flex-end;
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px 12px 4px 12px;
  background: #e4ece5;
  color: #1b2a23;
  white-space: pre-wrap;
}

.ak-chat-msg-bot {
  align-self: stretch;
  color: #1b2a23;
}

.ak-chat-msg-error {
  color: #3a4740;
}

.ak-chat-pending {
  color: #3a4740;
}

.ak-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  padding: 10px 12px;
  border-top: 1px solid #d1d5db;
  background: #fff;
}

.ak-chat-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-height: 96px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #1b2a23;
  font: 15px/1.4 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  resize: none;
}

.ak-chat-input:focus {
  outline: 2px solid #1e4a37;
  outline-offset: 1px;
  border-color: #1e4a37;
}

.ak-chat-send {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: #1e4a37;
  color: #fff;
  font: 600 14px/1 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  cursor: pointer;
}

.ak-chat-send:hover,
.ak-chat-send:focus-visible {
  background: #153728;
}

.ak-chat-send:focus-visible {
  outline: 2px solid #b5532f;
  outline-offset: 2px;
}

.ak-chat-send:disabled {
  opacity: 0.55;
  cursor: default;
}

.ak-chat-note {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 16px 12px;
  background: #fff;
  color: #3a4740;
  font-size: 11px;
  line-height: 1.4;
}

.ak-chat-note a {
  color: #1e4a37;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 640px) {
  .ak-chat-launcher {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .ak-chat-panel {
    inset: auto 0 0 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100vw;
    height: min(92dvh, 640px);
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}
