/* Смета в чате: переписка слева, документ справа, съёмка помещения на весь экран. */

/* ---------- страница: шапка без меню и подвала, чат на всю высоту ---------- */

body:has(.chat-app) {
  --promo-h: 0px;
}

body:has(.chat-app) .promo,
body:has(.chat-app) .nav,
body:has(.chat-app) .footer,
body:has(.chat-app) .crumbs {
  display: none !important;
}

html.chat-lock,
html.chat-lock body {
  overflow: hidden;
}

@media (min-width: 961px) {
  body:has(.chat-app) {
    overflow: hidden;
  }
}

.chat-app {
  position: relative;
  display: grid;
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
  gap: 12px;
  height: calc(100dvh - var(--chat-top, 76px));
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 12px 12px;
}

.chat-app.is-empty {
  grid-template-columns: minmax(0, 1fr);
}

.chat-app.is-empty .doc-col,
.chat-app.is-empty .doc-pill {
  display: none;
}

/* пока считается первая смета */
.ds-skeleton {
  display: grid;
  gap: 12px;
}

.ds-skeleton i {
  display: block;
  height: 18px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--paper) 0%, var(--well) 50%, var(--paper) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}

.ds-skeleton i:nth-child(1) {
  width: 30%;
  height: 12px;
}

.ds-skeleton i:nth-child(2) {
  width: 55%;
  height: 34px;
}

.ds-skeleton i.is-big {
  height: 150px;
  margin-top: 10px;
  border-radius: 16px;
}

.ds-skeleton i:nth-child(n + 4) {
  height: 96px;
  border-radius: 16px;
}

/* ---------- колонка чата ---------- */

.chat-col {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.chat-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px 10px 6px;
}

.chat-title {
  flex: 1;
  min-width: 0;
}

