.ns-chat-widget,
.ns-chat-widget * {
  box-sizing: border-box;
}

.ns-chat-widget {
  --ns-chat-accent: #075ee8;
  --ns-chat-accent-hover: #064fc4;
  --ns-chat-border: #dbe5f1;
  --ns-chat-focus: #005fcc;
  --ns-chat-muted: #5b6b82;
  --ns-chat-surface: #ffffff;
  --ns-chat-text: #0f1f38;
  color-scheme: light;
  font-family: Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ns-chat-launcher {
  align-items: center;
  background: var(--ns-chat-accent);
  border: 0;
  border-radius: 999px;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 16px 42px rgba(7, 94, 232, 0.32);
  color: #fff;
  cursor: pointer;
  display: inline-flex !important;
  font: inherit;
  font-size: 0.925rem;
  font-weight: 800;
  gap: 0.55rem;
  height: 3.25rem !important;
  justify-content: center;
  line-height: 1;
  padding: 0 1.05rem !important;
  position: fixed !important;
  right: calc(1.25rem + env(safe-area-inset-right, 0px));
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  width: auto !important;
  z-index: 1000 !important;
}

body #nsChatWidget.ns-chat-widget[data-open="true"] #chatTrigger {
  display: none !important;
}

.ns-chat-launcher:hover {
  background: var(--ns-chat-accent-hover);
  box-shadow: 0 18px 48px rgba(7, 94, 232, 0.4);
  transform: translateY(-2px);
}

.ns-chat-launcher:focus-visible,
.ns-chat-close:focus-visible,
.ns-chat-state button:focus-visible {
  outline: 3px solid var(--ns-chat-focus);
  outline-offset: 3px;
}

.ns-chat-launcher svg {
  fill: none;
  height: 1.35rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 1.35rem;
}

.ns-chat-launcher svg path:last-child {
  fill: currentColor;
  stroke: none;
}

.ns-chat-panel {
  background: var(--ns-chat-surface);
  border: 1px solid var(--ns-chat-border);
  border-radius: 1rem;
  bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 28px 80px rgba(15, 31, 56, 0.24);
  color: var(--ns-chat-text);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 7rem);
  height: min(44rem, calc(100dvh - 7rem));
  max-height: calc(100vh - 7rem);
  overflow: hidden;
  position: fixed;
  right: calc(1.25rem + env(safe-area-inset-right, 0px));
  width: min(26rem, calc(100vw - 2rem));
  z-index: 1100;
}

.ns-chat-panel[hidden] {
  display: none !important;
}

.ns-chat-panel__header {
  align-items: flex-start;
  background: var(--ns-chat-surface);
  border-bottom: 1px solid var(--ns-chat-border);
  display: flex;
  flex: 0 0 auto;
  gap: 0.75rem;
  justify-content: space-between;
  padding: 0.95rem 1rem 0.9rem;
}

.ns-chat-panel__header h2 {
  color: var(--ns-chat-text);
  font-family: Ubuntu, Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
  margin: 0;
}

.ns-chat-panel__header p {
  color: var(--ns-chat-muted);
  font-size: 0.75rem;
  line-height: 1.4;
  margin: 0.2rem 0 0;
  max-width: 20rem;
}

.ns-chat-close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0.5rem;
  color: var(--ns-chat-muted);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  height: 2.25rem;
  justify-content: center;
  margin: -0.25rem -0.25rem 0 0;
  padding: 0;
  width: 2.25rem;
}

.ns-chat-close:hover {
  background: #eff5fd;
  color: var(--ns-chat-text);
}

.ns-chat-close svg {
  fill: none;
  height: 1.25rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
  width: 1.25rem;
}

.ns-chat-panel__body {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.ns-chat-host {
  grid-area: 1 / 1;
  min-height: 0;
}

.ns-chat-host openai-chatkit {
  display: block;
  height: 100%;
  min-height: 0;
  width: 100%;
}

.ns-chat-state {
  align-items: center;
  align-self: center;
  background: var(--ns-chat-surface);
  background: color-mix(in srgb, var(--ns-chat-surface) 94%, transparent);
  border: 1px solid var(--ns-chat-border);
  border-radius: 0.75rem;
  box-shadow: 0 14px 40px rgba(15, 31, 56, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  grid-area: 1 / 1;
  justify-self: center;
  max-width: calc(100% - 2rem);
  padding: 1rem 1.2rem;
  text-align: center;
  z-index: 2;
}

.ns-chat-state[hidden] {
  display: none;
}

.ns-chat-state p {
  color: var(--ns-chat-muted);
  font-size: 0.875rem;
  line-height: 1.45;
  margin: 0;
}

.ns-chat-state[data-error="true"] p {
  color: #b42318;
}

.ns-chat-state button {
  background: var(--ns-chat-accent);
  border: 0;
  border-radius: 0.55rem;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.65rem 0.9rem;
}

.ns-chat-state button:hover {
  background: var(--ns-chat-accent-hover);
}

.ns-chat-spinner {
  animation: ns-chat-spin 800ms linear infinite;
  border: 3px solid #dbeafe;
  border-radius: 50%;
  border-top-color: var(--ns-chat-accent);
  height: 1.65rem;
  width: 1.65rem;
}

.ns-chat-state[data-error="true"] .ns-chat-spinner {
  display: none;
}

html.dark .ns-chat-widget,
html[data-ns-theme="dark"] .ns-chat-widget,
html[data-lp-theme="dark"] .ns-chat-widget {
  --ns-chat-accent: #00adef;
  --ns-chat-accent-hover: #22bdf5;
  --ns-chat-border: #334155;
  --ns-chat-focus: #6cddff;
  --ns-chat-muted: #a9b7ca;
  --ns-chat-surface: #0f172a;
  --ns-chat-text: #f8fafc;
  color-scheme: dark;
}

html.dark .ns-chat-close:hover,
html[data-ns-theme="dark"] .ns-chat-close:hover,
html[data-lp-theme="dark"] .ns-chat-close:hover {
  background: #1e293b;
}

html.dark .ns-chat-state[data-error="true"] p,
html[data-ns-theme="dark"] .ns-chat-state[data-error="true"] p,
html[data-lp-theme="dark"] .ns-chat-state[data-error="true"] p {
  color: #fda29b;
}

body:has(.public-cookie:not([hidden])) .ns-chat-launcher {
  bottom: calc(8.5rem + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 700px) {
  body:has(.public-cookie:not([hidden])) .ns-chat-launcher {
    bottom: calc(15rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 640px) {
  body.ns-chat-panel-open {
    overflow: hidden;
  }

  .ns-chat-launcher {
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    right: calc(1rem + env(safe-area-inset-right, 0px));
  }

  .ns-chat-panel {
    border: 0;
    border-radius: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    right: 0;
    width: 100vw;
  }

  .ns-chat-panel__header {
    padding:
      max(0.85rem, env(safe-area-inset-top, 0px))
      max(0.9rem, env(safe-area-inset-right, 0px))
      0.8rem
      max(0.9rem, env(safe-area-inset-left, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ns-chat-launcher {
    transition: none;
  }

  .ns-chat-spinner {
    animation-duration: 1600ms;
  }
}

@keyframes ns-chat-spin {
  to {
    transform: rotate(360deg);
  }
}
