/* Виджет чата поддержки Tecnt VPN (единый протокол /api/chat/* с Telegram-группой поддержки). */
.ntchat {
  --c-bg: #080b13;
  --c-panel: #101624;
  --c-card: #172035;
  --c-line: rgba(242, 196, 90, 0.24);
  --c-ink: #f3f6fc;
  --c-muted: #8e9cb6;
  --c-gold: #f2c45a;
  --c-teal: #2dd4bf;
  --c-grad: linear-gradient(135deg, #f2c45a 0%, #d49a24 100%);
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 95;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  color: var(--c-ink);
}
[data-theme="light"] .ntchat {
  --c-bg: #f4f7fb;
  --c-panel: #ffffff;
  --c-card: #edf2f8;
  --c-line: rgba(15, 23, 42, 0.14);
  --c-ink: #0f172a;
  --c-muted: #55637a;
}
.ntchat[hidden] { display: none; }

.ntchat-fab {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--c-grad);
  color: #0b0e15;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(242, 196, 90, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.26) inset;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ntchat-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 36px rgba(242, 196, 90, 0.48), 0 0 0 1px rgba(255, 255, 255, 0.36) inset;
}
.ntchat-fab:focus-visible { outline: 3px solid var(--c-teal); outline-offset: 4px; }
.ntchat-fab.is-calling::before,
.ntchat-fab.is-calling::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(242, 196, 90, 0.7);
  pointer-events: none;
  opacity: 0;
  animation: ntchat-wave 3s ease-out infinite;
}
.ntchat-fab.is-calling::after { animation-delay: 1.5s; }
.ntchat-fab.is-unread::before,
.ntchat-fab.is-unread::after { border-color: var(--c-teal); animation-duration: 1.6s; }
.ntchat-fab.is-unread::after { animation-delay: 0.8s; }
@keyframes ntchat-wave {
  0% { transform: scale(1); opacity: 0.85; }
  70% { transform: scale(1.72); opacity: 0; }
  100% { transform: scale(1.72); opacity: 0; }
}
.ntchat-fab svg { width: 27px; height: 27px; }
.ntchat-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--c-teal);
  color: #061414;
  font-size: 12px;
  font-weight: 800;
  border: 2px solid #080b13;
}
.ntchat-badge[hidden] { display: none; }
.ntchat.is-open .ntchat-fab { visibility: hidden; }

.ntchat-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 390px;
  height: min(620px, calc(100dvh - 44px));
  background: var(--c-panel);
  border: 1px solid var(--c-line);
  border-radius: 22px;
  box-shadow: 0 24px 68px rgba(0, 0, 0, 0.58);
  overflow: hidden;
  animation: ntchat-in 0.2s ease-out;
}
.ntchat-panel[hidden] { display: none; }
@keyframes ntchat-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.ntchat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px 14px 16px;
  border-bottom: 1px solid var(--c-line);
  background: linear-gradient(135deg, rgba(242, 196, 90, 0.16), rgba(45, 212, 191, 0.08));
}
.ntchat-logo {
  position: relative;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--c-grad);
  color: #0b0e15;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 17px;
  box-shadow: 0 6px 16px rgba(242, 196, 90, 0.3);
}
.ntchat-who { display: grid; gap: 2px; flex: 1; min-width: 0; }
.ntchat-name { font-weight: 800; font-size: 15.5px; line-height: 1.2; }
.ntchat-status { font-size: 12px; color: var(--c-muted); display: inline-flex; align-items: center; gap: 6px; }
.ntchat-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-teal);
  flex: none;
}
.ntchat .ntchat-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: none;
  color: var(--c-ink);
  cursor: pointer;
}
.ntchat .ntchat-close:hover { background: rgba(255, 255, 255, 0.09); }

