/* DOORSTIL — чат с клиенти */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 120;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 18px; border: 0; border-radius: 40px;
  background: var(--green, #255c56); color: #fff; font-weight: 600; font-size: 13px;
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, .55); cursor: pointer;
  font-family: var(--display, sans-serif);
  transition: transform .2s ease, background .2s ease;
}
.chat-fab:hover { background: #1c4741; transform: translateY(-2px); }
.chat-fab.is-hidden { display: none; }
.chat-fab-label { letter-spacing: .04em; }
.chat-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--gold, #c9a227); color: #14100a; border-radius: 20px;
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
}

.chat {
  position: fixed; right: 22px; bottom: 22px; z-index: 130;
  width: 360px; max-width: calc(100vw - 24px); height: 540px; max-height: calc(100vh - 40px);
  background: #fff; border: 1px solid var(--line, #e9e9e9); border-radius: 14px;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; overflow: hidden;
  font-family: var(--display, sans-serif);
}
.chat[hidden] { display: none; }

.chat-head {
  background: #070707; color: #fff; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.chat-id { display: flex; align-items: center; gap: 10px; }
.chat-avatar {
  width: 34px; height: 34px; border: 1.5px solid var(--gold, #c9a227); color: var(--gold, #c9a227);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; letter-spacing: .05em;
}
.chat-id b { display: block; font-size: 13px; letter-spacing: .14em; }
.chat-id small { display: block; font-size: 10.5px; color: #9fdcbf; margin-top: 2px; }
.chat-id small.is-off { color: #c9a227; }
.chat-x { border: 0; background: transparent; color: #cfcfcf; font-size: 16px; line-height: 1; padding: 6px; }
.chat-x:hover { color: #fff; }

.chat-body { flex: 1; overflow-y: auto; padding: 16px; background: #faf8f4; display: flex; flex-direction: column; gap: 10px; }
.chat-hint { font-size: 12.5px; line-height: 1.6; color: #6b6b6b; background: #fff; border: 1px solid var(--line, #e9e9e9); padding: 12px 14px; border-radius: 10px; }
.chat-msg { display: flex; flex-direction: column; gap: 3px; max-width: 86%; }
.chat-msg.me { align-self: flex-end; align-items: flex-end; }
.chat-msg.op { align-self: flex-start; }
.chat-bubble { padding: 10px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.chat-msg.me .chat-bubble { background: var(--green, #255c56); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.op .chat-bubble { background: #fff; border: 1px solid var(--line, #e9e9e9); color: #242424; border-bottom-left-radius: 4px; }
.chat-time { font-size: 10px; color: #9a9a9a; }
.chat-error { font-size: 11.5px; color: #b3261e; }
.chat-closed { align-self: center; text-align: center; font-size: 12px; color: #767676; display: grid; gap: 8px; }
.chat-closed .btn { justify-self: center; }

.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line, #e9e9e9); background: #fff; }
.chat-form textarea {
  flex: 1; resize: none; border: 1px solid var(--line, #e9e9e9); border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: 13.5px; max-height: 90px; min-height: 42px;
}
.chat-form textarea:focus { outline: 2px solid var(--green, #255c56); outline-offset: 1px; }
.chat-send {
  width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--green, #255c56); color: #fff;
  display: grid; place-items: center; flex-shrink: 0;
}
.chat-send:hover { background: #1c4741; }
.chat-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.chat-foot { padding: 8px 12px 12px; border-top: 1px solid var(--line, #e9e9e9); background: #fff; }
.chat-link { border: 0; background: transparent; color: var(--green, #255c56); font-size: 12px; font-weight: 600; padding: 4px 0; }
.chat-link:hover { color: var(--gold, #c9a227); }
.chat-contact { display: grid; gap: 8px; padding-top: 8px; }
.chat-contact[hidden] { display: none; }
.chat-contact-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chat-contact input {
  border: 1px solid var(--line, #e9e9e9); border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 13px; width: 100%;
}
.chat-contact-actions { display: grid; gap: 6px; }
.chat-contact-actions .btn { width: 100%; }
.chat-link.is-done { color: #2f7a4f; cursor: default; }
.chat-contact-actions small { font-size: 11.5px; color: #2f7a4f; }
.chat-legal { margin: 8px 0 0; font-size: 10.5px; color: #9a9a9a; }
.chat-legal a { border-bottom: 1px solid currentColor; }

@media (max-width: 760px) {
  .chat-fab { right: 14px; bottom: 14px; padding: 12px 16px; }
  .chat-fab-label { display: none; }
  .chat { right: 0; bottom: 0; width: 100%; max-width: none; height: 88vh; max-height: 88vh; border-radius: 14px 14px 0 0; }
  .chat-contact-row { grid-template-columns: 1fr; }
}
