html {
  height: 100%;
}

:root {
  --bg-1: #0f172a;
  --bg-2: #172554;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #475569;
  --brand: #0ea5e9;
  --brand-dark: #0284c7;
  --line: #dbe4ee;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text-main);
  background: #eef3f8;
  height: 100%;
  min-height: 100vh;
}

body.embed-body {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: transparent;
}

button,
input {
  font: inherit;
}

.hidden {
  display: none;
}

.chat-page {
  min-width: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 14% 12%, rgba(14, 165, 233, 0.14), transparent 30%),
    linear-gradient(135deg, #eef3f8, #dde8f2);
}

.embed-page.chat-page {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  place-items: stretch;
  background: transparent;
}

.embedded-chat {
  width: min(520px, 100%);
  min-width: 0;
  min-height: 0;
}

.embed-page .embedded-chat {
  width: 100%;
  height: 100%;
  max-height: 100%;
}

.chat-shell {
  position: relative;
  width: 100%;
  height: min(92vh, 760px);
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 20px 70px rgba(15, 23, 42, 0.18);
}

.embed-page .chat-shell {
  height: 100%;
  max-height: none;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: none;
}

.chat-header {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
}

.operator-box {
  display: flex;
  gap: 10px;
  align-items: center;
}

.operator-box img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.operator-box.is-connecting img,
.operator-box.is-connecting strong {
  display: none;
}

.operator-box strong {
  display: block;
  color: var(--text-main);
}

.operator-box p {
  margin: 2px 0 0;
  color: #16a34a;
  font-size: 0.86rem;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
}

.chat-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.font-btn {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: var(--text-muted);
  min-width: 36px;
  min-height: 34px;
  padding: 5px 8px;
  font-weight: 700;
  cursor: pointer;
}

.chat-messages {
  position: relative;
  min-height: 0;
  max-height: 100%;
  background: #f8fafc;
  padding: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-messages > * {
  flex: 0 0 auto;
}

.bubble {
  max-width: 84%;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text-main);
  line-height: 1.45;
  font-size: var(--chat-font-size, 16px);
}

.bubble.operator {
  background: #e2e8f0;
  border-top-left-radius: 4px;
}

.bubble.user {
  background: #bae6fd;
  align-self: flex-end;
  border-top-right-radius: 4px;
}

.bubble.system {
  align-self: center;
  max-width: 92%;
  background: #eef2f7;
  color: #64748b;
  font-size: calc(var(--chat-font-size, 16px) * 0.84);
  text-align: center;
  border-radius: 999px;
  padding: 7px 12px;
}

.typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  animation: blink 0.9s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.12s;
}