.ntchat-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 15px 14px;
  background: var(--c-bg);
  scrollbar-width: thin;
  scrollbar-color: var(--c-line) transparent;
}
.ntchat-list { display: grid; gap: 10px; }
.ntchat-day {
  justify-self: center;
  padding: 3px 11px;
  border-radius: 20px;
  background: var(--c-card);
  border: 1px solid var(--c-line);
  font-size: 11.5px;
  color: var(--c-muted);
}
.ntchat-msg {
  max-width: 85%;
  padding: 10px 13px 7px;
  border-radius: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14.5px;
  line-height: 1.48;
}
.ntchat-msg--out {
  justify-self: start;
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-bottom-left-radius: 5px;
}
.ntchat-msg--in {
  justify-self: end;
  background: var(--c-grad);
  color: #0b0e15;
  font-weight: 500;
  border-bottom-right-radius: 5px;
}
.ntchat-author { display: block; margin-bottom: 2px; font-size: 11.5px; font-weight: 800; color: var(--c-gold); }
.ntchat-time { display: block; margin-top: 3px; font-size: 11px; opacity: 0.65; text-align: right; }
.ntchat-msg img { display: block; max-width: 100%; max-height: 230px; margin-bottom: 5px; border-radius: 10px; }
.ntchat-file { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.ntchat-contact {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: var(--c-card);
  border: 1px dashed rgba(242, 196, 90, 0.48);
  font-size: 13.5px;
}
.ntchat-contact[hidden] { display: none; }
.ntchat-contact p { margin: 0; color: var(--c-muted); }
.ntchat .ntchat-contact input {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--c-line);
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  background: var(--c-bg);
  color: var(--c-ink);
}
.ntchat .ntchat-contact input:focus { border-color: var(--c-gold); outline: none; }
.ntchat .ntchat-contact button {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 16px;
  border: 0;
  border-radius: 11px;
  background: var(--c-grad);
  color: #0b0e15;
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}

.ntchat-foot {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--c-line);
  background: var(--c-panel);
}
.ntchat-consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.4;
  color: var(--c-muted);
  cursor: pointer;
}
.ntchat-consent[hidden] { display: none; }
.ntchat .ntchat-consent input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--c-gold); }
.ntchat-consent a { color: var(--c-gold); text-decoration: underline; }
.ntchat-error { margin: 0; font-size: 12.5px; color: #f87171; }
.ntchat-error[hidden] { display: none; }
.ntchat-form { display: flex; gap: 8px; align-items: flex-end; }
.ntchat-attach,
.ntchat .ntchat-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  cursor: pointer;
}
.ntchat-attach { position: relative; border: 1px solid var(--c-line); color: var(--c-muted); }
.ntchat-attach:hover { color: var(--c-ink); border-color: var(--c-gold); }
.ntchat-attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ntchat .ntchat-send { border: 0; background: var(--c-grad); color: #0b0e15; }
.ntchat .ntchat-send:disabled { opacity: 0.45; cursor: not-allowed; }
.ntchat .ntchat-form textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 132px;
  margin: 0;
  padding: 11px 12px;
  resize: none;
  overflow-y: hidden;
  border: 1px solid var(--c-line);
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  background: var(--c-bg);
  color: var(--c-ink);
}
.ntchat .ntchat-form textarea::placeholder { color: var(--c-muted); }
.ntchat .ntchat-form textarea:focus { border-color: var(--c-gold); outline: none; }
.ntchat-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ntchat-hint {
  position: absolute;
  right: 0;
  bottom: 72px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: max-content;
  max-width: 268px;
  padding: 11px 8px 11px 14px;
  background: var(--c-panel);
  border: 1px solid var(--c-line);
  border-radius: 15px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  animation: ntchat-hint-in 0.3s ease-out;
}
.ntchat-hint-text {
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.38;
}
.ntchat-hint-text:hover { color: var(--c-gold); }
.ntchat-hint-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: -3px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-muted);
  cursor: pointer;
}
.ntchat-hint[hidden] { display: none; }
.ntchat.is-open .ntchat-hint { display: none; }
@keyframes ntchat-hint-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .ntchat { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
  .ntchat-fab { width: 56px; height: 56px; }
  .ntchat-fab svg { width: 25px; height: 25px; }
  .ntchat.is-open { inset: 0; }
  .ntchat-panel {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--ntchat-top, 0px);
    bottom: auto;
    width: auto;
    height: var(--ntchat-h, 100dvh);
    border: 0;
    border-radius: 0;
    animation-name: ntchat-up;
    animation-duration: 0.24s;
  }
  .ntchat-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .ntchat-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .ntchat .ntchat-form textarea,
  .ntchat .ntchat-contact input { font-size: 16px; }
  .ntchat-hint { bottom: 68px; max-width: min(250px, calc(100vw - 28px)); }
}

@keyframes ntchat-up {
  from { transform: translateY(100%); }
  to { transform: none; }
}
html.ntchat-locked, html.ntchat-locked body { overflow: hidden; }
html.ntchat-locked body { position: fixed; left: 0; right: 0; width: 100%; }

@media (prefers-reduced-motion: reduce) {
  .ntchat-panel, .ntchat-hint { animation: none; }
  .ntchat-fab { transition: none; }
  .ntchat-fab.is-calling::before, .ntchat-fab.is-calling::after { animation: none; }
}
