#ngf-chat-btn,
#ngf-chat-window,
#ngf-chat-window * {
  box-sizing: border-box;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

#ngf-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #14295c, #0a1e4d 60%, #a98846);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(10,30,77,0.35);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
#ngf-chat-btn:hover { transform: scale(1.06); }
#ngf-chat-btn:active { transform: scale(0.96); }

#ngf-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #d3342e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #fff;
}
.ngf-hidden { display: none !important; }

@keyframes ngf-pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(169,136,70,0.55); }
  100% { box-shadow: 0 0 0 16px rgba(169,136,70,0); }
}
#ngf-chat-btn.ngf-pulse { animation: ngf-pulse-ring 0.9s ease-out; }

#ngf-chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: 92vw;
  height: 600px;
  max-height: 78vh;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
#ngf-chat-window.open {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

#ngf-chat-header {
  background: linear-gradient(120deg, #050f2b, #0a1e4d 55%, #14295c);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
#ngf-chat-header-info { display: flex; align-items: center; gap: 12px; }
#ngf-chat-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#ngf-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 11px;
  height: 11px;
  background: #34c759;
  border: 2px solid #0a1e4d;
  border-radius: 50%;
}
#ngf-chat-header-text { display: flex; flex-direction: column; line-height: 1.3; }
#ngf-chat-title { font-size: 15px; font-weight: 700; letter-spacing: 0.2px; }
#ngf-chat-status { font-size: 12px; opacity: 0.75; }

#ngf-chat-close {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#ngf-chat-close:hover { background: rgba(255,255,255,0.22); }

#ngf-chat-messages {
  flex: 1;
  padding: 16px 14px 8px;
  overflow-y: auto;
  background: #f4f5f8;
  display: flex;
  flex-direction: column;
}

.ngf-day-divider { text-align: center; margin: 6px 0 16px; }
.ngf-day-divider span {
  background: #e7e8ec;
  color: #777;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
}

.ngf-welcome { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 18px; }
.ngf-welcome-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy, #0a1e4d); color: #a98846;
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.ngf-welcome p {
  background: #fff; padding: 12px 14px; border-radius: 4px 16px 16px 16px;
  font-size: 14px; color: #1a1a1a; box-shadow: 0 1px 3px rgba(0,0,0,0.08); max-width: 80%;
}

.ngf-row { display: flex; margin-bottom: 10px; }
.ngf-row.visitor { justify-content: flex-end; }
.ngf-row.admin { justify-content: flex-start; }
.ngf-row.ngf-sending { opacity: 0.75; }

.ngf-bubble-wrap { display: flex; align-items: flex-end; gap: 8px; max-width: 84%; }

.ngf-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
}
.ngf-avatar-admin { background: var(--navy, #0a1e4d); color: #a98846; }

.ngf-bubble { padding: 10px 13px; font-size: 14px; line-height: 1.45; word-wrap: break-word; }
.ngf-bubble p { margin: 0; }

.ngf-bubble.visitor {
  background: linear-gradient(135deg, #14295c, #0a1e4d);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
}
.ngf-bubble.admin {
  background: #fff; color: #1a1a1a;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.ngf-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 4px; }
.ngf-time { font-size: 10.5px; opacity: 0.65; }
.ngf-bubble.admin .ngf-time { color: #888; }
.ngf-ticks { display: flex; align-items: center; }
.ngf-tick { display: block; }
.ngf-tick-sent, .ngf-tick-delivered { color: rgba(255,255,255,0.65); }
.ngf-tick-read { color: #4fc3f7; }

#ngf-typing-row {
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px 10px; flex-shrink: 0; background: #f4f5f8;
}
.ngf-typing-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--navy, #0a1e4d); color: #a98846;
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ngf-typing-bubble {
  background: #fff; border-radius: 16px; padding: 10px 14px;
  display: flex; gap: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.ngf-typing-bubble span {
  width: 6px; height: 6px; background: #aab0bd; border-radius: 50%;
  animation: ngf-typing-bounce 1.2s infinite ease-in-out;
}
.ngf-typing-bubble span:nth-child(2) { animation-delay: 0.15s; }
.ngf-typing-bubble span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ngf-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

#ngf-chat-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; background: #fff; border-top: 1px solid #eee; flex-shrink: 0;
}
#ngf-chat-input {
  flex: 1; border: 1px solid #e2e3e8; background: #f4f5f8;
  border-radius: 22px; padding: 12px 16px; font-size: 16px; outline: none; color: #1a1a1a;
}
#ngf-chat-input:focus { border-color: var(--navy, #0a1e4d); background: #fff; }

#ngf-chat-send {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #14295c, #0a1e4d);
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: transform 0.12s ease;
}
#ngf-chat-send:hover { transform: scale(1.06); }
#ngf-chat-send:active { transform: scale(0.94); }

#ngf-chat-messages::-webkit-scrollbar { width: 5px; }
#ngf-chat-messages::-webkit-scrollbar-thumb { background: #d4d6dc; border-radius: 3px; }

@media (max-width: 900px) {
  #ngf-chat-window { width: 380px; height: 620px; }
}

@media (max-width: 480px) {
  #ngf-chat-btn { width: 58px; height: 58px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); right: 18px; }
  #ngf-chat-window {
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; border-radius: 0;
  }
  #ngf-chat-header { padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  #ngf-chat-title { font-size: 16px; }
  #ngf-chat-status { font-size: 12.5px; }
  #ngf-chat-avatar { width: 42px; height: 42px; }
  #ngf-chat-close { width: 36px; height: 36px; }
  #ngf-chat-messages { padding: 16px; }
  .ngf-bubble { font-size: 15px; padding: 11px 14px; }
  .ngf-bubble-wrap { max-width: 88%; }
  .ngf-avatar { width: 30px; height: 30px; font-size: 12px; }
  #ngf-chat-input-row { padding: 12px 14px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  #ngf-chat-input { padding: 13px 16px; font-size: 16px; }
  #ngf-chat-send { width: 46px; height: 46px; }
}