:root {
  --ink: #0b1220;
  --ink-2: #152038;
  --fog: #e4ebf7;
  --paper: #f7f4ef;
  --line: #ddd4c8;
  --muted: #6a635a;
  --acid: #ff7a18;
  --acid-ink: #1a0d04;
  --signal: #2bb8a6;
  --danger: #d6453d;
  --shadow: 0 30px 80px rgba(8, 14, 28, 0.5);
  --font: "Onest", sans-serif;
  --display: "Unbounded", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--fog);
  background:
    radial-gradient(1000px 560px at 12% -5%, rgba(255, 122, 24, 0.22), transparent 58%),
    radial-gradient(780px 480px at 92% 8%, rgba(43, 184, 166, 0.2), transparent 52%),
    radial-gradient(600px 400px at 50% 100%, rgba(80, 110, 180, 0.14), transparent 55%),
    linear-gradient(155deg, #08101d 0%, #121c31 48%, #1a1528 100%);
  overflow-x: hidden;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.top, .stage { position: relative; z-index: 1; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem clamp(1rem, 3vw, 2.5rem);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.brand-mark__sign {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  background: var(--acid);
  color: var(--acid-ink);
  font-size: 0.95rem;
  border-radius: 0.35rem;
  animation: pop 0.6s cubic-bezier(.2,.9,.2,1) both;
}
.brand-mark__name { font-size: 1.05rem; }

.staff-link {
  color: var(--fog);
  text-decoration: none;
  opacity: 0.7;
  font-size: 0.92rem;
  border-bottom: 1px solid transparent;
}
.staff-link:hover { opacity: 1; border-bottom-color: var(--signal); }

.stage {
  min-height: calc(100vh - 4.5rem);
  max-height: calc(100vh - 4.5rem);
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(360px, 1.05fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: stretch;
  padding: 0.5rem clamp(1rem, 3vw, 2.5rem) 1.5rem;
  overflow: hidden;
}

.intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem 0 2rem;
  animation: rise 0.7s ease both;
}

.eyebrow {
  margin: 0 0 0.8rem;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--acid);
  font-weight: 600;
}

.brand-hero {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3.2rem, 8vw, 6.4rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
  margin: 0 0 1.2rem;
  color: #fff;
  text-wrap: balance;
}

.lead {
  margin: 0 0 1.6rem;
  max-width: 28rem;
  font-size: 1.12rem;
  line-height: 1.55;
  color: #b8c4d8;
}

.phone-hint {
  margin: 0.9rem 0 0;
  font-size: 0.88rem;
  color: #8a94a8;
  max-width: 22rem;
}

.btn {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  border-radius: 0.55rem;
  padding: 1rem 1.35rem;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary {
  background: var(--acid);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 122, 24, 0.28), 0 14px 34px rgba(255, 122, 24, 0.28);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ===== CHAT DOCK — всегда на виду ===== */
.chat-dock {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  min-height: 0;
  max-height: calc(100vh - 6rem);
  animation: slidein 0.75s cubic-bezier(.2,.8,.2,1) 0.1s both;
}

.chat-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: min(720px, calc(100vh - 6rem));
  max-height: calc(100vh - 6rem);
  min-height: 0;
  background: var(--paper);
  color: var(--ink);
  border-radius: 1.1rem;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.chat-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--acid), #ffb347 45%, var(--signal));
}

.chat-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 1.05rem 1.15rem 0.95rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.chat-title {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.chat-sub {
  margin-top: 0.2rem;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 500;
}

.steps {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.step {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  background: #e8edf6;
  color: var(--muted);
}
.step.is-active {
  background: var(--ink);
  color: #ffb347;
}
.step.is-done {
  background: var(--signal);
  color: #06241f;
}
.step-line {
  width: 1.2rem;
  height: 2px;
  background: var(--line);
}

.icon-btn {
  display: none;
  border: 0;
  background: #eef2f8;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.5rem;
  font-size: 1.35rem;
  cursor: pointer;
  color: var(--ink);
  line-height: 1;
}

.chat-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background:
    linear-gradient(180deg, #efeae3 0%, var(--paper) 30%);
}

.bubble {
  max-width: 86%;
  padding: 0.75rem 0.9rem;
  border-radius: 0.9rem;
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  animation: fadeup 0.25s ease both;
}
.bubble.system {
  align-self: center;
  max-width: 95%;
  background: transparent;
  color: var(--muted);
  text-align: center;
  font-size: 0.86rem;
  padding: 0.25rem 0.5rem;
}
.bubble.client {
  align-self: flex-end;
  background: var(--ink);
  color: #fff;
  border-bottom-right-radius: 0.3rem;
}
.bubble.staff, .bubble.ai {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-left-radius: 0.3rem;
}
.bubble .meta {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  opacity: 0.55;
}

.identify-card, .name-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
}
.identify-card h3, .name-card h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}
.identify-card .hint, .name-card .hint {
  margin: -0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding: 0.3rem;
  background: #ebe4db;
  border-radius: 0.75rem;
}
.tab {
  border: 0;
  background: transparent;
  padding: 0.7rem 0.5rem;
  border-radius: 0.55rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
}
.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
}
input[type="text"], input[type="tel"] {
  border: 1.5px solid var(--line);
  border-radius: 0.65rem;
  padding: 0.8rem 0.85rem;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  outline: none;
}
input[type="text"]:focus, input[type="tel"]:focus {
  border-color: var(--signal);
  box-shadow: 0 0 0 3px rgba(43, 184, 166, 0.22);
}
.error { color: var(--danger); font-size: 0.86rem; margin: 0; font-weight: 600; }

.billing-offer {
  margin: 0.5rem 0.85rem 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  background: #f7f3ee;
  border-radius: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.45;
}
.billing-offer p { margin: 0.35rem 0; }
.billing-offer .muted { color: #6b645c; font-size: 0.88rem; }
.billing-offer-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.chat-footer {
  background: #fff;
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
}
.chat-compose[hidden] {
  display: none !important;
}
.chat-compose {
  display: flex;
  gap: 0.55rem;
  padding: 0.85rem 1rem 1rem;
  align-items: center;
}
.chat-compose input[type="text"] {
  flex: 1;
  font-size: 1.05rem;
  min-height: 3rem;
}
.chat-compose .btn.primary {
  font-size: 1.08rem;
  padding: 0.95rem 1.25rem;
  white-space: nowrap;
}
.attach {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.65rem;
  background: #ebe4db;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  flex: 0 0 auto;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes slidein {
  from { opacity: 0; transform: translateX(28px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeup {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.7) rotate(-8deg); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 920px) {
  .stage {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .intro { padding-bottom: 0.5rem; }
  .brand-hero { font-size: clamp(2.8rem, 14vw, 4.2rem); }
  .stage {
    max-height: none;
    overflow: visible;
  }
  .chat-dock {
    position: fixed;
    inset: 0;
    z-index: 40;
    padding: 0.75rem;
    background: rgba(5, 7, 12, 0.72);
    backdrop-filter: blur(8px);
    max-height: none;
  }
  .chat-dock:not(.is-open) { display: none; }
  .chat-shell {
    height: calc(100vh - 1.5rem);
    max-height: calc(100vh - 1.5rem);
    border-radius: 1rem;
  }
  .icon-btn.mobile-only { display: inline-grid; place-items: center; }
  .chat-header { grid-template-columns: 1fr auto; }
  .steps { display: none; }
}
