.o247mc,
.o247mc * {
  box-sizing: border-box;
}

.o247mc {
  --o247mc-accent: #111111;
  --o247mc-paper: #ffffff;
  --o247mc-soft: #f3f3f1;
  --o247mc-ink: #181818;
  --o247mc-muted: #6d6d69;
  --o247mc-line: rgba(24, 24, 24, 0.13);
  position: fixed;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 2147483000;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--o247mc-ink);
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
}

.o247mc--left {
  right: auto;
  left: 20px;
}

.o247mc button,
.o247mc textarea,
.o247mc a {
  font: inherit;
}

.o247mc__toggle {
  display: inline-flex;
  align-items: center;
  min-height: 50px;
  padding: 0 19px;
  border: 0;
  border-radius: 999px;
  background: var(--o247mc-accent);
  color: #fff;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  font-weight: 650;
  letter-spacing: -0.01em;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.o247mc__toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.27);
}

.o247mc__toggle:focus-visible,
.o247mc__close:focus-visible,
.o247mc__send:focus-visible,
.o247mc__cta a:focus-visible,
.o247mc__input:focus-visible {
  outline: 3px solid rgba(62, 132, 255, 0.55);
  outline-offset: 2px;
}

.o247mc.is-open .o247mc__toggle {
  display: none;
}

.o247mc__mobile-icon {
  display: none;
}

.o247mc__panel {
  display: grid;
  grid-template-rows: auto minmax(150px, 1fr) auto;
  width: min(390px, calc(100vw - 28px));
  height: min(610px, calc(100vh - 40px));
  max-height: 610px;
  overflow: hidden;
  border: 1px solid var(--o247mc-line);
  border-radius: 22px;
  background: var(--o247mc-paper);
  box-shadow: 0 28px 85px rgba(0, 0, 0, 0.24);
  animation: o247mc-in 180ms ease-out;
}

.o247mc__panel[hidden],
.o247mc__composer[hidden],
.o247mc__cta[hidden] {
  display: none !important;
}

@keyframes o247mc-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.o247mc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 17px;
  border-bottom: 1px solid var(--o247mc-line);
  background: rgba(255, 255, 255, 0.96);
}

.o247mc__title {
  display: block;
  margin: 0;
  color: var(--o247mc-ink);
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.o247mc__status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--o247mc-muted);
  font-size: 11px;
}

.o247mc__status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2fb66d;
  box-shadow: 0 0 0 3px rgba(47, 182, 109, 0.13);
}

.o247mc__close {
  appearance: none;
  width: 34px;
  height: 34px;
  padding: 0 0 2px;
  border: 0;
  border-radius: 50%;
  background: var(--o247mc-soft);
  color: var(--o247mc-ink);
  cursor: pointer;
  font-size: 23px;
  line-height: 1;
}

.o247mc__messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 16px;
  background: #fafaf9;
  scrollbar-width: thin;
}

.o247mc__message {
  width: fit-content;
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 17px;
  font-size: 14px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.o247mc__message p,
.o247mc__message ul,
.o247mc__message ol {
  margin: 0 0 8px;
}

.o247mc__message p:last-child,
.o247mc__message ul:last-child,
.o247mc__message ol:last-child {
  margin-bottom: 0;
}

.o247mc__message ul,
.o247mc__message ol {
  padding-left: 20px;
}

.o247mc__message a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.o247mc__message .o247mc__intro-link {
  display: block;
  width: fit-content;
  margin-top: 9px;
  color: var(--o247mc-ink);
  font-weight: 700;
}

.o247mc__message--bot {
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  background: #ececea;
  color: var(--o247mc-ink);
}

.o247mc__message--user {
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  background: var(--o247mc-accent);
  color: #fff;
}

.o247mc__message.is-loading {
  color: var(--o247mc-muted);
}

.o247mc__message.is-loading::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid rgba(0, 0, 0, 0.16);
  border-top-color: var(--o247mc-accent);
  border-radius: 50%;
  vertical-align: -2px;
  animation: o247mc-spin 800ms linear infinite;
}

@keyframes o247mc-spin { to { transform: rotate(360deg); } }

.o247mc__composer {
  padding: 11px 12px 12px;
  border-top: 1px solid var(--o247mc-line);
  background: var(--o247mc-paper);
}

.o247mc__remaining {
  margin: 0 4px 7px;
  color: var(--o247mc-muted);
  font-size: 11px;
}

.o247mc__remaining strong {
  color: var(--o247mc-ink);
}

.o247mc__input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: end;
  gap: 8px;
}

.o247mc__input {
  width: 100%;
  min-height: 42px;
  max-height: 112px;
  margin: 0;
  padding: 10px 13px;
  resize: none;
  overflow-y: hidden;
  border: 1px solid var(--o247mc-line);
  border-radius: 16px;
  background: var(--o247mc-soft);
  color: var(--o247mc-ink);
  box-shadow: none;
  font-size: 14px;
  line-height: 1.45;
}

.o247mc__input::placeholder {
  color: #858580;
}

.o247mc__send {
  appearance: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--o247mc-accent);
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.o247mc__send:disabled,
.o247mc__input:disabled {
  cursor: wait;
  opacity: 0.62;
}

.o247mc__legal {
  display: block;
  margin: 7px 4px 0;
  color: var(--o247mc-muted);
  font-size: 10px;
  line-height: 1.35;
}

.o247mc__legal a {
  color: inherit;
  text-decoration: underline;
}

.o247mc__cta {
  padding: 17px;
  border-top: 1px solid var(--o247mc-line);
  background: var(--o247mc-paper);
}

.o247mc__cta strong {
  display: block;
  font-size: 15px;
}

.o247mc__cta p {
  margin: 5px 0 12px;
  color: var(--o247mc-muted);
  font-size: 12px;
  line-height: 1.45;
}

.o247mc__cta a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 13px;
  border-radius: 13px;
  background: var(--o247mc-accent);
  color: #fff !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 650;
}

@media (max-width: 600px) {
  .o247mc,
  .o247mc--left {
    right: 12px;
    left: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .o247mc__toggle {
    float: right;
    justify-content: center;
    width: 52px;
    min-width: 52px;
    height: 52px;
    min-height: 52px;
    padding: 0;
    border-radius: 50%;
  }

  .o247mc--left .o247mc__toggle {
    float: left;
  }

  .o247mc__button-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .o247mc__mobile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    position: static !important;
    width: 25px !important;
    height: 25px !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    color: #fff;
  }

  .o247mc__mobile-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .o247mc__panel {
    width: 100%;
    height: min(580px, calc(100dvh - 24px));
    max-height: calc(100dvh - 24px);
    border-radius: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .o247mc__panel,
  .o247mc__toggle,
  .o247mc__message.is-loading::after {
    animation: none;
    transition: none;
  }
}
