#missed-ai-chat-root {
  --missed-chat-ink: #10221d;
  --missed-chat-lime: #d4f477;
  --missed-chat-line: #e3e9e3;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  font-family: inherit;
}

#missed-ai-chat-root * { box-sizing: border-box; }

.missed-chat-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  color: var(--missed-chat-ink);
  background: var(--missed-chat-lime);
  box-shadow: 0 8px 28px rgb(16 34 29 / 18%);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.missed-chat-launcher:hover { filter: brightness(.97); }
.missed-chat-launcher:focus-visible,
.missed-chat-close:focus-visible,
.missed-chat-form button:focus-visible,
.missed-chat-form input:focus-visible {
  outline: 3px solid #497d63;
  outline-offset: 3px;
}

.missed-chat-panel {
  display: flex;
  flex-direction: column;
  position: absolute;
  right: 0;
  bottom: 62px;
  width: min(380px, calc(100vw - 28px));
  height: min(560px, calc(100dvh - 110px));
  min-height: 330px;
  overflow: hidden;
  border: 1px solid var(--missed-chat-line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 60px rgb(16 34 29 / 20%);
  color: var(--missed-chat-ink);
}

.missed-chat-panel[hidden] { display: none; }

.missed-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px;
  background: var(--missed-chat-ink);
  color: #fff;
}

.missed-chat-header h2 { margin: 0; font-size: 17px; line-height: 1.3; }
.missed-chat-header p { margin: 4px 0 0; color: #d6e1da; font-size: 12px; }

.missed-chat-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 12%);
  color: white;
  font: inherit;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.missed-chat-messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 17px 14px;
  overscroll-behavior: contain;
}

.missed-chat-message {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.missed-chat-message.assistant {
  align-self: flex-start;
  background: #f0f4ef;
  border-bottom-left-radius: 4px;
}

.missed-chat-message.user {
  align-self: flex-end;
  background: #e3f4a9;
  border-bottom-right-radius: 4px;
}

.missed-chat-message.pending { color: #596a61; font-style: italic; }
.missed-chat-message.error { color: #8e2b25; background: #fff0ee; }

.missed-chat-notice {
  margin: 0;
  padding: 0 15px 8px;
  color: #68756e;
  font-size: 11px;
}

.missed-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--missed-chat-line);
}

.missed-chat-form input {
  width: 100%;
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid #dce4dc;
  border-radius: 12px;
  color: var(--missed-chat-ink);
  background: white;
  font: inherit;
  font-size: 14px;
}

.missed-chat-form button {
  flex: 0 0 auto;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--missed-chat-ink);
  color: white;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.missed-chat-form button:disabled { opacity: .55; cursor: wait; }

@media (max-width: 480px) {
  #missed-ai-chat-root { right: 12px; bottom: 12px; }
  .missed-chat-panel {
    position: fixed;
    right: 12px;
    bottom: 72px;
    width: calc(100vw - 24px);
    height: min(560px, calc(100dvh - 95px));
  }
}