.chat-title b {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.chat-title span {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-mode {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(19, 19, 19, 0.05);
}

.chat-mode button {
  height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.chat-mode button.is-on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(19, 19, 19, 0.08);
}

.chat-new {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--ink-2);
  transition: background 0.2s var(--ease);
}

.chat-new:hover {
  background: rgba(19, 19, 19, 0.06);
}

.chat-new .icon {
  width: 20px;
  height: 20px;
}

.chat-app.is-empty .chat-new {
  visibility: hidden;
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 8px 18px;
}

/* пустой экран: приветствие и поле по центру */

.chat-app.is-empty .chat-col {
  width: min(760px, 100%);
  margin: 0 auto;
  justify-content: center;
}

.chat-app.is-empty .chat-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.chat-app.is-empty .chat-scroll {
  flex: none;
  overflow: visible;
  padding: 0;
}

.chat-hello {
  padding: 0 8px 28px;
  text-align: center;
}

.chat-hello .eyebrow {
  margin-bottom: 0;
}

.chat-hello h1 {
  margin-top: 10px;
  font-size: clamp(34px, 4.2vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.chat-hello-lead {
  max-width: 34em;
  margin: 16px auto 0;
  font-size: 17px;
  color: var(--ink-2);
}

.chat-app:not(.is-empty) .chat-hello,
.chat-app:not(.is-empty) .chat-starters,
.chat-app:not(.is-empty) .chat-fine {
  display: none;
}

/* ---------- поле ввода ---------- */

.chat-dock {
  position: relative;
  padding: 0 2px;
}

.composer {
  padding: 12px 12px 10px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(19, 19, 19, 0.04), 0 22px 44px -30px rgba(19, 19, 19, 0.4);
  outline: 1.5px solid transparent;
  transition: outline-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.composer:focus-within {
  outline-color: rgba(19, 19, 19, 0.22);
}

.chat-col.is-drop .composer {
  outline: 2px dashed var(--accent);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 28px;
  max-height: 200px;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  outline: none;
}

.composer textarea::placeholder {
  color: var(--ink-3);
}

.chat-app.is-empty .composer {
  padding: 16px 14px 12px;
}

.chat-app.is-empty .composer textarea {
  min-height: 60px;
  font-size: 17px;
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.cb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: none;
  min-width: 38px;
  height: 38px;
  padding: 0 9px;
  border-radius: 11px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.cb-btn:hover {
  background: var(--paper);
  color: var(--ink);
}

.cb-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cb-btn .icon {
  width: 20px;
  height: 20px;
}

.cb-video {
  padding: 0 13px 0 10px;
  background: var(--paper);
  color: var(--ink);
}

.cb-video:hover {
  background: var(--well);
}

.composer-hint {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  color: var(--ink-3);
  text-align: right;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cb-send {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.cb-send:hover:not(:disabled) {
  background: #000;
}

.cb-send:active:not(:disabled) {
  transform: scale(0.94);
}

.cb-send:disabled {
  background: rgba(19, 19, 19, 0.12);
  cursor: default;
}

.cb-send .icon {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.composer.is-rec .cb-mic {
  background: var(--accent);
  color: #fff;
}

.composer-rec {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 6px 8px;
  color: var(--accent);
}

.composer-rec[hidden] {
  display: none;
}

.composer-rec canvas {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 32px;
  color: var(--accent);
}

.composer-rec-time {
  font-size: 13px;
  font-weight: 500;
}

/* вложения до отправки */

.composer-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 10px;
}

.cf {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 260px;
  padding: 6px 6px 6px 6px;
  border-radius: 12px;
  background: var(--paper);
  animation: msg-in 0.3s var(--ease) both;
}

.cf-thumb {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 9px;
  background: var(--well);
  overflow: hidden;
  color: var(--ink-2);
}

.cf-thumb img,
.cf-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cf-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
}

.cf-play .icon,
.cf-icon .icon {
  width: 20px;
  height: 20px;
}

.cf-icon {
  display: grid;
  place-items: center;
}

.cf-text {
  min-width: 0;
}

.cf-text b {
  display: block;
  overflow: hidden;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cf-text small {
  font-size: 12px;
  color: var(--ink-3);
}

.cf-x {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--ink-3);
}

.cf-x:hover {
  background: rgba(19, 19, 19, 0.07);
  color: var(--ink);
}

.cf-x .icon {
  width: 16px;
  height: 16px;
}

.chat-starters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.chat-starters .chip {
  background: rgba(19, 19, 19, 0.05);
}

.chat-starters .chip:hover {
  background: rgba(19, 19, 19, 0.1);
}

.chat-fine {
  max-width: 44em;
  margin: 22px auto 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
  text-align: center;
}

/* ---------- сообщения ---------- */

.chat-log {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.msg {
  display: flex;
  gap: 12px;
  min-width: 0;
  animation: msg-in 0.4s var(--ease) both;
}

.msg-user {
  justify-content: flex-end;
}

.msg-user .msg-body {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 18px 18px 6px 18px;
  background: var(--well);
  font-size: 15px;
  line-height: 1.5;
}

.msg-user .msg-body p {
  overflow-wrap: anywhere;
}

.msg-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.msg-avatar i {
  font-style: normal;
  color: var(--accent);
}

.msg-bot .msg-body {
  flex: 1;
  min-width: 0;
  padding-top: 3px;
  font-size: 15px;
  line-height: 1.55;
}

.msg-bot .msg-body > * + * {
  margin-top: 10px;
}

.msg-soft {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-3);
}

.thinking {
  display: inline-block;
  font-size: 14px;
  color: transparent;
  background: linear-gradient(90deg, var(--ink-3) 0%, var(--ink-3) 38%, var(--ink) 50%, var(--ink-3) 62%, var(--ink-3) 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shimmer 1.3s linear infinite;
}

@keyframes shimmer {
  from {
    background-position: 110% 0;
  }

  to {
    background-position: -110% 0;
  }
}

.rec-card {
  padding: 12px 14px 6px;
  border-radius: 14px;
  background: #fff;
}

.rec-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.rec-head b {
  font-weight: 500;
}

.rec-head span {
  color: var(--ink-3);
}

.rec-card dl {
  margin: 8px 0 0;
}

.rec-card dl div {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.4;
}

.rec-card dt {
  color: var(--ink-3);
}

.rec-card dd {
  margin: 0;
}

.doc-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px 10px 10px;
  border-radius: 14px;
  background: #fff;
  text-align: left;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.doc-card:hover {
  box-shadow: inset 0 0 0 1px rgba(19, 19, 19, 0.28);
}

.doc-card:active {
  transform: translateY(1px);
}

.doc-card-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #fff0e8;
  color: var(--accent-press);
}

.doc-card-icon .icon {
  width: 20px;
  height: 20px;
}

.doc-card-body {
  flex: 1;
  min-width: 0;
}

.doc-card-body b {
  display: block;
  overflow: hidden;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.doc-card-body span {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
}

.doc-card-sum {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.msg-staff {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ok);
}

.msg-staff.is-low {
  color: var(--wait);
}

.msg-staff .icon {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.msg-says {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.msg-say {
  height: 34px;
  padding: 0 12px;
  background: #fff;
  font-size: 13px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.msg-say:hover {
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(19, 19, 19, 0.28);
}

.msg-say.is-on,
.msg-say.is-on:hover {
  background: var(--ink);
  color: #fff;
  box-shadow: none;
}

.msg-say:disabled:not(.is-on) {
  opacity: 0.45;
}

.msg-call {
  color: var(--accent-ink);
}

.msg-call .icon {
  width: 16px;
  height: 16px;
}

.msg-media {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.msg-media.is-one {
  grid-template-columns: minmax(0, 1fr);
}

.msg-media img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  object-fit: cover;
}

.msg-video {
  margin: 0;
}

.msg-video video {
  display: block;
  width: 100%;
  max-height: 280px;
  border-radius: 12px;
  background: #000;
}

.msg-video figcaption {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-2);
}

.msg-video figcaption .icon {
  width: 14px;
  height: 14px;
}

.msg-file {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 6px 6px 0;
  padding: 8px 12px 8px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  vertical-align: top;
}

.msg-file > .icon {
  width: 22px;
  height: 22px;
  color: var(--ink-2);
}

.msg-file b {
  display: block;
  font-weight: 500;
  font-size: 13px;
}

.msg-file small {
  font-size: 12px;
  color: var(--ink-3);
}

.msg-event {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
  animation: msg-in 0.35s var(--ease) both;
}

.msg-event .icon {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--ok);
}

/* ---------- документ справа ---------- */

@keyframes doc-in {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
}

@keyframes doc-flash {
  0% {
    box-shadow: 0 0 0 2px rgba(255, 90, 31, 0.55), 0 30px 60px -44px rgba(19, 19, 19, 0.4);
  }

  100% {
    box-shadow: 0 0 0 2px rgba(255, 90, 31, 0), 0 30px 60px -44px rgba(19, 19, 19, 0.4);
  }
}

.doc-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-radius: 22px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 30px 60px -44px rgba(19, 19, 19, 0.4);
  animation: doc-in 0.5s var(--ease) both;
}

.doc-col.is-flash {
  animation: doc-flash 1s var(--ease) both;
}

.doc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 12px;
  border-bottom: 1px solid var(--line);
}

.doc-tabs {
  display: flex;
  gap: 2px;
  min-width: 0;
  padding: 3px;
  border-radius: 11px;
  background: var(--paper);
  overflow-x: auto;
  scrollbar-width: none;
}

.doc-tabs button {
  flex: none;
  height: 32px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.doc-tabs button.is-on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(19, 19, 19, 0.08);
}

.doc-tabs .num {
  margin-left: 2px;
  font-size: 12px;
  color: var(--ink-3);
}

.chat-app[data-mode="client"] .staff-only {
  display: none;
}

.doc-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.doc-actions .btn-sm .icon {
  width: 18px;
  height: 18px;
}

.doc-close {
  display: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--paper);
}

.doc-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(18px, 2.6vw, 36px);
}

.doc-pane[data-pane="smeta"],
.doc-pane[data-pane="files"],
.doc-pane[data-pane="inner"] {
  max-width: 880px;
  margin: 0 auto;
  animation: msg-in 0.35s var(--ease) both;
}

.ds-label {
  font-size: 12px;
  color: var(--ink-3);
}

.ds-head h2 {
  margin-top: 6px;
  font-size: clamp(26px, 2.6vw, 36px);
  letter-spacing: -0.03em;
}

.ds-meta {
  margin-top: 6px;
  font-size: 14px;
  color: var(--ink-2);
}

.ds-total {
  margin-top: 22px;
  padding: 18px 20px 20px;
  border-radius: 16px;
  background: var(--paper);
}

.ds-total-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.ds-total-row .price {
  font-size: clamp(34px, 3.2vw, 46px);
  letter-spacing: -0.035em;
}

.ds-total-note {
  font-size: 13px;
  color: var(--ink-3);
}

.ds-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.ds-facts div {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 0 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  font-size: 12px;
  color: var(--ink-3);
}

.ds-facts .icon {
  grid-row: span 2;
  width: 17px;
  height: 17px;
  color: var(--accent-press);
}

.ds-facts b {
  grid-column: 2;
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
}

.ds-sec {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 30px 0 12px;
}

.ds-sec h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.ds-sec b {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
}

.ds-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
}

.ds-cta .btn-primary {
  flex: 1 1 260px;
}

.ds-cta .btn .icon {
  width: 20px;
  height: 20px;
}

.ds-fine {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-3);
}

/* КП на бумаге */

.doc-pane[data-pane="kp"] {
  margin: calc(-1 * clamp(18px, 2.6vw, 36px));
  padding: clamp(18px, 2.6vw, 36px);
  min-height: calc(100% + 2 * clamp(18px, 2.6vw, 36px));
  background: var(--paper);
}

/* файлы заявки */

.df-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.df-item {
  margin: 0;
  border-radius: 14px;
  background: var(--paper);
  overflow: hidden;
}

.df-media img,
.df-media video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #000;
}

.df-media figcaption {
  padding: 9px 12px;
  font-size: 13px;
}

.df-doc {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.df-doc > .icon {
  flex: none;
  width: 28px;
  height: 28px;
  color: var(--ink-3);
}

.df-doc div {
  min-width: 0;
  flex: 1;
}

.df-doc b {
  display: block;
  font-weight: 500;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.df-doc span {
  font-size: 12px;
  color: var(--ink-3);
}

.df-doc audio {
  width: 100%;
  height: 34px;
  margin-top: 6px;
}

.df-empty {
  padding: 56px 16px;
  text-align: center;
  color: var(--ink-2);
}

.df-empty > .icon {
  width: 28px;
  height: 28px;
  color: var(--ink-3);
}

.df-empty b {
  display: block;
  margin-top: 10px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  color: var(--ink);
}

.df-empty p {
  max-width: 30em;
  margin: 6px auto 0;
  font-size: 14px;
}

.doc-pill {
  display: none;
}

/* ---------- для нас: итог с маржой и КП (стили прежнего сметчика) ---------- */

.sm-label {
  font-size: 13px;
  color: var(--ink-3);
}

.sm-summary {
  padding: 22px;
  border-radius: var(--r-lg);
  background: var(--paper);
  transition: top 0.35s var(--ease);
}

.sm-total {
  margin-top: 6px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.sm-total-sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-3);
}

.sm-lines {
  margin-top: 16px;
  font-size: 14px;
}

.sm-lines div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}

.sm-lines b {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.sm-margin {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
}

.sm-margin span {
  white-space: nowrap;
}

.sm-margin b {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.sm-margin.is-good {
  background: #e7f3ec;
  color: var(--ok);
}

.sm-margin.is-low {
  background: #fdf1df;
  color: var(--wait);
}

.sm-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.sm-facts div {
  padding: 10px 8px;
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: center;
}

.sm-facts b {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.sm-facts span {
  font-size: 12px;
  color: var(--ink-3);
}

.sm-warn {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--wait);
}

.sm-warn li {
  display: flex;
  gap: 8px;
}

.sm-warn .icon,
.sm-allok .icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.sm-allok {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--ok);
}

.sm-fine {
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-3);
}

/* ---------- КП для клиента ---------- */

.kp-section {
  padding: clamp(14px, 2.4vw, 28px);
  border-radius: var(--r-lg);
  background: var(--paper);
}

.kp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 820px;
  margin: 0 auto 16px;
}

