:root {
  --comm-bg: #ffffff;
  --comm-overlay-bg: rgba(0, 0, 0, 0.4);
  --comm-text-main: #111827;
  --comm-text-muted: #6b7280;
  --comm-border: #e5e7eb;
  --comm-hover: #f9fafb;
  --comm-accent: #249AF3;
  --comm-radius: 16px;
  --comm-transition: 0.3s ease;

  --comm-status-online: #10b981;
  --comm-status-busy: #f59e0b;
  --comm-status-offline: #374151;
}

/* Оверлей */
.comm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 40px 16px;
  box-sizing: border-box;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.comm-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.comm-modal {
  background: var(--comm-bg);
  color: var(--comm-text-main);
  width: 100%;
  max-width: 500px;
  border-radius: var(--comm-radius);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  margin: auto;
  transform: translateY(20px);
  transition: transform var(--comm-transition);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.comm-overlay.is-active .comm-modal {
  transform: translateY(0);
}

/* Шапка модалки */
.comm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--comm-border);
  position: relative;
}

.comm-back-btn, .comm-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--comm-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  transition: color 0.2s;
  z-index: 2;
}

.comm-back-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.comm-back-btn:not(.disabled):hover, .comm-close-btn:hover {
  color: var(--comm-text-main);
}

.comm-close-btn {
  font-size: 18px;
}

.comm-step {
  font-size: 13px;
  font-weight: 500;
  color: var(--comm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.comm-stages-container {
  position: relative;
  overflow: hidden;
}

.comm-content {
  padding: 24px;
}

.comm-hidden {
  display: none !important;
}

.comm-titles {
  text-align: center;
  margin-bottom: 24px;
}

.comm-titles h2 {
  margin: 0 0 8px 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--comm-text-main);
}

.comm-titles p {
  margin: 0;
  font-size: 15px;
  color: var(--comm-text-muted);
  line-height: 1.4;
}

/* Сетка этапов */
.comm-options-grid,
.comm-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comm-option-card {
  background: #fff;
  border: 1px solid var(--comm-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  width: 100%;
  color: var(--comm-text-main);
}

.comm-offer-interest-btn,
.comm-offer-delivery-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px;
  background: var(--comm-bg);
  border: 1px solid var(--comm-border);
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  color: var(--comm-text-main);
  cursor: pointer;
  transition: all var(--comm-transition);
  text-align: left;
}

.comm-offer-interest-btn:hover,
.comm-offer-delivery-btn:hover {
  background: var(--comm-hover);
  border-color: var(--comm-accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.comm-option-card:hover {
  border-color: var(--comm-accent);
  background: var(--comm-hover);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.comm-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

.comm-text h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--comm-text-main);
}

.comm-text p {
  margin: 0;
  font-size: 13px;
  color: var(--comm-text-muted);
  line-height: 1.4;
}

.comm-method-btn {
  background: #fff;
  border: 1px solid var(--comm-border);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  font-size: 16px;
  font-weight: 500;
  color: var(--comm-text-main);
  transition: all 0.2s;
  width: 100%;
}

.comm-method-btn:hover {
  border-color: var(--comm-accent);
  background: var(--comm-hover);
}

/* Карточка статуса */
.comm-status-card {
  background: var(--comm-hover);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  text-align: center;
  color: var(--comm-text-main);
}

.comm-status-title {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--comm-text-main);
}

.comm-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.comm-status-dot.online { background: var(--comm-status-online); box-shadow: 0 0 0 2px rgba(16,185,129,0.2); }
.comm-status-dot.busy { background: var(--comm-status-busy); }
.comm-status-dot.offline { background: var(--comm-status-offline); }

.comm-status-desc {
  font-size: 13px;
  color: var(--comm-text-muted);
  margin: 0;
  line-height: 1.4;
}

/* Профиль менеджера */
.comm-manager-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--comm-border);
  margin-bottom: 24px;
}

.comm-manager-avatar {
  width: 56px;
  height: 56px;
  background: var(--comm-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  overflow: hidden;
}

.comm-manager-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comm-manager-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--comm-text-main);
  margin-bottom: 4px;
}

.comm-manager-role {
  font-size: 14px;
  color: var(--comm-text-muted);
}

/* Контакты менеджера */
.comm-contact-result {
  text-align: center;
  margin-bottom: 24px;
}

.comm-contact-label {
  font-size: 13px;
  color: var(--comm-text-muted);
  margin-bottom: 8px;
}

