.houroffer-chat-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  font-family: Arial, Helvetica, sans-serif;
  color: #0f172a;
}

.houroffer-chat-root * {
  box-sizing: border-box;
}

.houroffer-chat-button {
  display: inline-flex;
  min-width: 166px;
  height: 50px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 8px;
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.24);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.houroffer-chat-button:hover {
  background: #1e293b;
}

.houroffer-chat-button-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.24);
}

.houroffer-chat-root[data-online="true"] .houroffer-chat-button-dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22);
}

.houroffer-chat-panel {
  display: none;
  width: 380px;
  height: 580px;
  max-height: calc(100vh - 56px);
  overflow: hidden;
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 54px rgba(15, 23, 42, 0.24);
}

.houroffer-chat-root[data-open="true"] .houroffer-chat-panel {
  display: flex;
  flex-direction: column;
}

.houroffer-chat-root[data-open="true"] .houroffer-chat-button {
  display: none;
}

.houroffer-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 14px 16px;
  background: #0f172a;
  color: #ffffff;
}

.houroffer-chat-title {
  min-width: 0;
}

.houroffer-chat-title strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}

.houroffer-chat-title span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  color: #cbd5e1;
  font-size: 12px;
}

.houroffer-chat-status i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #94a3b8;
}

.houroffer-chat-root[data-online="true"] .houroffer-chat-status i {
  background: #22c55e;
}

.houroffer-chat-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  cursor: pointer;
  font-size: 20px;
  line-height: 30px;
}

.houroffer-chat-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  background: #f8fafc;
}

.houroffer-chat-intro {
  margin: 0 0 12px;
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
}

.houroffer-chat-offline {
  margin: 0 0 12px;
  border: 1px solid #f6d365;
  border-radius: 8px;
  background: #fff7e6;
  padding: 11px 12px;
  color: #7c3d12;
  font-size: 13px;
  line-height: 1.5;
}

.houroffer-chat-form {
  display: grid;
  gap: 10px;
}

.houroffer-chat-field {
  display: grid;
  gap: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.houroffer-chat-input,
.houroffer-chat-textarea {
  width: 100%;
  border: 1px solid #ccd6e0;
  border-radius: 7px;
  background: #ffffff;
  color: #0f172a;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.houroffer-chat-input {
  height: 40px;
  padding: 0 11px;
}

.houroffer-chat-textarea {
  min-height: 82px;
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.45;
}

.houroffer-chat-input:focus,
.houroffer-chat-textarea:focus {
  border-color: #334155;
  box-shadow: 0 0 0 3px rgba(51, 65, 85, 0.12);
}

.houroffer-chat-field-error {
  color: #991b1b;
}

.houroffer-chat-input-error,
.houroffer-chat-input-error:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.houroffer-chat-optional-toggle {
  height: 36px;
  border: 1px solid #ccd6e0;
  border-radius: 7px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.houroffer-chat-optional-toggle:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.houroffer-chat-optional-fields {
  display: grid;
  gap: 10px;
}

.houroffer-chat-submit {
  height: 42px;
  border: 0;
  border-radius: 7px;
  background: #0f172a;
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.houroffer-chat-submit:hover {
  background: #1e293b;
}

.houroffer-chat-submit:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.houroffer-chat-error {
  margin: 0;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fef2f2;
  padding: 9px 10px;
  color: #991b1b;
  font-size: 12px;
  line-height: 1.4;
}

.houroffer-chat-messages {
  display: grid;
  gap: 10px;
}

.houroffer-chat-message {
  max-width: 84%;
  border-radius: 8px;
  padding: 10px 11px;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.houroffer-chat-message[data-sender="visitor"] {
  justify-self: end;
  background: #0f172a;
  color: #ffffff;
}

.houroffer-chat-message[data-sender="agent"],
.houroffer-chat-message[data-sender="system"] {
  justify-self: start;
  border: 1px solid #dbe3ec;
  background: #ffffff;
  color: #1e293b;
}

.houroffer-chat-message small {
  display: block;
  margin-top: 4px;
  opacity: 0.65;
  font-size: 11px;
}

.houroffer-chat-composer {
  display: flex;
  gap: 8px;
  border-top: 1px solid #e2e8f0;
  padding: 12px;
  background: #ffffff;
}

.houroffer-chat-composer input {
  min-width: 0;
  flex: 1;
  height: 42px;
  border: 1px solid #ccd6e0;
  border-radius: 7px;
  padding: 0 11px;
  font-size: 14px;
  outline: none;
}

.houroffer-chat-composer button {
  width: 72px;
  height: 42px;
  border: 0;
  border-radius: 7px;
  background: #0f172a;
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.houroffer-chat-composer button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.houroffer-chat-hidden {
  display: none;
}

@media (max-width: 640px) {
  .houroffer-chat-root {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
  }

  .houroffer-chat-button {
    float: right;
    min-width: 146px;
    height: 46px;
  }

  .houroffer-chat-panel {
    width: 100%;
    height: min(620px, calc(100svh - 20px));
    max-height: calc(100svh - 20px);
  }

  .houroffer-chat-body {
    padding: 14px;
  }

  .houroffer-chat-message {
    max-width: 90%;
  }
}
