/* Нативный чат онлайн-оценки задачи (estimate.html), пригласительный блок и мобильная калибровка портфолио */

.contact-custom-note {
  margin-top: 10px;
  font-size: 13px;
  color: #a4c4b2;
  max-width: 480px;
  line-height: 1.5;
}

/* Навигационная ссылка на страницу оценки в шапке */
.header nav a.nav-estimate-link,
.nav-estimate-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px !important;
  border-radius: 999px;
  border: 1px solid rgba(217, 255, 114, 0.28);
  background: rgba(217, 255, 114, 0.08);
  color: #e7ffba !important;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.22s ease, border-color 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.header nav a.nav-estimate-link:hover,
.header nav a.nav-estimate-link[aria-current="page"],
.nav-estimate-link:hover,
.nav-estimate-link[aria-current="page"] {
  border-color: var(--refresh-lime, #d9ff72);
  background: rgba(217, 255, 114, 0.18);
  color: #ffffff !important;
}

.nav-est-spark {
  color: var(--refresh-lime, #d9ff72);
  font-size: 10.5px;
  line-height: 1;
}

.nav-est-short {
  display: none;
}

/* Компактная плашка тестового стенда на десктопе */
.test-environment-label {
  bottom: 8px !important;
  left: 10px !important;
  padding: 3px 9px !important;
  gap: 8px !important;
  font-size: 10px !important;
  opacity: 0.65;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.test-environment-label:hover {
  opacity: 1;
}

.test-environment-label.is-docked-away {
  opacity: 0 !important;
  transform: translateY(10px);
  pointer-events: none !important;
}

/* ==========================================================================
   КАЛИБРОВКА ДЕСКТОПА ПОД 100% МАСШТАБ (ПЕРВЫЙ ЭКРАН БЕЗ ОБРЕЗАНИЯ)
   ========================================================================== */
@media (min-width: 1480px) {
  .section-wrap,
  .header {
    max-width: 1520px;
  }
}

@media (min-width: 851px) {
  html {
    scroll-padding-top: 84px;
  }

  .header {
    padding-block: clamp(9px, 1.2svh, 14px) !important;
  }

  .header nav {
    align-items: center;
    gap: 24px;
  }

  .hero {
    min-height: calc(100svh - 60px) !important;
    padding-top: clamp(8px, 1.3svh, 20px) !important;
    padding-bottom: clamp(32px, 4.2svh, 48px) !important;
    gap: clamp(22px, 3.6vw, 64px) !important;
    align-items: center !important;
  }

  .hero-copy {
    padding-block: 0 !important;
  }

  .hero .eyebrow {
    font-size: 10px !important;
  }

  .hero h1 {
    font-size: clamp(38px, min(4.7vw, 6.7svh), 68px) !important;
    line-height: 0.98 !important;
    letter-spacing: -0.06em !important;
    margin: clamp(8px, 1.3svh, 16px) 0 !important;
  }

  .hero-description {
    font-size: clamp(13px, min(1.08vw, 1.75svh), 15px) !important;
    line-height: 1.52 !important;
    max-width: 500px !important;
  }

  .hero-actions {
    margin-top: clamp(10px, 1.5svh, 18px) !important;
    gap: 10px 14px !important;
  }

  .hero .button {
    padding: 10px 17px !important;
    font-size: 12.5px !important;
    gap: 13px !important;
    white-space: nowrap !important;
  }

  .hero .text-link {
    font-size: 12.5px !important;
    gap: 8px !important;
    white-space: nowrap !important;
  }

  .platforms {
    margin-top: clamp(10px, 1.4svh, 16px) !important;
  }

  .hero-system {
    margin-top: clamp(9px, 1.3svh, 15px) !important;
    max-width: 495px !important;
    border-radius: 15px !important;
  }

  .hero-system-top {
    padding: 7px 13px !important;
  }

  .hero-system-body {
    padding: 8px 13px 6px !important;
    min-height: 46px !important;
    gap: 11px !important;
  }

  .hero-system-glyph {
    width: 38px !important;
    height: 38px !important;
    flex: 0 0 38px !important;
    font-size: 11px !important;
  }

  .hero-system-text {
    gap: 3px !important;
  }

  .hero-system-text strong {
    font-size: 13.5px !important;
    line-height: 1.25 !important;
  }

  .hero-system-tabs {
    padding: 2px 11px 8px !important;
    gap: 5px !important;
  }

  .hero-system-tabs button {
    padding: 5px 10px !important;
    font-size: 11px !important;
  }

  .portrait-frame {
    height: clamp(350px, min(61svh, calc(100svh - 148px)), 525px) !important;
    border-radius: 145px 145px 20px 20px !important;
  }

  .hero-visual::before {
    inset: -10px -10px 8px 10px !important;
    border-radius: 155px 155px 22px 22px !important;
  }

  .orbit-label {
    width: clamp(76px, 9.8svh, 98px) !important;
    height: clamp(76px, 9.8svh, 98px) !important;
    top: 12px !important;
    right: -16px !important;
  }

  .floating-tag {
    bottom: clamp(70px, 10svh, 98px) !important;
    padding: 11px 15px !important;
  }

  .portrait-caption {
    bottom: 18px !important;
    left: 22px !important;
  }

  .scroll-cue {
    bottom: clamp(8px, 1.2svh, 15px) !important;
    padding-top: clamp(7px, 1svh, 11px) !important;
  }
}

@media (min-width: 1120px) {
  .hero-actions {
    flex-wrap: nowrap !important;
  }
}

/* Шапка на планшетах и средних ноутбуках */
@media (min-width: 860px) and (max-width: 1080px) {
  .header {
    display: flex !important;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 12px 28px !important;
  }
  .header nav {
    grid-column: auto;
    grid-row: auto;
    justify-content: center;
    gap: 15px;
    margin-inline: auto;
  }
  .header .language-trigger {
    min-width: 118px;
  }
}

@media (min-width: 641px) and (max-width: 859px) {
  .header nav {
    justify-content: flex-start !important;
    align-items: center;
    gap: 20px !important;
    padding-top: 6px;
    border-top: 1px solid rgba(211, 234, 215, 0.08);
  }
}

/* Плавающая кнопка связи */
.contact-float {
  right: 16px !important;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
  padding: 10px 15px !important;
  gap: 8px !important;
  font-size: 12.5px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42) !important;
  transition: opacity 0.24s ease, transform 0.24s ease, background 0.2s ease;
}

.contact-float.is-docked-away {
  opacity: 0 !important;
  transform: translateY(14px) scale(0.96);
  pointer-events: none !important;
}

/* Кнопка онлайн-оценки в первом экране */
.hero-actions {
  flex-wrap: wrap;
  row-gap: 10px;
}

.button-ai-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 50px;
  border: 1px solid rgba(217, 255, 114, 0.38);
  background: linear-gradient(135deg, rgba(217, 255, 114, 0.13), rgba(24, 38, 31, 0.78));
  color: #ebffd0;
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -0.01em;
  white-space: nowrap;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.button-ai-ghost:hover {
  transform: translateY(-2px);
  border-color: var(--refresh-lime, #d9ff72);
  background: linear-gradient(135deg, rgba(217, 255, 114, 0.22), rgba(29, 46, 37, 0.9));
  box-shadow: 0 14px 36px rgba(185, 245, 92, 0.16);
  color: #ffffff;
}

.ai-spark-dot {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(217, 255, 114, 0.2);
  color: var(--refresh-lime, #d9ff72);
  font-size: 10.5px;
  line-height: 1;
}

/* ==========================================================================
   ЛЕГКИЙ ДРУЖЕЛЮБНЫЙ БЛОК-ПРИГЛАШЕНИЕ В ЧАТ ОЦЕНКИ (НА ГЛАВНЫХ СТРАНИЦАХ)
   ========================================================================== */
.estimate-invite-section {
  padding-top: clamp(32px, 5vw, 56px);
  padding-bottom: clamp(16px, 3vw, 28px);
}

.estimate-invite-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px 36px;
  padding: clamp(22px, 3vw, 34px) clamp(20px, 3.4vw, 38px);
  border-radius: 24px;
  border: 1px solid rgba(210, 242, 174, 0.24);
  background:
    radial-gradient(ellipse at 92% 15%, rgba(217, 255, 114, 0.14), transparent 48%),
    linear-gradient(145deg, rgba(23, 36, 31, 0.92), rgba(12, 20, 18, 0.97));
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.28);
}

.estimate-invite-copy {
  max-width: 680px;
}

.estimate-invite-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #d9ff72;
}

.estimate-invite-title {
  margin-top: 10px;
  font-size: clamp(22px, 2.5vw, 32px);
  line-height: 1.14;
  letter-spacing: -0.035em;
  font-weight: 520;
  color: #f4f8ee;
}

.estimate-invite-text {
  margin-top: 8px;
  font-size: 14.5px;
  line-height: 1.58;
  color: #b1c2b5;
}

.estimate-invite-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 15px;
}

