
/* Step 66: stable user chat pins without flicker */
.nik65-chat-card {
  position: relative !important;
  isolation: isolate;
  overflow: visible !important;
  min-width: 0 !important;
  contain: layout paint;
  padding-right: 48px !important;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease !important;
}

.nik65-chat-card.nik65-is-pinned {
  border-color: rgba(14, 165, 233, .38) !important;
  box-shadow: 0 16px 42px rgba(14, 165, 233, .12), inset 0 1px 0 rgba(255,255,255,.58) !important;
}

.nik65-chat-card.nik65-menu-open {
  border-color: rgba(14, 165, 233, .48) !important;
  box-shadow: 0 18px 46px rgba(14, 165, 233, .15), inset 0 1px 0 rgba(255,255,255,.62) !important;
}

.nik65-pin-badge {
  position: absolute;
  top: 18px;
  right: 48px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 92px;
  height: 22px;
  border-radius: 999px;
  background: rgba(224, 242, 254, .94);
  color: #0369a1;
  border: 1px solid rgba(14, 165, 233, .18);
  padding: 0 8px;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
}

.nik65-more {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 8;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  max-width: 32px;
  max-height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(125, 180, 255, .35);
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #075985;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  opacity: 1;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.nik65-more:hover {
  background: rgba(37, 139, 255, .12);
  border-color: rgba(37, 139, 255, .45);
  color: #075985;
}

.nik65-more:active {
  background: rgba(37, 139, 255, .18);
}

.nik65-more:focus-visible {
  outline: 2px solid rgba(37, 139, 255, .45);
  outline-offset: 2px;
}

#nik65-chat-context-menu {
  position: fixed;
  z-index: 9999;
  display: none;
  min-width: 190px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(125, 180, 255, .32);
  box-shadow: 0 18px 50px rgba(35, 93, 150, .18);
  color: #16243a;
  pointer-events: auto;
}

#nik65-chat-context-menu.is-open {
  display: block;
  animation: nik65MenuPop .12s ease both;
}

.nik65-menu-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #16243a;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  transition: background 160ms ease;
}

.nik65-menu-item:hover,
.nik65-menu-item:focus-visible {
  background: rgba(37, 139, 255, .12);
  outline: none;
}

.nik65-menu-item:disabled {
  opacity: .62;
  cursor: wait;
}

.nik65-menu-item span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  border-radius: 9px;
  background: rgba(224, 242, 254, .88);
}

.nik65-menu-item b {
  font-size: 13px;
  font-weight: 900;
}

#nik65-chat-pin-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10000;
  display: none;
  max-width: min(420px, calc(100vw - 32px));
  border: 1px solid rgba(125,211,252,.45);
  border-radius: 20px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 80px rgba(15,23,42,.18);
  color: #0f172a;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 850;
}

#nik65-chat-pin-toast.is-visible {
  display: block;
}

@keyframes nik65MenuPop {
  from { opacity: 0; transform: translateY(4px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
  .nik65-chat-card {
    padding-right: 52px !important;
  }

  .nik65-more {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    max-width: 34px;
    max-height: 34px;
  }

  .nik65-pin-badge {
    top: 16px;
    right: 52px;
  }
}