.typing span:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes blink {
  0%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.chat-footer {
  min-height: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-bubble {
  padding: 8px;
  background: transparent;
  box-shadow: none;
}

.choice-stack {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 8px;
}

.choice-btn {
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #fff;
  color: var(--text-main);
  min-height: 44px;
  padding: 7px 12px 7px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  font-size: var(--chat-font-size, 16px);
}

.choice-btn.has-image {
  width: 104px;
  min-height: 92px;
  padding: 8px;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.brand-choice-bubble {
  width: min(100%, 680px);
  max-width: 100%;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.bubble.user.brand-choice-bubble {
  background: transparent !important;
  max-width: 100%;
}

.brand-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.choice-btn.brand-choice-btn {
  width: 100%;
  min-height: 126px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: #ffffff;
  border-color: transparent;
  border-width: 0;
  color: var(--text-main);
  text-align: center;
  min-width: 0;
}

.brand-choice-logo-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  height: 58px;
}

.brand-choice-logo {
  width: 96px;
  height: 58px;
  max-width: 100%;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.choice-image.brand-choice-logo {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.brand-choice-placeholder {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: #e2e8f0;
  color: #64748b;
  font-weight: 800;
}

.brand-choice-label {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  font-size: 1em;
  font-weight: 500;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-choice-bubble {
  width: min(100%, 760px);
  max-width: 100%;
}

.bubble.user.model-choice-bubble {
  background: transparent;
  max-width: 100%;
  padding: 0;
}

.model-choice-stack {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.choice-btn.model-choice-btn {
  width: 100%;
  min-height: 330px;
  display: grid;
  align-content: start;
  justify-items: stretch;
  padding: 12px;
  gap: 10px;
  border-radius: 16px;
  text-align: left;
  border-width: 0;
  background: #ffffff;
}

.model-choice-image {
  width: 100%;
  height: 190px;
  border-radius: 12px;
  object-fit: contain;
  flex: none;
  background: transparent;
  border: 0;
}

.model-choice-content {
  display: grid;
  gap: 5px;
  min-width: 0;
  align-content: center;
}

.model-choice-title {
  color: var(--text-main);
  font-size: 1.12em;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}

.model-choice-credit-row,
.model-choice-credit-label,
.selected-model-label {
  color: var(--text-muted);
  font-size: 1em;
  font-weight: 400;
}

.model-choice-credit-row,
.selected-model-prices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.model-choice-price {
  color: #16a34a;
  font-size: 1.08em;
  font-weight: 800;
}

.model-choice-old-price {
  color: #94a3b8;
  font-size: 0.94em;
  text-decoration: line-through;
}

.model-choice-payment,
.selected-model-payment {
  color: #16a34a;
  font-size: 1.14em;
  font-weight: 800;
}

.selected-model-bubble {
  display: grid;
  gap: 10px;
  align-items: stretch;
  width: min(100%, 420px);
  padding: 14px;
  background: #bae6fd;
}

.selected-model-image {
  width: 100%;
  height: 168px;
  flex: none;
  border-radius: 14px;
  object-fit: contain;
  background: transparent;
  border: 0;
}

.selected-model-content {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.selected-model-title {
  color: var(--text-main);
  font-size: 1em;
  line-height: 1.2;
}

.offer-banner-bubble {
  width: min(100%, 780px);
  max-width: 100%;
  align-self: stretch;
  padding: 0;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
}

.offer-banner {
  --offer-base: #e87532;
  --offer-light: #f39457;
  --offer-dark: #b95b2d;
  --offer-accent: #f4c2a6;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  min-height: 420px;
  border-radius: 14px;
  padding: 30px 34px 26px;
  background:
    linear-gradient(18deg, transparent 0 55%, rgba(255, 255, 255, 0.12) 55% 100%),
    linear-gradient(135deg, var(--offer-dark) 0%, var(--offer-base) 48%, var(--offer-light) 100%);
  color: #ffffff;
}

.offer-banner::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -88px;
  bottom: -92px;
  width: min(62%, 460px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.34) 64%, rgba(255, 255, 255, 0) 66%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.52), var(--offer-accent));
  opacity: 0.92;
}

.offer-banner::after {
  content: "";
  position: absolute;
  inset: auto -12% -32% 28%;
  z-index: -1;
  height: 58%;
  transform: rotate(8deg);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px 0 0 0;
}

.offer-banner-head,
.offer-banner-body {
  position: relative;
  z-index: 1;
}

.offer-banner-head {
  display: grid;
  gap: 16px;
  justify-items: start;
  margin-bottom: 8px;
}

.offer-banner-title {
  font-size: clamp(19px, 2.5vw, 30px);
  font-weight: 800;
  line-height: 1.15;
}

.offer-banner-bank-logo {
  max-width: 285px;
  max-height: 58px;
  object-fit: contain;
}

.offer-banner-body {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(280px, 1.05fr);
  gap: 24px;
  align-items: end;
  min-height: 286px;
}

.offer-banner-car-box {
  display: grid;
  align-content: end;
  align-self: stretch;
  min-height: 282px;
}

.offer-banner-car {
  width: min(116%, 420px);
  max-height: 240px;
  object-fit: contain;
  align-self: end;
  transform: translateX(-18px);
  filter: drop-shadow(0 14px 18px rgba(15, 23, 42, 0.18));
}

.offer-banner-conditions {
  display: grid;
  gap: 2px;
  max-width: 430px;
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.25;
}

.offer-banner-content {
  display: grid;
  justify-items: end;
  gap: 14px;
  text-align: right;
}

.offer-banner-main-offer {
  display: grid;
  justify-items: end;
  gap: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.offer-banner-offer-label {
  font-size: clamp(28px, 4.2vw, 55px);
  line-height: 0.95;
}

.offer-banner-offer-rate {
  font-size: clamp(39px, 5.6vw, 78px);
  line-height: 0.88;
}

.offer-banner-bonus {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  width: min(100%, 340px);
  padding: 14px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--offer-dark);
  text-align: left;
}

.offer-banner-percent {
  color: var(--offer-base);
  font-size: 78px;
  font-weight: 900;
  line-height: 0.9;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.16);
}

.offer-banner-bonus strong {
  font-size: 17px;
  line-height: 1.08;
}

.choice-image {
  width: 84px;
  height: 60px;
  border-radius: 8px;
  object-fit: contain;
  flex: 0 0 auto;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.choice-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.choice-btn:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.choice-type-form {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 2px;
}

.choice-type-form input {
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 9px 10px;
  font-size: var(--chat-font-size, 16px);
}

.choice-type-form button {
  border: none;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  padding: 9px 12px;
  cursor: pointer;
  font-size: var(--chat-font-size, 16px);
}

.choice-type-error {
  grid-column: 1 / -1;
  margin: 0;
  color: #dc2626;
  font-size: 0.82rem;
  text-align: right;
}

.text-form {
  display: flex;
  gap: 8px;
  width: 100%;
}

.text-form.hidden {
  display: none;
}

.text-form input {
  min-width: 0;
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px;
  font-size: var(--chat-font-size, 16px);
}

.text-form button {
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  padding: 10px 12px;
  cursor: pointer;
  font-size: var(--chat-font-size, 16px);
}

.chat-shell.font-large {
  --chat-font-size: 19px;
}

@media (max-width: 767px) {
  .chat-page {
    padding: 0;
  }

  .embedded-chat,
  .chat-shell {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }

  .embed-page.chat-page,
  .embed-page .embedded-chat,
  .embed-page .chat-shell {
    width: 100%;
    height: 100%;
  }

  .embed-page .chat-shell {
    border-radius: var(--radius);
  }

  .brand-choice-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .choice-btn.brand-choice-btn {
    min-height: 78px;
    gap: 6px;
    padding: 8px 4px;
    border-radius: 10px;
  }

  .brand-choice-logo-wrap {
    height: 36px;
  }

  .brand-choice-logo {
    width: 58px;
    height: 36px;
  }

  .brand-choice-placeholder {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 0.9em;
  }

  .brand-choice-label {
    font-size: 0.72em;
  }

  .choice-btn.model-choice-btn,
  .selected-model-bubble {
    align-items: stretch;
  }

  .choice-btn.model-choice-btn {
    min-height: 290px;
    padding: 10px;
    border-radius: 14px;
  }

  .model-choice-image {
    width: 100%;
    height: 125px;
    flex-basis: auto;
  }

  .model-choice-title {
    font-size: 1em;
  }

  .model-choice-credit-row,
  .model-choice-credit-label,
  .model-choice-payment {
    font-size: 0.9em;
  }

  .model-choice-price {
    font-size: 1em;
  }

  .model-choice-old-price {
    font-size: 0.82em;
  }

  .selected-model-image {
    width: 100%;
    height: 150px;
    flex-basis: auto;
  }

  .offer-banner-bubble {
    width: 100%;
    max-width: 100%;
  }

  .offer-banner {
    min-height: 520px;
    padding: 24px 22px 22px;
    border-radius: 14px;
  }

  .offer-banner::before {
    left: -118px;
    bottom: 18px;
    width: 330px;
    height: auto;
  }

  .offer-banner-head {
    gap: 12px;
    margin-bottom: 18px;
  }

  .offer-banner-title {
    font-size: 22px;
  }

  .offer-banner-bank-logo {
    max-width: 230px;
    max-height: 48px;
  }

  .offer-banner-body {
    grid-template-columns: 1fr;
    gap: 18px;
    min-height: 0;
  }

  .offer-banner-car-box {
    min-height: 220px;
    order: 2;
  }

  .offer-banner-car {
    width: min(118%, 360px);
    max-height: 210px;
    transform: translateX(-44px);
  }

  .offer-banner-conditions {
    max-width: 100%;
    margin-top: 8px;
    font-size: 12px;
  }

  .offer-banner-content {
    justify-items: start;
    order: 1;
    text-align: left;
  }

  .offer-banner-main-offer {
    justify-items: start;
  }

  .offer-banner-offer-label {
    font-size: clamp(24px, 6.3vw, 34px);
  }

  .offer-banner-offer-rate {
    font-size: clamp(41px, 11.2vw, 57px);
  }

  .offer-banner-bonus {
    width: min(100%, 310px);
    gap: 12px;
    padding: 12px 14px;
  }

  .offer-banner-percent {
    font-size: 60px;
  }

  .offer-banner-bonus strong {
    font-size: 15px;
  }
}