.estimate-topic-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid rgba(203, 232, 198, 0.22);
  background: rgba(255, 255, 255, 0.035);
  color: #dce9dd;
  font-size: 12.5px;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.estimate-topic-pill:hover {
  border-color: #d9ff72;
  background: rgba(217, 255, 114, 0.12);
  color: #ffffff;
  transform: translateY(-1px);
}

.estimate-invite-action {
  flex-shrink: 0;
}

.estimate-invite-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 13px 24px;
  border-radius: 999px;
  background: var(--refresh-lime, #d9ff72);
  color: #131c0d;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  box-shadow: 0 12px 30px rgba(217, 255, 114, 0.18);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.estimate-invite-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(217, 255, 114, 0.28);
}

/* ==========================================================================
   ОТДЕЛЬНАЯ СТРАНИЦА ЧАТА ОЦЕНКИ (body.page-estimate)
   ========================================================================== */
body.page-estimate .hero,
body.page-estimate .marquee,
body.page-estimate #projects,
body.page-estimate #expertise,
body.page-estimate #about,
body.page-estimate #contact,
body.page-estimate .contact-float {
  display: none !important;
}

body.page-estimate {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

body.page-estimate main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.estimate-page-section {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: 900px;
  margin-inline: auto;
  padding: 16px 24px 18px;
}

.chat-workspace {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 12px;
}

.chat-sheet {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 500px;
  max-height: clamp(540px, calc(100svh - 148px), 760px);
  border-radius: 24px;
  border: 1px solid rgba(206, 235, 198, 0.2);
  background: linear-gradient(165deg, rgba(20, 31, 27, 0.94), rgba(10, 17, 16, 0.98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-sheet.is-dragover {
  border-color: #d9ff72;
  box-shadow: 0 0 0 2px rgba(217, 255, 114, 0.32), 0 28px 80px rgba(0, 0, 0, 0.42);
}

/* Шапка мессенджера */
.chat-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid rgba(205, 233, 201, 0.12);
  background: rgba(9, 15, 14, 0.68);
}

.chat-head-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.chat-back-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(200, 226, 196, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: #bfd0c2;
  font-size: 12px;
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.chat-back-link:hover {
  border-color: rgba(217, 255, 114, 0.5);
  color: #f2f8ec;
  background: rgba(217, 255, 114, 0.08);
}

.chat-identity {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.chat-avatar {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #d9ff72, #9be884);
  color: #111a0c;
  display: grid;
  place-items: center;
  font-weight: 750;
  font-size: 14px;
  letter-spacing: -0.04em;
}

.chat-identity-meta {
  min-width: 0;
}

.chat-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f4f8ee;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-subtitle {
  margin: 2px 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #9bb1a2;
  white-space: nowrap;
  overflow: hidden;
}

.chat-subtitle .js-chat-online {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-online-dot {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a5ff68;
  box-shadow: 0 0 9px #a5ff68;
}

.chat-head-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-combo-toggle,
.chat-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(200, 226, 196, 0.22);
  background: rgba(255, 255, 255, 0.035);
  color: #d2e1d4;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.chat-combo-toggle:hover,
.chat-combo-toggle.is-open,
.chat-reset-btn:hover {
  border-color: rgba(217, 255, 114, 0.65);
  background: rgba(217, 255, 114, 0.11);
  color: #f4fbe8;
}

.chat-reset-btn[hidden],
.chat-combo-count[hidden] {
  display: none !important;
}

.chat-combo-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--refresh-lime, #d9ff72);
  color: #131c0d;
  font-size: 11px;
  font-weight: 700;
}

/* Опциональная шторка выбора связки модулей */
.chat-combo-drawer {
  flex: 0 0 auto;
  padding: 12px 20px 14px;
  border-bottom: 1px solid rgba(217, 255, 114, 0.18);
  background: rgba(14, 24, 20, 0.92);
}

.chat-combo-drawer[hidden] {
  display: none !important;
}

.chat-combo-title {
  font-size: 12px;
  color: #a8bcad;
  margin-bottom: 9px;
}

.chat-combo-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chat-module-pill {
  min-height: 36px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid rgba(198, 224, 193, 0.22);
  background: rgba(255, 255, 255, 0.03);
  color: #d6e4d8;
  font-size: 12.5px;
  font-weight: 500;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.chat-module-pill:hover {
  border-color: rgba(217, 255, 114, 0.5);
}

.chat-module-pill[aria-pressed="true"] {
  border-color: var(--refresh-lime, #d9ff72);
  background: rgba(217, 255, 114, 0.16);
  color: #f4ffda;
}

.chat-combo-foot {
  margin-top: 11px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-combo-range {
  font-size: 13px;
  font-weight: 600;
  color: #d9ff72;
}

.chat-combo-submit {
  min-height: 36px;
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--refresh-lime, #d9ff72);
  color: #131c0d;
  font-size: 12.5px;
  font-weight: 650;
}

.chat-combo-submit:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Лента переписки */
.chat-stream {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #4b624d transparent;
}

.ai-msg {
  max-width: 90%;
  padding: 13px 16px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.56;
}

.ai-reply-text,
.chat-welcome-bubble {
  white-space: pre-line;
}

.ai-msg-assistant {
  align-self: flex-start;
  width: min(100%, 690px);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(202, 230, 198, 0.15);
  color: #eef4ea;
  border-bottom-left-radius: 6px;
}

.ai-msg-user {
  align-self: flex-end;
  max-width: min(85%, 560px);
  padding: 10px 15px;
  background: linear-gradient(135deg, rgba(217, 255, 114, 0.22), rgba(126, 206, 102, 0.18));
  border: 1px solid rgba(217, 255, 114, 0.38);
  color: #f6fceb;
  font-size: 14.5px;
  white-space: pre-line;
  border-bottom-right-radius: 6px;
}

/* Дружелюбные карточки быстрого старта внутри чата */
.chat-starters-box {
  margin-top: 2px;
  display: grid;
  gap: 9px;
}

.chat-starters-label {
  font-size: 12px;
  color: #93a99a;
  padding-left: 2px;
}

.chat-starters-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.chat-starter-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-height: 58px;
  padding: 10px 13px;
  border-radius: 14px;
  border: 1px solid rgba(202, 230, 196, 0.18);
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.chat-starter-card:hover {
  border-color: rgba(217, 255, 114, 0.65);
  background: rgba(217, 255, 114, 0.09);
  transform: translateY(-1px);
}

.chat-starter-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #f2f7ec;
  line-height: 1.25;
}

.chat-starter-sub {
  font-size: 11.5px;
  line-height: 1.32;
  color: #97ad9e;
}

.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #b7cbb8;
  font-size: 13.5px;
}

.ai-typing-dots {
  display: inline-flex;
  gap: 4px;
}

.ai-typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d9ff72;
  animation: ai-dot-bounce 1.1s infinite ease-in-out;
}
.ai-typing-dots i:nth-child(2) { animation-delay: 0.18s; }
.ai-typing-dots i:nth-child(3) { animation-delay: 0.36s; }

@keyframes ai-dot-bounce {
  0%, 80%, 100% { opacity: 0.28; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* Карточка сметы и встроенной отправки внутри ответа помощника */
.ai-estimate-card {
  margin-top: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(9, 16, 14, 0.88);
  border: 1px solid rgba(217, 255, 114, 0.28);
  display: grid;
  gap: 10px;
}

.ai-estimate-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
}

.ai-verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(182, 248, 104, 0.15);
  color: #d9ff72;
}

.ai-verdict-badge[data-verdict="no"] {
  background: rgba(255, 160, 122, 0.15);
  color: #ffc2a8;
}

.ai-estimate-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ai-estimate-stack span {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(196, 224, 192, 0.2);
  font-size: 11px;
  color: #c3d4c5;
}

.ai-estimate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ai-estimate-cell {
  padding: 9px 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(203, 228, 199, 0.12);
}

.ai-estimate-cell small {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #93a999;
}

.ai-estimate-cell strong {
  display: block;
  margin-top: 3px;
  font-size: 15.5px;
  font-weight: 650;
  color: #f5f9ef;
}

.ai-analyzed-sites-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-analyzed-site-bar {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 9px;
  border: 1px solid rgba(165, 255, 104, 0.28);
  background: rgba(165, 255, 104, 0.08);
  color: #dcf7cc;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
}

.ai-analyzed-site-bar.is-compare {
  border-color: rgba(217, 255, 114, 0.38);
  background: rgba(217, 255, 114, 0.12);
  color: #efffc7;
}

.ai-analyzed-site-dot {
  font-style: normal;
  font-size: 12px;
  flex-shrink: 0;
}

/* Наглядное разделение сметы по комплектациям (например без кабинета врачей / с порталом врачей) */
.ai-estimate-tiers {
  display: grid;
  gap: 8px;
}

.ai-tier-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1px solid rgba(203, 232, 198, 0.16);
  background: rgba(7, 13, 12, 0.58);
}

.ai-tier-card.is-full {
  border-color: rgba(217, 255, 114, 0.36);
  background: linear-gradient(135deg, rgba(217, 255, 114, 0.09), rgba(10, 18, 16, 0.78));
}

.ai-tier-desc {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ai-tier-tag {
  display: inline-flex;
  width: fit-content;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #a9c0ae;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ai-tier-card.is-full .ai-tier-tag {
  background: rgba(217, 255, 114, 0.18);
  color: #d9ff72;
}

.ai-tier-title {
  font-size: 12.5px;
  line-height: 1.38;
  color: #e6f0e6;
}

.ai-tier-price-box {
  flex-shrink: 0;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-tier-budget {
  font-size: 15px;
  font-weight: 700;
  color: #f5faef;
  white-space: nowrap;
}

.ai-tier-card.is-full .ai-tier-budget {
  color: #e4ff92;
}

.ai-tier-timeline {
  font-size: 11.5px;
  color: #9cb2a2;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .ai-tier-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
  }

  .ai-tier-price-box {
    width: 100%;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    text-align: left;
    padding-top: 6px;
    border-top: 1px solid rgba(203, 232, 198, 0.1);
  }
}

.ai-case-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(217, 255, 114, 0.28);
  background: rgba(217, 255, 114, 0.07);
  color: #e6fcbd;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.ai-case-link-btn:hover {
  background: rgba(217, 255, 114, 0.16);
  border-color: #d9ff72;
}

/* Встроенный дружелюбный блок передачи расчета Владиславу */
.chat-inline-handoff {
  padding-top: 10px;
  border-top: 1px solid rgba(205, 233, 201, 0.12);
  display: grid;
  gap: 8px;
}

.chat-inline-handoff-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  font-size: 12.5px;
  color: #c7d7c9;
}

.ai-handoff-tg-direct {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(217, 255, 114, 0.34);
  background: rgba(217, 255, 114, 0.09);
  color: #e8ffbf;
  font-size: 12px;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.ai-handoff-tg-direct:hover {
  border-color: #d9ff72;
  background: rgba(217, 255, 114, 0.18);
}

.ai-handoff-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-handoff-input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(203, 230, 196, 0.24);
  background: rgba(255, 255, 255, 0.05);
  color: #f3f7ee;
  font: inherit;
  font-size: 13.5px;
}

.ai-handoff-input::placeholder {
  color: #8ea394;
}

.ai-handoff-input:focus {
  outline: none;
  border-color: #d9ff72;
}

.ai-handoff-submit {
  flex-shrink: 0;
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  background: var(--refresh-lime, #d9ff72);
  color: #131c0d;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.ai-handoff-submit:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ai-handoff-status {
  font-size: 12.5px;
  color: #bcf28e;
}

/* Бейдж прикрепленного ТЗ в сообщении пользователя */
.ai-msg-file-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(11, 20, 16, 0.58);
  border: 1px solid rgba(217, 255, 114, 0.36);
  color: #e6fcbd;
  font-size: 12px;
  font-weight: 550;
}

.ai-msg-user-text {
  display: block;
  margin-top: 5px;
}

/* ==========================================================================
   КАПСУЛА ВВОДА С ПОЛНОШИРИННЫМ ПОЛЕМ И ПОДПИСАННЫМИ КНОПКАМИ
   ========================================================================== */
.chat-composer-wrap {
  flex: 0 0 auto;
  padding: 10px 18px 12px;
  border-top: 1px solid rgba(205, 233, 201, 0.1);
  background: rgba(10, 17, 16, 0.86);
}

.chat-composer-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 13px 10px;
  border-radius: 18px;
  border: 1px solid rgba(202, 230, 198, 0.24);
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-composer-box:focus-within {
  border-color: rgba(217, 255, 114, 0.78);
  box-shadow: 0 0 0 3px rgba(217, 255, 114, 0.12);
}

.ai-attachment-bar[hidden] {
  display: none !important;
}

.ai-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.3;
  border: 1px solid rgba(202, 230, 196, 0.24);
  background: rgba(255, 255, 255, 0.05);
  color: #dce8dd;
}

.ai-attachment-chip[data-state="ok"] {
  border-color: rgba(182, 248, 104, 0.45);
  background: rgba(182, 248, 104, 0.12);
  color: #e7fcca;
}

.ai-attachment-chip[data-state="error"] {
  border-color: rgba(255, 152, 118, 0.48);
  background: rgba(255, 128, 92, 0.13);
  color: #ffd0bf;
}

.ai-attachment-chip[data-state="loading"] {
  border-color: rgba(164, 224, 206, 0.38);
  background: rgba(120, 204, 182, 0.12);
  color: #cfece3;
}

.ai-attachment-icon {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 12px;
}

.ai-attachment-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-attachment-remove {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 13px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.ai-attachment-remove:hover {
  background: rgba(255, 255, 255, 0.24);
}

.ai-attachment-remove[hidden] {
  display: none !important;
}

.ai-composer-input {
  width: 100%;
  min-height: 26px;
  max-height: 112px;
  padding: 2px 2px;
  border: 0;
  background: transparent;
  color: #f4f8ef;
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  box-sizing: border-box;
  overflow-y: hidden;
  scrollbar-width: thin;
  resize: none;
}

.ai-composer-input::placeholder {
  color: #8da293;
}

.ai-composer-input:focus {
  outline: none;
}

.chat-composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-composer-tools {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.ai-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(198, 224, 194, 0.22);
  background: rgba(255, 255, 255, 0.045);
  color: #c8d8ca;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.ai-tool-btn:hover:not(:disabled) {
  border-color: rgba(217, 255, 114, 0.62);
  background: rgba(217, 255, 114, 0.1);
  color: #eeffc7;
}

.ai-tool-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.ai-attach-btn.has-attachment {
  border-color: rgba(217, 255, 114, 0.76);
  background: rgba(217, 255, 114, 0.15);
  color: #d9ff72;
}

.ai-voice-btn.is-recording {
  border-color: rgba(255, 132, 108, 0.85);
  background: rgba(255, 106, 82, 0.2);
  color: #ffd7cd;
  animation: ai-rec-pulse 1.3s infinite ease-in-out;
}

.ai-tool-label[hidden],
.ai-voice-timer[hidden] {
  display: none !important;
}

.ai-voice-timer {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

@keyframes ai-rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 118, 92, 0.35); }
  50% { box-shadow: 0 0 0 4px rgba(255, 118, 92, 0.08); }
}

.ai-composer-send {
  flex-shrink: 0;
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--refresh-lime, #d9ff72);
  color: #131c0d;
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.ai-composer-send:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ai-composer-send:disabled {
  opacity: 0.55;
  cursor: default;
}

.chat-disclaimer {
  margin: 7px 4px 0;
  font-size: 11px;
  line-height: 1.38;
  color: #7d9284;
  text-align: center;
}

/* Строка принципов под чатом на десктопе */
.chat-trust-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  padding: 2px 8px;
}

.chat-trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #9bb0a1;
}