.kp-actions p {
  font-size: 14px;
  color: var(--ink-2);
}

.kp-doc {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 30px 60px -42px rgba(19, 19, 19, 0.45);
  font-size: 14px;
}

.kp-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.kp-top .logo-mark {
  font-size: 28px;
}

.kp-req {
  text-align: right;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-3);
}

.kp-title {
  margin-top: 40px;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.03em;
}

.kp-meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-3);
}

.kp-who {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 20px;
}

.kp-who div {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--paper);
}

.kp-who span {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
}

.kp-who b {
  display: block;
  margin-top: 2px;
  font-weight: 500;
}

.kp-intro {
  max-width: 44em;
  margin-bottom: 18px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
}

.kp-table {
  width: 100%;
  border-collapse: collapse;
}

.kp-table th {
  padding: 16px 10px 8px 0;
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--ink-3);
}

.kp-table thead:first-child th {
  padding-top: 0;
}

.kp-table td {
  padding: 8px 10px 8px 0;
  border-top: 1px solid var(--line);
}

.kp-table .r {
  text-align: right;
  white-space: nowrap;
  padding-right: 0;
  padding-left: 12px;
}

.kp-total {
  width: min(360px, 100%);
  margin: 18px 0 0 auto;
}

.kp-total div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  color: var(--ink-2);
}

