[hidden] { display: none !important; }

.btn, .floating-chat, .chat-panel button, .chat-panel textarea { font-family: inherit; }
.btn, .floating-chat { cursor: pointer; }
.floating-chat { border: 0; font-size: 1rem; }

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

.chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(12, 26, 36, .48);
}

.chat-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid #dce9e1;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(12, 35, 28, .28);
}

.chat-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 16px;
  color: #fff;
  background: linear-gradient(135deg, #103b2b, #0f9f57);
}

.chat-panel__header > div { flex: 1; min-width: 0; }
.chat-panel__agent-avatar {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  flex: none;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: #16432c;
  background: #d9f3e4;
  font-weight: 800;
}
.chat-panel__agent-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.chat-panel__header strong,
.chat-panel__header > div span { display: block; }
.chat-panel__header strong { font-size: 1.05rem; }
.chat-panel__header > div span { font-size: .78rem; opacity: .88; }
.chat-panel__close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255,255,255,.18);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.chat-panel__status {
  padding: 8px 16px;
  border-bottom: 1px solid #edf1ed;
  color: #567163;
  background: #f7fbf8;
  font-size: .78rem;
  text-align: center;
}

.chat-panel__privacy {
  margin: 0;
  padding: 7px 16px;
  color: #6c7d73;
  background: #f7fbf8;
  font-size: .68rem;
  line-height: 1.35;
  text-align: center;
}

.chat-panel__messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 18px 16px;
  background: #fbfdfb;
}

.chat-panel__empty {
  margin: auto;
  max-width: 260px;
  color: #667985;
  font-size: .9rem;
  text-align: center;
}

.chat-message { max-width: 85%; }
.chat-message--visitor { align-self: flex-end; }
.chat-message--operator { align-self: flex-start; }
.chat-message__bubble {
  padding: 10px 13px;
  border-radius: 16px 16px 16px 4px;
  color: #1b3440;
  background: #eaf2ed;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.chat-message--visitor .chat-message__bubble {
  border-radius: 16px 16px 4px 16px;
  color: #fff;
  background: #129d56;
}
.chat-message--operator .chat-message__bubble a {
  color: #0b6842;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}
.chat-message--operator .chat-message__bubble a:focus-visible { outline: 2px solid #0b6842; outline-offset: 2px; }
.chat-message__bubble img { display:block; max-width:min(250px,65vw); max-height:300px; border-radius:8px; object-fit:contain; }
.chat-message__meta {
  display: block;
  margin-top: 4px;
  color: #80908a;
  font-size: .68rem;
}
.chat-message--visitor .chat-message__meta { text-align: right; }

.chat-panel__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e8eeea;
  background: #fff;
}
.chat-panel__image-preview { display:flex; align-items:center; gap:8px; padding:8px 12px; border-top:1px solid #e8eeea; background:#fff; font-size:.75rem; }
.chat-panel__image-preview img { width:42px; height:42px; border-radius:7px; object-fit:cover; }
.chat-panel__image-preview span { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-panel__image-preview button { padding:5px 7px; border:1px solid #cddbd2; border-radius:8px; background:#fff; color:#25523a; font-size:.73rem; white-space:nowrap; }
.chat-panel__image-preview #chat-image-send { border-color:#0f9f57; background:#0f9f57; color:#fff; }
.chat-panel__form textarea {
  flex: 1;
  min-width: 0;
  max-height: 120px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid #dce6e0;
  border-radius: 13px;
  outline: none;
  font-size: .92rem;
  line-height: 1.35;
}
.chat-panel__form textarea:focus { border-color: #0f9f57; box-shadow: 0 0 0 3px #dff5e9; }
.chat-panel__form button {
  min-height: 43px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: #0f9f57;
  font-weight: 800;
  cursor: pointer;
}
.chat-panel__form button:disabled { opacity: .55; cursor: wait; }
.chat-panel__form #chat-image-picker { flex:none; width:43px; padding:0; border:1px solid #dce6e0; color:#25523a; background:#fff; font-size:1.2rem; }

@media (max-width: 600px) {
  body.chat-open { overflow: hidden; }
  .chat-panel {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }
}

@media (min-width: 920px) {
  .hero__media { min-width: 0; min-height: 0; height: 560px; aspect-ratio: auto; }
}