.chat-trust-pill i {
  font-style: normal;
  color: #d9ff72;
  font-weight: 700;
}

/* Быстрый бриф внутри модального окна контактов */
.quick-brief-box {
  margin-top: 18px;
  padding: 15px;
  border-radius: 15px;
  border: 1px solid rgba(203, 232, 190, 0.2);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 9px;
}

.quick-brief-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-brief-head strong {
  font-size: 13px;
  color: #eff5ea;
}

.quick-brief-ai-jump {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(217, 255, 114, 0.35);
  background: rgba(217, 255, 114, 0.1);
  color: #d9ff72;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
}

.quick-brief-textarea,
.quick-brief-contact {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(198, 224, 192, 0.22);
  background: rgba(11, 17, 14, 0.72);
  color: #f3f7ee;
  font: inherit;
  font-size: 14px;
}

.quick-brief-textarea {
  min-height: 64px;
  resize: vertical;
}

.quick-brief-textarea:focus,
.quick-brief-contact:focus {
  outline: none;
  border-color: #d9ff72;
}

.quick-brief-submit {
  width: 100%;
  min-height: 42px;
  padding: 11px 16px;
  border-radius: 10px;
  background: #d9ff72;
  color: #131c0d;
  font-size: 13.5px;
  font-weight: 650;
}

