:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bv-green: #164f45;
  --bv-green-dark: #0e3932;
  --bv-surface: #ffffff;
  --bv-soft: #eef5f3;
  --bv-text: #18302c;
  --bv-muted: #62736f;
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; background: #f7f8f8; }

button, textarea { font: inherit; }

.chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--bv-green);
  color: white;
  box-shadow: 0 12px 30px rgb(16 51 44 / 25%);
  cursor: pointer;
  font-size: 25px;
}

.chat-widget {
  position: fixed;
  right: 22px;
  bottom: 94px;
  width: min(390px, calc(100vw - 28px));
  height: min(610px, calc(100vh - 120px));
  overflow: hidden;
  border: 1px solid #dce6e3;
  border-radius: 18px;
  background: var(--bv-surface);
  box-shadow: 0 20px 60px rgb(16 51 44 / 20%);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
}

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

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--bv-green);
  color: white;
}

.chat-header div { display: grid; gap: 2px; }
.chat-header span { font-size: 12px; opacity: .8; }

.icon-button {
  border: 0;
  background: transparent;
  color: white;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.chat-messages {
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.message {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  color: var(--bv-text);
  line-height: 1.42;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-assistant { align-self: flex-start; background: var(--bv-soft); border-bottom-left-radius: 4px; }
.message-user { align-self: flex-end; background: var(--bv-green); color: white; border-bottom-right-radius: 4px; }

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  padding: 12px 14px;
  border-top: 1px solid #e3ebe9;
}

.chat-form textarea {
  min-height: 42px;
  max-height: 110px;
  resize: none;
  border: 1px solid #cad8d4;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--bv-text);
}

.chat-form textarea:focus { outline: 2px solid #9ac1b7; border-color: var(--bv-green); }

.chat-form button {
  align-self: end;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 0 15px;
  background: var(--bv-green);
  color: white;
  cursor: pointer;
}

.chat-form button:disabled, .chat-form textarea:disabled { opacity: .58; cursor: wait; }
.chat-status { min-height: 18px; margin: 0; padding: 0 16px 10px; color: var(--bv-muted); font-size: 12px; }
.diagnostic-action { align-self: stretch; margin-top: 5px; }
.diagnostic-button, .diagnostic-form button { width: 100%; border: 0; border-radius: 12px; padding: 11px 14px; background: var(--bv-green); color: white; cursor: pointer; }
.diagnostic-form { display: grid; gap: 10px; padding: 13px; border: 1px solid #dce6e3; border-radius: 14px; background: #f8fbfa; }
.diagnostic-form label { display: grid; gap: 5px; color: var(--bv-text); font-size: 13px; }
.diagnostic-form input { width: 100%; border: 1px solid #cad8d4; border-radius: 9px; padding: 9px 10px; }
.diagnostic-form input:focus { outline: 2px solid #9ac1b7; border-color: var(--bv-green); }
.diagnostic-consent { grid-template-columns: auto 1fr; align-items: start; }
.diagnostic-consent input { width: auto; margin-top: 3px; }
.diagnostic-honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.diagnostic-feedback, .diagnostic-success { margin: 0; color: var(--bv-muted); font-size: 13px; line-height: 1.4; }
.diagnostic-success { color: var(--bv-green-dark); }
.diagnostic-form button:disabled { opacity: .58; cursor: wait; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 520px) {
  .chat-widget { right: 14px; bottom: 84px; height: calc(100vh - 105px); }
  .chat-launcher { right: 14px; bottom: 14px; }
}
