.obcity-chat {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 500002 !important;
  width: min(390px, calc(100vw - 32px));
  height: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #123b5e;
  pointer-events: none;
  --obcity-chat-blue: #1d5587;
  --obcity-chat-blue-dark: #123b5e;
  --obcity-chat-cyan: #4fc3f7;
  --obcity-chat-yellow: #edbf2c;
}

.obcity-chat,
.obcity-chat * {
  box-sizing: border-box;
}

.obcity-chat-button {
  position: absolute;
  right: 0;
  bottom: -82px;
  z-index: 500001 !important;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--obcity-chat-blue);
  color: #fff;
  box-shadow: 0 14px 38px rgba(29, 85, 135, 0.32);
  cursor: pointer;
  font: 700 15px/1.1 inherit;
  pointer-events: auto;
}

.obcity-chat-button:hover,
.obcity-chat-button:focus-visible {
  background: var(--obcity-chat-blue-dark);
  outline: 3px solid rgba(79, 195, 247, 0.42);
  outline-offset: 3px;
}

.obcity-chat-button__icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
}

.obcity-chat-button__icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.obcity-chat-panel {
  position: absolute;
  right: 0;
  bottom: 92px;
  z-index: 99999 !important;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: min(560px, calc(100vh - 204px));
  overflow: hidden;
  border: 1px solid rgba(29, 85, 135, 0.14);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(18, 59, 94, 0.24);
  pointer-events: auto;
}

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

.obcity-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 14px 16px;
  background: var(--obcity-chat-blue-dark);
  color: #fff;
  flex: 0 0 auto;
}

.obcity-chat-header strong,
.obcity-chat-header span {
  display: block;
}

.obcity-chat-header strong {
  font-size: 16px;
  line-height: 1.25;
}

.obcity-chat-header span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1.3;
}

.obcity-chat-close {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

.obcity-chat-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.obcity-chat-close:hover,
.obcity-chat-close:focus-visible {
  background: rgba(79, 195, 247, 0.16);
  outline: 2px solid rgba(79, 195, 247, 0.34);
  outline-offset: 2px;
}

.obcity-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: #f3f8fc;
}

.obcity-chat-message {
  display: flex;
  margin: 0 0 10px;
}

.obcity-chat-message--visitor {
  justify-content: flex-end;
}

.obcity-chat-message__bubble {
  max-width: min(82%, 290px);
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  color: #123b5e;
  box-shadow: 0 1px 2px rgba(29, 85, 135, 0.08);
  font-size: 14px;
  line-height: 1.42;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.obcity-chat-message__link {
  color: #1d5587;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.obcity-chat-message__link:hover,
.obcity-chat-message__link:focus-visible {
  color: #123b5e;
}

.obcity-chat-message--visitor .obcity-chat-message__bubble {
  background: var(--obcity-chat-blue);
  color: #fff;
}

.obcity-chat-message--visitor .obcity-chat-message__link {
  color: #fff;
}

.obcity-chat-form {
  padding: 12px;
  border-top: 1px solid rgba(29, 85, 135, 0.12);
  background: #fff;
  flex: 0 0 auto;
}

.obcity-chat-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.obcity-chat-input,
.obcity-chat-textarea {
  width: 100%;
  border: 1px solid rgba(29, 85, 135, 0.22);
  border-radius: 6px;
  background: #fff;
  color: #123b5e;
  font: 400 14px/1.35 inherit;
}

.obcity-chat-input {
  height: 38px;
  padding: 0 10px;
}

.obcity-chat-textarea {
  min-height: 78px;
  max-height: 150px;
  padding: 10px;
  resize: vertical;
}

.obcity-chat-input:focus,
.obcity-chat-textarea:focus {
  border-color: var(--obcity-chat-blue);
  outline: 3px solid rgba(79, 195, 247, 0.2);
}

.obcity-chat-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.obcity-chat-status {
  min-height: 18px;
  color: #1d5587;
  font-size: 12px;
  line-height: 1.3;
}

.obcity-chat-send {
  min-width: 112px;
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--obcity-chat-yellow);
  color: #123b5e;
  cursor: pointer;
  font: 800 14px/1 inherit;
}

.obcity-chat-send:hover,
.obcity-chat-send:focus-visible {
  background: #d9aa18;
  outline: 3px solid rgba(79, 195, 247, 0.22);
  outline-offset: 2px;
}

.obcity-chat-send:disabled {
  cursor: progress;
  opacity: 0.7;
}

@media (max-width: 520px) {
  .obcity-chat {
    right: 12px;
    left: 12px;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    width: auto;
  }

  .obcity-chat-button {
    right: 0;
    bottom: calc(-82px - env(safe-area-inset-bottom, 0px));
  }

  .obcity-chat-panel {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: 12px;
    bottom: calc(154px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    width: auto;
    height: auto;
    max-height: none;
  }

  .obcity-chat-fields {
    grid-template-columns: 1fr;
  }
}