.kp-total b {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.kp-grand {
  margin-top: 6px;
  padding-top: 12px !important;
  border-top: 1px solid var(--line);
}

.kp-grand span,
.kp-grand b {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.kp-terms {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
}

.kp-terms li {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-2);
}

.kp-terms b {
  font-weight: 500;
  color: var(--ink);
}

.kp-foot {
  margin-top: 28px;
  font-size: 13px;
  color: var(--ink-3);
}

/* ---------- адаптив ---------- */


/* ---------- съёмка помещения ---------- */

.cam {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow: hidden;
  background: #0b0b0b;
  color: #fff;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.cam[hidden] {
  display: none;
}

.cam.is-open {
  opacity: 1;
}

.cam video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cam video.is-mirror {
  transform: scaleX(-1);
}

.cam-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0, rgba(0, 0, 0, 0) 26%, rgba(0, 0, 0, 0) 56%, rgba(0, 0, 0, 0.7) 100%);
  pointer-events: none;
}

.cam-top {
  position: absolute;
  z-index: 2;
  top: max(16px, env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cam-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.cam-icon:hover {
  background: rgba(255, 255, 255, 0.24);
}

.cam-icon .icon {
  width: 22px;
  height: 22px;
}

.cam-ghost {
  visibility: hidden;
}

.cam-timer {
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s var(--ease);
}

.cam.is-rec .cam-timer {
  background: var(--accent);
}

.cam-guide {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(max(24px, env(safe-area-inset-bottom)) + 116px);
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
}

.cam-say {
  max-width: 20em;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
  animation: msg-in 0.35s var(--ease) both;
}

.cam-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cam-steps button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

.cam-steps .is-now button {
  background: #fff;
  color: var(--ink);
}

.cam-steps .is-done button {
  color: #fff;
}

.cam-steps .icon {
  width: 14px;
  height: 14px;
}

.cam-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 52px;
}

.cam-rec {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border: 4px solid #fff;
  border-radius: 50%;
}

.cam-rec i {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  transition: width 0.25s var(--ease), height 0.25s var(--ease), border-radius 0.25s var(--ease);
}

.cam-rec:active i {
  transform: scale(0.94);
}

.cam.is-rec .cam-rec i {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.cam-error {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  background: #111;
  text-align: center;
}

.cam-error[hidden] {
  display: none;
}

.cam-error > span .icon {
  width: 40px;
  height: 40px;
  color: rgba(255, 255, 255, 0.6);
}

.cam-error b {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
}

.cam-error p {
  max-width: 26em;
  color: rgba(255, 255, 255, 0.7);
}

.cam-error .btn {
  margin-top: 8px;
}

/* на компьютере съёмка в окне поверх затемнённой страницы */
@media (min-width: 961px) {
  .cam {
    inset: 4vh 10vw;
    border-radius: 26px;
    box-shadow: 0 0 0 100vmax rgba(10, 10, 10, 0.72);
  }
}

/* ---------- телефон и планшет ---------- */

@media (max-width: 960px) {
  .chat-app {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 12px 10px;
  }

  .doc-col {
    position: fixed;
    inset: 0;
    z-index: 120;
    border-radius: 0;
    visibility: hidden;
    transform: translateY(100%);
    transition: transform 0.4s var(--ease), visibility 0.4s;
    animation: none;
  }

  .chat-app.doc-open .doc-col {
    visibility: visible;
    transform: none;
  }

  .doc-col.is-flash {
    animation: none;
  }

  .doc-top {
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .doc-close {
    display: grid;
  }

  .doc-pill {
    position: absolute;
    right: 2px;
    bottom: calc(100% + 10px);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px 0 12px;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.55);
    animation: msg-in 0.4s var(--ease) both;
  }

  .doc-pill[hidden] {
    display: none;
  }

  .doc-pill .icon {
    width: 18px;
    height: 18px;
    color: var(--accent);
  }

  .doc-pill b {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.72);
  }

  .chat-app:not(.is-empty) .chat-scroll {
    padding-bottom: 64px;
  }

  .ds-facts {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .chat-title span {
    display: none;
  }

  .chat-hello h1 {
    font-size: 34px;
  }

  .chat-hello-lead {
    font-size: 15px;
  }

  .chat-app.is-empty .composer textarea {
    min-height: 72px;
  }

  .chat-starters {
    justify-content: flex-start;
    flex-wrap: nowrap;
    margin-right: -12px;
    margin-left: -12px;
    padding: 0 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .chat-starters::-webkit-scrollbar {
    display: none;
  }

  .msg-user .msg-body {
    max-width: 92%;
  }

  .rec-card dl div {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .doc-actions .btn-sm {
    padding: 0 12px;
  }

  .cam-bottom {
    gap: 40px;
  }

  .kp-who {
    grid-template-columns: 1fr;
  }

  .kp-section {
    padding: 10px;
  }

  .kp-doc {
    padding: 20px 14px;
  }

  .kp-table th:nth-child(3),
  .kp-table td:nth-child(3) {
    display: none;
  }

  .kp-table .r {
    padding-left: 8px;
  }

  .kp-terms li {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .kp-top {
    flex-direction: column;
  }

  .kp-req {
    text-align: left;
  }

  .kp-table {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg,
  .msg-event,
  .cf,
  .doc-col,
  .doc-pane,
  .cam-say {
    animation: none !important;
  }

  .thinking {
    animation: none;
    color: var(--ink-3);
    background: none;
  }
}

/* ---------- печать: только КП ---------- */

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  html,
  body,
  main {
    background: #fff !important;
    overflow: visible !important;
  }

  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .header,
  .chat-col,
  .doc-top,
  .doc-pill,
  .cam,
  dialog,
  .toast {
    display: none !important;
  }

  .chat-app {
    display: block !important;
    height: auto !important;
    padding: 0 !important;
  }

  .doc-col {
    position: static !important;
    visibility: visible !important;
    transform: none !important;
    border-radius: 0;
    box-shadow: none !important;
    overflow: visible;
    animation: none !important;
  }

  .doc-scroll {
    overflow: visible;
    padding: 0;
  }

  .doc-pane {
    display: none !important;
  }

  .doc-pane[data-pane="kp"] {
    display: block !important;
    margin: 0;
    padding: 0;
    min-height: 0;
    background: none;
  }

  .kp-doc {
    max-width: none;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
  }

  .kp-table tr,
  .kp-terms li {
    break-inside: avoid;
  }

  /* на один лист A4 */
  .kp-doc {
    font-size: 12px;
  }

  .kp-title {
    margin-top: 22px;
    font-size: 24px;
  }

  .kp-who {
    margin: 14px 0 12px;
  }

  .kp-who div {
    padding: 8px 10px;
  }

  .kp-intro {
    margin-bottom: 10px;
    font-size: 12.5px;
  }

  .kp-table th {
    padding: 10px 10px 4px 0;
    font-size: 11px;
  }

  .kp-table td {
    padding: 4px 10px 4px 0;
  }

  .kp-total {
    margin-top: 10px;
  }

  .kp-total div {
    padding: 3px 0;
  }

  .kp-grand span,
  .kp-grand b {
    font-size: 18px;
  }

  .kp-terms {
    margin-top: 16px;
  }

  .kp-terms li {
    padding: 5px 0;
    font-size: 12px;
  }

  .kp-foot {
    margin-top: 14px;
  }
}
