/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: none;
  background: var(--btn-bg);
  color: var(--btn-fg);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease,
    background-color 0.15s ease;
}
.btn:hover {
  background: var(--btn-bg-hover);
}
.btn:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--accent) 30%, #fff);
  outline-offset: 2px;
}
.btn--ghost {
  background: var(--btn-outline-bg);
  color: var(--btn-outline-fg);
  border: 1px solid var(--btn-outline-br);
}
.btn--accent {
  background: var(--accent-contrast);
}
.btn-reset {
  background: none;
  border: 0;
  color: var(--clr-text);
}

/* Анимации уважительно к «предпочтениям» */
@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}

.tg-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
}

/* FAB */
.tg-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  display: grid;
  place-items: center;
}
.tg-fab__icon {
  width: 26px;
  height: 26px;
  display: block;
}

/* Popup base */
.tg-popup {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 320px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  overflow: hidden;

  transform: translateY(8px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

/* scale + fade */
.tg-popup.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Header */
.tg-popup__header {
  display: flex;
  align-items: center;
  padding: 14px 14px 12px;
  gap: 12px;
}
.tg-popup__brand {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #f2f7ff;
  display: grid;
  place-items: center;
}
.tg-popup__logo {
  width: 22px;
  height: 22px;
  display: block;
}

.tg-popup__meta {
  flex: 1;
  min-width: 0;
}
.tg-popup__name {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tg-popup__sub {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #666;
  font-size: 13px;
}
.tg-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2ecc71;
  display: inline-block;
}

.tg-popup__close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: #111;
}

/* Body */
.tg-popup__body {
  padding: 0 14px 14px;
}
.tg-popup__status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.tg-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.tg-badge--online {
  background: rgba(46, 204, 113, 0.12);
  color: #1e9e55;
}
.tg-muted {
  font-size: 12px;
  color: #777;
}

.tg-popup__text {
  margin: 0;
  color: #333;
  font-size: 14px;
  line-height: 1.35;
}

/* Footer */
.tg-popup__footer {
  padding: 12px 14px 14px;
}
.tg-popup__btn {
  display: block;
  text-align: center;
  background: #2aabee;
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
}
.tg-popup__btn:hover {
  filter: brightness(0.98);
}

/* Mobile safe */
@media (max-width: 420px) {
  .tg-popup {
    width: calc(100vw - 48px);
  }
}