.quick-brief-feedback {
  font-size: 12.5px;
  color: #bae884;
}

.quick-brief-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ==========================================================================
   МОБИЛЬНАЯ И ПЛАНШЕТНАЯ АДАПТАЦИЯ (НАТИВНЫЙ UX БЕЗ ПЕРЕКРЫТИЙ И АВТОЗУМА)
   ========================================================================== */
@media (max-width: 820px) {
  .estimate-invite-card {
    flex-direction: column;
    align-items: stretch;
  }

  .estimate-invite-cta {
    width: 100%;
  }

  .chat-starters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Нативный мобильный мессенджер на странице estimate.html */
@media (max-width: 768px) {
  /* 16px шрифт на всех полях ввода отключает принудительный авто-зум iOS Safari */
  .ai-composer-input,
  .ai-handoff-input,
  .quick-brief-textarea,
  .quick-brief-contact,
  .language-menu .lang-preview-search {
    font-size: 16px !important;
  }

  html:has(body.page-estimate) {
    height: 100dvh !important;
    overflow: hidden !important;
  }

  body.page-estimate {
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    padding-bottom: 0 !important;
  }

  body.page-estimate .footer,
  body.page-estimate .test-environment-label,
  body.page-estimate .chat-trust-row {
    display: none !important;
  }

  body.page-estimate .estimate-page-section {
    padding: 0 !important;
    max-width: none;
  }

  body.page-estimate .chat-workspace {
    gap: 0;
  }

  body.page-estimate .chat-sheet {
    min-height: 0;
    max-height: none;
    border-radius: 0;
    border-inline: 0;
    border-bottom: 0;
    box-shadow: none;
  }

  .chat-head {
    padding: 10px 14px;
    gap: 8px;
  }

  .chat-back-link {
    display: none;
  }

  .chat-avatar {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 13px;
  }

  .chat-title {
    font-size: 14px;
  }

  .chat-subtitle {
    font-size: 11px;
  }

  .chat-combo-drawer {
    padding: 10px 14px 12px;
  }

  .chat-stream {
    padding: 14px 14px;
    gap: 10px;
  }

  .ai-msg {
    max-width: 96%;
    padding: 11px 13px;
    font-size: 14.5px;
  }

  .ai-msg-user {
    max-width: 88%;
    padding: 9px 13px;
  }

  .chat-composer-wrap {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .chat-composer-box {
    padding: 10px 11px 9px;
    border-radius: 16px;
  }

  .ai-tool-btn {
    height: 38px;
    padding: 0 11px;
  }

  .ai-composer-send {
    height: 38px;
    padding: 0 16px;
  }

  .chat-disclaimer {
    margin-top: 5px;
    font-size: 10px;
  }
}

/* Нативная мобильная верстка основного сайта портфолио (<= 640px) */
@media (max-width: 640px) {
  /* Убираем черную полосу 72px снизу и вложенный скролл из contact-popup.css */
  html:not(:has(body.page-estimate)) {
    height: auto !important;
    overflow-x: clip;
    overflow-y: auto !important;
    scroll-padding-top: 92px !important;
  }

  body:not(.page-estimate) {
    height: auto !important;
    min-height: 100dvh !important;
    overflow-x: clip;
    overflow-y: visible !important;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }

  /* Компактная двухрядная мобильная шапка (4 пункта навигации ровно в 1 ряд) */
  .header {
    padding: 10px 16px 8px !important;
    row-gap: 7px !important;
    column-gap: 8px !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
  }

  .header .brand-mark {
    font-size: 25px !important;
  }

  .header .header-contact {
    min-height: 34px;
    padding: 6px 11px !important;
    font-size: 12px !important;
  }

  .header .language-trigger {
    min-height: 34px !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
    gap: 6px !important;
  }

  .header nav {
    padding-top: 6px;
    border-top: 1px solid rgba(211, 234, 215, 0.09);
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    font-size: 12px !important;
  }

  .header nav a:not(.nav-estimate-link) {
    padding: 3px 0 !important;
    white-space: nowrap;
  }

  .nav-est-full {
    display: none;
  }

  .nav-est-short {
    display: inline;
  }

  .header nav a.nav-estimate-link {
    padding: 3px 10px !important;
    font-size: 11.5px !important;
  }

  /* Удобные кнопки первого экрана на смартфоне */
  .hero {
    padding-top: 26px !important;
    padding-bottom: 52px !important;
    gap: 24px !important;
  }

  .hero-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px 14px !important;
    margin-top: 20px !important;
  }

  .hero .button-lime {
    min-height: 44px;
    padding: 11px 18px !important;
    font-size: 13.5px !important;
  }

  .hero .text-link {
    min-height: 38px;
    font-size: 13.5px !important;
  }

  .button-ai-ghost {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    font-size: 13.5px;
  }

  /* Плашка тестовой версии на мобильном уходит вниз страницы и не мешает нажатиям */
  body:not(.page-estimate) .test-environment-label {
    position: static !important;
    width: fit-content;
    margin: 4px auto 14px !important;
    opacity: 0.78 !important;
    transform: none !important;
    pointer-events: auto !important;
  }

  .chat-starter-card {
    min-height: 52px;
    padding: 8px 10px;
  }

  .chat-starter-title {
    font-size: 12.5px;
  }

  .chat-starter-sub {
    font-size: 10.5px;
  }

  .ai-estimate-cell {
    padding: 8px 10px;
  }

  .ai-estimate-cell strong {
    font-size: 14px;
  }

  .ai-handoff-row {
    flex-wrap: wrap;
  }

  .ai-handoff-input {
    flex-basis: 100%;
    height: 40px;
  }

  .ai-handoff-submit {
    width: 100%;
    height: 40px;
  }
}

@media (max-width: 355px) {
  .chat-starters-grid {
    grid-template-columns: 1fr;
  }

  .ai-estimate-grid {
    grid-template-columns: 1fr;
  }

  .chat-combo-toggle {
    padding-inline: 9px;
    font-size: 11px;
  }
}

/* Блок зафиксированных условий конечной стоимости в карточке */
.ai-conditions-box {
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid rgba(203, 232, 198, 0.16);
  background: rgba(255, 255, 255, 0.028);
  display: grid;
  gap: 6px;
}

.ai-conditions-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a9c4b0;
}

.ai-conditions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
}

.ai-conditions-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 12.2px;
  line-height: 1.38;
  color: #dce9de;
}

.ai-conditions-item i {
  font-style: normal;
  color: #d9ff72;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Строка прикрепления файла ТЗ в быстрой форме связи */
.quick-brief-attach-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.quick-brief-attach-btn {
  height: 34px;
  font-size: 12px;
}

.quick-brief-attach-status {
  font-size: 11.8px;
  color: #bfe8a2;
  line-height: 1.3;
}
