#nita-support-root,
#nita-support-root * {
  box-sizing: border-box;
}

#nita-support-root {
  --nita-chat-blue: #1459a6;
  --nita-chat-blue-dark: #0b3f7c;
  --nita-chat-yellow: #f0bd38;
  --nita-chat-ink: #182536;
  --nita-chat-muted: #687487;
  --nita-chat-line: #dce3ec;
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  letter-spacing: 0;
}

#nita-support-root [hidden] {
  display: none !important;
}

.nita-support-launcher {
  position: fixed;
  right: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 999998;
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: var(--nita-chat-blue);
  color: #fff;
  box-shadow: 0 12px 28px rgba(13, 57, 105, 0.28);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.nita-support-launcher.has-unread {
  background: #b42318;
  animation: nita-support-pulse 1.8s ease-in-out infinite;
}

.nita-support-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  padding: 0 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #d92d20;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

@keyframes nita-support-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.nita-support-launcher:hover {
  background: var(--nita-chat-blue-dark);
}

.nita-support-launcher:focus-visible,
.nita-support-panel button:focus-visible,
.nita-support-panel input:focus-visible,
.nita-support-panel textarea:focus-visible {
  outline: 3px solid var(--nita-chat-yellow);
  outline-offset: 2px;
}

.nita-support-launcher-icon {
  font-size: 20px;
  line-height: 1;
}

.nita-support-panel {
  position: fixed;
  right: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 999999;
  display: none;
  width: min(390px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 44px));
  overflow: hidden;
  border: 1px solid var(--nita-chat-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(16, 38, 64, 0.28);
  color: var(--nita-chat-ink);
}

.nita-support-panel.is-open {
  display: flex;
  flex-direction: column;
}

.nita-support-header {
  position: static;
  display: flex;
  width: auto;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--nita-chat-blue);
  color: #fff;
}

.nita-support-heading {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 11px;
}

.nita-support-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 6px;
  background: #fff;
  color: var(--nita-chat-blue);
  font-weight: 800;
}

.nita-support-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.nita-support-presence {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.88;
}

.nita-support-close {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 24px;
}

.nita-support-sound,
.nita-support-end {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
}

.nita-support-screen {
  display: none;
  min-height: 0;
  flex: 1;
}

.nita-support-screen.is-active {
  display: flex;
  flex-direction: column;
}

.nita-support-start {
  overflow-y: auto;
  padding: 22px 18px;
}

.nita-support-intro {
  margin: 0 0 18px;
  color: var(--nita-chat-muted);
  font-size: 14px;
  line-height: 1.55;
}

.nita-support-field {
  display: block;
  margin-bottom: 14px;
}

.nita-support-field span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

.nita-support-field input,
.nita-support-compose textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: var(--nita-chat-ink);
  font: inherit;
}

.nita-support-field input {
  height: 44px;
  padding: 0 12px;
}

.nita-support-privacy {
  margin: 2px 0 16px;
  color: var(--nita-chat-muted);
  font-size: 12px;
  line-height: 1.45;
}

.nita-support-primary,
.nita-support-send {
  border: 0;
  border-radius: 6px;
  background: var(--nita-chat-blue);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.nita-support-primary {
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
}

.nita-support-primary:disabled,
.nita-support-send:disabled {
  cursor: wait;
  opacity: 0.65;
}

.nita-support-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: #b42318;
  font-size: 13px;
}

.nita-support-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5f7fa;
}

.nita-support-message {
  display: flex;
  margin-bottom: 11px;
}

.nita-support-message.customer {
  justify-content: flex-end;
}

.nita-support-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border: 1px solid var(--nita-chat-line);
  border-radius: 7px;
  background: #fff;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.nita-support-agent-name {
  display: block;
  margin-bottom: 5px;
  color: var(--nita-chat-blue-dark);
  font-size: 11px;
}

.nita-support-message.customer .nita-support-bubble {
  border-color: var(--nita-chat-blue);
  background: var(--nita-chat-blue);
  color: #fff;
}

.nita-support-message.system .nita-support-bubble {
  max-width: 100%;
  border: 0;
  background: transparent;
  color: var(--nita-chat-muted);
  font-size: 12px;
  text-align: center;
}

.nita-support-message-meta {
  display: flex;
  min-height: 15px;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 5px;
}

.nita-support-time {
  font-size: 10px;
  opacity: 0.7;
}

.nita-support-receipt {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.nita-support-receipt.is-read {
  color: #7dd3fc;
}

.nita-support-message.system .nita-support-message-meta {
  justify-content: center;
}

.nita-support-typing {
  min-height: 24px;
  padding: 4px 16px;
  background: #f5f7fa;
  color: var(--nita-chat-muted);
  font-size: 12px;
}

.nita-support-compose {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 9px;
  padding: 12px;
  border-top: 1px solid var(--nita-chat-line);
}

.nita-support-compose textarea {
  min-height: 46px;
  max-height: 110px;
  resize: none;
  padding: 11px;
}

.nita-support-send {
  width: 46px;
  height: 46px;
  font-size: 20px;
}

.nita-support-expired {
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
}

.nita-support-closed-notice {
  padding: 16px;
  border-top: 1px solid var(--nita-chat-line);
  background: #fff7ed;
  text-align: center;
}

.nita-support-closed-notice strong {
  color: #9a3412;
}

.nita-support-closed-notice p {
  margin: 6px 0 14px;
  color: var(--nita-chat-muted);
  font-size: 13px;
  line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
  .nita-support-launcher.has-unread {
    animation: none;
  }
}

.nita-support-expired h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.nita-support-expired p {
  margin: 0 0 18px;
  color: var(--nita-chat-muted);
  line-height: 1.5;
}

@media (max-width: 600px) {
  .nita-support-launcher {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: 52px;
    padding: 0;
    justify-content: center;
  }

  .nita-support-launcher-label {
    display: none;
  }

  .nita-support-panel {
    right: 7px;
    bottom: calc(7px + env(safe-area-inset-bottom));
    width: calc(100vw - 14px);
    height: calc(100dvh - 14px);
  }
}
