.cd-chat-launcher,
.cd-chat-panel,
.cd-chat-panel * { box-sizing: border-box; }

.cd-chat-launcher {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: #1F4D8F;
  color: #fff;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(31, 77, 143, 0.35);
}
.cd-chat-launcher:hover { background: #1A3F78; }
.cd-chat-launcher:focus-visible { outline: 2px solid #06B6D4; outline-offset: 3px; }
.cd-chat-launcher[hidden] { display: none; }
.cd-chat-launcher svg { width: 18px; height: 18px; display: block; }

.cd-chat-panel {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 81;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #1A2D4A;
  border: 1px solid rgba(31, 77, 143, 0.16);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(26, 45, 74, 0.22);
  font-family: Inter, system-ui, sans-serif;
  overflow: hidden;
}
.cd-chat-panel[hidden] { display: none; }

.cd-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px 16px;
  background: #1F4D8F;
  color: #fff;
}
.cd-chat-head strong { display: block; font-size: 0.95rem; font-weight: 700; }
.cd-chat-head span { display: block; margin-top: 2px; font-size: 0.75rem; opacity: 0.85; }
.cd-chat-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}

.cd-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f4f7fb;
}
.cd-chat-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.cd-chat-msg--bot { align-self: flex-start; background: #fff; border: 1px solid #e2e8f0; }
.cd-chat-msg--bot a { color: #1F4D8F; font-weight: 600; }
.cd-chat-msg--user { align-self: flex-end; background: #1F4D8F; color: #fff; }

.cd-chat-offer, .cd-chat-form, .cd-chat-thanks {
  margin: 0 14px 8px;
  font-size: 0.82rem;
}
.cd-chat-offer {
  background: none;
  border: 0;
  padding: 0;
  color: #1F4D8F;
  font-weight: 650;
  cursor: pointer;
  text-align: left;
}
.cd-chat-form {
  display: grid;
  gap: 8px;
  padding-bottom: 4px;
}
.cd-chat-form[hidden], .cd-chat-thanks[hidden], .cd-chat-offer[hidden] { display: none; }
.cd-chat-form p, .cd-chat-thanks { margin: 0; color: #5a6b7d; line-height: 1.4; }
.cd-chat-form input {
  width: 100%;
  border: 1px solid #d5deea;
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  font-size: 0.88rem;
}
.cd-chat-form button, .cd-chat-compose button {
  border: 0;
  border-radius: 10px;
  background: #1F4D8F;
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.cd-chat-form button { padding: 9px 12px; }
.cd-chat-form button:disabled, .cd-chat-compose button:disabled { opacity: 0.6; cursor: default; }
.cd-chat-error { margin: 0; color: #9f1239; }

.cd-chat-compose {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
.cd-chat-compose textarea {
  flex: 1;
  resize: none;
  border: 1px solid #d5deea;
  border-radius: 12px;
  padding: 9px 10px;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.35;
  max-height: 96px;
}
.cd-chat-compose button { padding: 0 14px; }
.cd-chat-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
