:root {
  --cb-z-page-fixed: 400;
  --cb-z-messenger: 500;
  --cb-z-modal-overlay: 9000;
  --cb-z-modal: 9001;
  --cb-z-modal-dropdown: 9002;
  --cb-z-modal-toast: 9010;
}

.cb-complaint-modal[hidden] { display: none !important; }

body.cb-complaint-open {
  overflow: hidden;
}

body.cb-complaint-open .cb-messenger-widget,
body.cb-complaint-open .real-estate-show-mobile-bar,
body.cb-complaint-open .cb-top {
  z-index: var(--cb-z-page-fixed) !important;
}

.cb-complaint-modal {
  position: fixed;
  inset: 0;
  z-index: var(--cb-z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  isolation: isolate;
}

.cb-complaint-modal__backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--cb-z-modal-overlay);
  background: rgba(15, 23, 42, .48);
}

.cb-complaint-modal__dialog {
  position: relative;
  z-index: calc(var(--cb-z-modal) + 1);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: calc(100vh - 24px);
  overflow: hidden;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
}

.cb-complaint-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
}

.cb-complaint-modal__close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.cb-complaint-modal__body,
.cb-complaint-modal__success {
  box-sizing: border-box;
  overflow: auto;
  padding: 20px 20px 22px;
}

.cb-complaint-modal__title {
  margin: 0 0 16px;
  padding-right: 36px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
  color: #0f172a;
}

.cb-complaint-preview {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
}

.cb-complaint-preview__photo {
  display: flex;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border-radius: 12px;
  background: #e2e8f0;
  align-items: center;
  justify-content: center;
}

.cb-complaint-preview__photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cb-complaint-preview__info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.cb-complaint-preview__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: #0f172a;
}

.cb-complaint-preview__price {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.cb-complaint-preview__city {
  font-size: 13px;
  color: #64748b;
}

.cb-complaint-form__lead {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
}

.cb-complaint-reasons {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.cb-complaint-reason {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.cb-complaint-reason:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.cb-complaint-reason:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
}

.cb-complaint-reason input {
  flex: 0 0 auto;
  margin-top: 2px;
}

.cb-complaint-reason__label {
  flex: 1 1 auto;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: #0f172a;
}

.cb-complaint-field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.cb-complaint-field__label {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.cb-complaint-field__optional {
  font-weight: 500;
  color: #94a3b8;
}

.cb-complaint-field__required {
  font-weight: 600;
  color: #dc2626;
}

.cb-complaint-field__input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: #0f172a;
  resize: vertical;
  min-height: 84px;
}

.cb-complaint-field__input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.cb-complaint-field__counter {
  justify-self: end;
  font-size: 12px;
  color: #94a3b8;
}

.cb-complaint-error {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: #b91c1c;
}

.cb-complaint-error[hidden] {
  display: none;
}

.cb-complaint-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cb-complaint-form__actions .cb-btn {
  min-height: 42px;
}

.cb-complaint-modal__success {
  text-align: center;
}

.cb-complaint-success__icon {
  display: inline-flex;
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: #dcfce7;
  color: #15803d;
  font-size: 24px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
}

.cb-complaint-modal__success p {
  margin: 0 0 16px;
  color: #64748b;
  line-height: 1.45;
}

.cb-complaint-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: var(--cb-z-modal-toast);
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 12px;
  background: #15803d;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 16px 34px rgba(15, 23, 42, .18);
}

[data-cb-complaint-open].is-sent {
  opacity: .72;
  cursor: default;
}

@media (max-width: 520px) {
  .cb-complaint-form__actions {
    flex-direction: column;
  }

  .cb-complaint-form__actions .cb-btn {
    width: 100%;
  }
}
