.telegram-link-trigger {
  border: 1px solid #cbd8e2;
  background: #fff;
  color: #17324d;
  cursor: pointer;
  font: inherit;
  transition: 0.16s ease;
}

.telegram-link-trigger:hover {
  border-color: #229ed9;
  color: #167cad;
  background: #f5fbfe;
}

.telegram-link-trigger svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
}

.telegram-link-trigger i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d28718;
  flex: 0 0 auto;
}

.telegram-link-trigger.linked i {
  background: #168565;
}

.telegram-link-sidebar {
  width: 100%;
  min-height: 43px;
  border-radius: 13px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: right;
  font-weight: 700;
}

.telegram-link-sidebar span {
  flex: 1;
}

.telegram-link-driver {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: inline-grid;
  place-items: center;
  margin-inline-start: auto;
  margin-inline-end: 7px;
  flex: 0 0 auto;
}

.telegram-link-driver span {
  display: none;
}

.telegram-link-driver i {
  position: absolute;
  width: 8px;
  height: 8px;
  top: 6px;
  left: 6px;
  border: 2px solid #fff;
}

.telegram-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(13, 31, 46, 0.62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.telegram-modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
  padding: 20px;
  color: #1d2d3c;
}

.telegram-modal > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 15px;
  margin-bottom: 16px;
  border-bottom: 1px solid #dfe6eb;
}

.telegram-modal > header span {
  color: #6c7b88;
  font-size: 11px;
  font-weight: 800;
}

.telegram-modal > header h2 {
  margin: 4px 0 0;
  font-size: 21px;
}

.telegram-close {
  width: 39px;
  height: 39px;
  border: 1px solid #dfe6eb;
  border-radius: 12px;
  background: #fff;
  color: #526574;
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}

.telegram-account-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px;
  border: 1px solid #dfe6eb;
  border-radius: 17px;
  background: #f7f9fb;
}

.telegram-account-card.linked {
  border-color: #b9e0d4;
  background: #edf8f4;
}

.telegram-account-icon {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: #229ed9;
}

.telegram-account-icon svg {
  width: 25px;
  height: 25px;
}

.telegram-account-card strong,
.telegram-account-card small,
.telegram-account-card em {
  display: block;
}

.telegram-account-card small {
  margin-top: 5px;
  color: #6c7b88;
  font-size: 11px;
}

.telegram-account-card em {
  margin-top: 6px;
  color: #168565;
  font-size: 11px;
  font-style: normal;
  direction: ltr;
  text-align: right;
}

.telegram-primary-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  margin-top: 13px;
}

.telegram-action {
  min-height: 44px;
  border-radius: 13px;
  padding: 0 15px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.telegram-action svg {
  width: 19px;
  height: 19px;
}

.telegram-action.primary {
  background: #229ed9;
  color: #fff;
}

.telegram-action.secondary {
  border-color: #cbd8e2;
  background: #fff;
  color: #17324d;
}

.telegram-action.danger {
  background: #fff2f2;
  border-color: #edcccc;
  color: #a83939;
}

.telegram-action:disabled,
.telegram-mini-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.telegram-modal-notice {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 11px;
  line-height: 1.7;
}

.telegram-modal-notice.info {
  color: #245b7b;
  background: #edf6fb;
}

.telegram-modal-notice.success {
  color: #146b53;
  background: #eaf7f2;
}

.telegram-modal-notice.error {
  color: #963636;
  background: #fff0f0;
}

.telegram-users-details {
  margin-top: 15px;
  border: 1px solid #dfe6eb;
  border-radius: 15px;
  overflow: hidden;
}

.telegram-users-details summary {
  min-height: 47px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #17324d;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
}

.telegram-users-details summary::-webkit-details-marker {
  display: none;
}

.telegram-users-details summary b {
  margin-right: auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf2f6;
  font-size: 10px;
}

.telegram-users-list {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #dfe6eb;
  background: #fafbfd;
}

.telegram-user-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 8px 9px;
  border: 1px solid #e3e9ed;
  border-radius: 12px;
  background: #fff;
}

.telegram-user-main strong,
.telegram-user-main small {
  display: block;
}

.telegram-user-main strong {
  font-size: 12px;
}

.telegram-user-main small {
  margin-top: 4px;
  color: #6c7b88;
  font-size: 9px;
}

.telegram-user-state {
  color: #8b6a2b;
  font-size: 9px;
  white-space: nowrap;
}

.telegram-user-state.linked {
  color: #168565;
}

.telegram-mini-button {
  min-height: 31px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid #dfe6eb;
  background: #fff;
  font: inherit;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.telegram-mini-button.danger {
  color: #a83939;
}

.telegram-loading {
  padding: 32px 12px;
  text-align: center;
  color: #6c7b88;
  font-size: 12px;
}

@media (max-width: 620px) {
  .telegram-modal-backdrop {
    padding: 0;
    align-items: end;
  }

  .telegram-modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
    padding: 17px;
  }

  .telegram-primary-actions {
    grid-template-columns: 1fr;
  }

  .telegram-user-row {
    grid-template-columns: minmax(110px, 1fr) auto;
  }

  .telegram-user-row .telegram-mini-button {
    grid-column: 1 / -1;
  }
}
