:root {
  --cc-bg: rgba(0, 36, 54, 0.58);
  --cc-panel: #ffffff;
  --cc-panel-soft: #f3f8fb;
  --cc-text: #0b3650;
  --cc-muted: #557085;
  --cc-accent: #004f76;
  --cc-accent-strong: #00344e;
  --cc-highlight: #5abeab;
  --cc-border: rgba(0, 79, 118, 0.14);
  --cc-shadow: 0 30px 70px rgba(3, 22, 52, 0.28);
}

body.cc-modal-open {
  overflow: hidden;
}

body.cc-modal-open .chat-widget {
  opacity: 0;
  pointer-events: none;
}

.cc-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--cc-bg);
  z-index: 10020;
}

.cc-overlay.is-visible {
  display: flex;
}

.cc-modal {
  width: min(680px, 100%);
  padding: 30px;
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, var(--cc-panel-soft) 100%);
  color: var(--cc-text);
  box-shadow: var(--cc-shadow);
  border: 1px solid var(--cc-border);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
}

.cc-modal h2 {
  margin: 0 0 12px;
  color: var(--cc-text);
  font-family: 'Montserrat', 'Manrope', system-ui, -apple-system, sans-serif;
  font-size: clamp(1.7rem, 2.4vw, 2.2rem);
  line-height: 1.1;
}

.cc-modal p {
  margin: 0 0 12px;
  color: var(--cc-muted);
  line-height: 1.6;
}

.cc-modal a {
  color: var(--cc-accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cc-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-top: 18px;
  border-radius: 18px;
  border: 1px solid var(--cc-border);
  background: rgba(255, 255, 255, 0.88);
}

.cc-section strong {
  display: block;
  margin-bottom: 6px;
  color: var(--cc-text);
}

.cc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(0, 79, 118, 0.08);
  color: var(--cc-accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.cc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--cc-text);
}

.cc-toggle input {
  appearance: none;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(0, 79, 118, 0.18);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}

.cc-toggle input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(3, 22, 52, 0.18);
  transition: transform 0.2s ease;
}

.cc-toggle input:checked {
  background: linear-gradient(135deg, var(--cc-accent), var(--cc-highlight));
}

.cc-toggle input:checked::after {
  transform: translateX(20px);
}

.cc-toggle input:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.cc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.cc-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--cc-border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--cc-text);
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.cc-button:hover {
  transform: translateY(-1px);
}

.cc-button.primary {
  background: linear-gradient(135deg, var(--cc-accent), var(--cc-highlight));
  border-color: transparent;
  color: #ffffff;
}

.cc-button.primary:hover {
  background: linear-gradient(135deg, var(--cc-accent-strong), var(--cc-highlight));
}

.cc-button.secondary {
  background: transparent;
}

.cc-button.secondary:hover {
  border-color: rgba(0, 79, 118, 0.28);
  color: var(--cc-accent);
}

.cc-icon {
  position: fixed;
  left: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--cc-accent), var(--cc-highlight));
  color: #ffffff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  z-index: 10010;
}

.cc-icon:focus-visible,
.cc-button:focus-visible,
.cc-toggle input:focus-visible {
  outline: 2px solid rgba(0, 79, 118, 0.45);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .cc-overlay {
    align-items: flex-end;
    padding: 14px;
  }

  .cc-modal {
    width: 100%;
    max-height: min(560px, calc(100vh - 28px));
    max-height: min(560px, calc(100dvh - 28px - env(safe-area-inset-bottom)));
    overflow: auto;
    padding: 20px 18px;
    border-radius: 22px;
  }

  .cc-section {
    flex-direction: column;
    align-items: flex-start;
  }

  .cc-actions {
    flex-direction: column;
  }

  .cc-button {
    width: 100%;
  }

  .cc-icon {
    left: 14px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }
}