.comm-contact-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--comm-text-main);
}

.comm-contact-subvalue {
  font-size: 15px;
  color: var(--comm-text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.comm-action-btn {
  display: block;
  width: 100%;
  background: var(--comm-accent);
  color: #fff;
  text-align: center;
  padding: 14px;
  border-radius: 8px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s;
}

.comm-action-btn:hover {
  background: #1d4ed8;
}

/* Формы */
.comm-form-group {
  margin-bottom: 16px;
  text-align: left;
}

.comm-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--comm-text-main);
}

.comm-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  border: 1px solid var(--comm-border);
  border-radius: 8px;
  font-size: 15px;
  color: var(--comm-text-main);
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  outline: none;
}

.comm-input:focus {
  border-color: var(--comm-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.comm-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Переключатель */
.comm-toggle-group {
  display: flex;
  background: var(--comm-hover);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 16px;
}

.comm-toggle-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--comm-text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.comm-toggle-btn.active {
  background: #ffffff;
  color: var(--comm-text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Детали */
.comm-details-wrapper {
  margin-top: 20px;
}

.comm-details-toggle-btn {
  background: none;
  border: none;
  color: var(--comm-accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  margin-bottom: 16px;
}

.comm-details-toggle-btn span {
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
}

.comm-details-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--comm-hover);
  padding: 16px;
  border-radius: 12px;
}

.comm-details-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--comm-text-main);
}

/* Успех */
.comm-success-block {
  text-align: center;
  padding: 20px 0;
}

.comm-success-icon {
  width: 64px;
  height: 64px;
  background: var(--comm-status-online);
  color: #fff;
  font-size: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
}

.comm-success-block h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--comm-text-main);
}

button.cc-fab.cc-pulse {
    position: fixed;
    z-index: -1 !important;
}

/* Принудительная светлая тема для виджета ChatCops */
.chatcops-widget, 
[id*="chatcops"] {
    color-scheme: light !important;
}

/* Если виджет создает iframe или контейнер с темным фоном */
.chatcops-container, 
.chatcops-window {
    background-color: #ffffff !important;
    color: #1f2937 !important;
}

.chatcops-message-bubble {
    background-color: #f3f4f6 !important;
    color: #1f2937 !important;
}

@keyframes ccGlowPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(36, 154, 243, 0.6);
    }
    70% {
        box-shadow: 0 0 0 14px rgba(36, 154, 243, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(36, 154, 243, 0);
    }
}

button.cc-fab, [class*="fab"] {
    animation: ccGlowPulse 2s infinite ease-in-out !important;
}

@media (max-width: 768px) {
  .comm-overlay {
    padding: 0;
    align-items: flex-end; 
  }

  .comm-modal {
    max-width: 100%;
    margin: 0;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .comm-overlay.is-active .comm-modal {
    transform: translateY(0);
  }

  .comm-header {
    padding: 12px 16px;
  }

  .comm-content {
    padding: 16px;
  }

  .comm-titles h2 {
    font-size: 20px;
  }

  .comm-titles p {
    font-size: 14px;
  }

  .comm-option-card {
    padding: 12px;
    gap: 12px;
  }

  .comm-icon {
    font-size: 22px;
  }

  .comm-text h3 {
    font-size: 15px;
  }

  .comm-text p {
    font-size: 12px;
  }

  .comm-method-btn,
  .comm-offer-interest-btn,
  .comm-offer-delivery-btn {
    font-size: 15px;
    padding: 12px 16px;
  }

  .comm-manager-profile {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .comm-action-btn {
    padding: 12px;
    font-size: 15px;
  }

  .comm-toggle-btn {
    font-size: 12px;
    padding: 6px 10px;
  }

  .comm-details-content {
    padding: 12px;
  }

  .comm-success-block {
    padding: 16px 0;
  }

  .comm-success-icon {
    width: 52px;
    height: 52px;
    font-size: 28px;
  }

  .comm-success-block h2 {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .comm-modal {
    border-radius: 16px 16px 0 0;
  }

  .comm-header {
    padding: 10px 12px;
  }

  .comm-step {
    font-size: 11px;
  }

  .comm-content {
    padding: 12px;
  }

  .comm-option-card {
    gap: 8px;
  }

  .comm-manager-avatar {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .comm-manager-name {
    font-size: 16px;
  }

  .comm-contact-value {
    font-size: 18px;
  }
}