.nageochat-root {
  position: fixed;
  z-index: 9999;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.nageochat-position-bottom-right {
  right: 1rem;
  bottom: 1rem;
}

.nageochat-position-bottom-left {
  left: 1rem;
  bottom: 1rem;
}

.nageochat-toggle {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  border: none;
  background: var(--nageochat-primary, #0d9488);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.nageochat-toggle img,
.nageochat-toggle-icon {
  display: block;
}

.nageochat-toggle-icon svg {
  display: block;
}

@keyframes nageochat-robot-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes nageochat-robot-antenna {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@keyframes nageochat-robot-wave {
  0%, 52%, 100% {
    transform: rotate(0deg);
  }
  6% {
    transform: rotate(32deg);
  }
  12% {
    transform: rotate(-14deg);
  }
  18% {
    transform: rotate(28deg);
  }
  24% {
    transform: rotate(-10deg);
  }
  30% {
    transform: rotate(18deg);
  }
  38% {
    transform: rotate(0deg);
  }
}

.nageochat-root:not(.is-open) .nageochat-toggle-icon {
  animation: nageochat-robot-bob 2.6s ease-in-out infinite;
}

.nageochat-root:not(.is-open) .nageochat-robot-antenna {
  animation: nageochat-robot-antenna 2.6s ease-in-out infinite;
}

.nageochat-root:not(.is-open) .nageochat-robot-arm {
  transform-origin: 18.2px 11.8px;
  animation: nageochat-robot-wave 2.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .nageochat-root .nageochat-toggle-icon,
  .nageochat-root .nageochat-toggle-icon svg circle,
  .nageochat-root .nageochat-robot-arm {
    animation: none !important;
  }
}

.nageochat-panel {
  position: absolute;
  bottom: 4rem;
  width: min(460px, calc(100vw - 2rem));
  height: min(80vh, 850px);
  max-height: min(80vh, 850px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.nageochat-position-bottom-left .nageochat-panel {
  left: 0;
}

.nageochat-position-bottom-right .nageochat-panel {
  right: 0;
}

.nageochat-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--nageochat-primary, #0d9488);
  color: #fff;
  flex-shrink: 0;
}

.nageochat-close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.25rem;
  cursor: pointer;
}

.nageochat-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.nageochat-messages {
  padding: 1rem;
  flex: 1 0 auto;
  min-height: 0;
}

.nageochat-msg {
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  max-width: 92%;
  word-break: break-word;
  white-space: pre-wrap;
}

.nageochat-msg-user {
  margin-left: auto;
  background: #e6fffa;
  color: #134e4a;
}

.nageochat-msg-assistant {
  background: #f3f4f6;
  color: #111827;
  white-space: normal;
}

.nageochat-msg-assistant strong {
  font-weight: 600;
}

.nageochat-msg-assistant a {
  color: #0d9488;
  word-break: break-all;
}

.nageochat-human-banner {
  margin: 0.5rem 0.75rem 0;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  background: #ecfdf5;
  color: #065f46;
  font-size: 0.85rem;
}

.nageochat-advisor-btn {
  flex-basis: 100%;
  background: transparent;
  border: 0;
  color: #0f766e;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.nageochat-msg-employee {
  background: #ecfdf5;
  color: #064e3b;
  border: 1px solid #a7f3d0;
  white-space: pre-wrap;
}

.nageochat-msg-time {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.7rem;
  opacity: 0.7;
}

.nageochat-msg-system {
  background: transparent;
  color: #6b7280;
  font-size: 0.875rem;
}

.nageochat-panel-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #eee;
  flex-shrink: 0;
  background: #fff;
}

.nageochat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.5rem;
  min-width: 0;
}

.nageochat-send-btn {
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  background: var(--nageochat-primary, #0d9488);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.nageochat-send-btn:disabled,
.nageochat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.nageochat-status {
  font-size: 0.75rem;
  padding: 0 0.75rem 0.75rem;
  color: #555;
  min-height: 1rem;
  flex-shrink: 0;
}

.nageochat-consent {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.nageochat-consent-notice {
  color: #6b7280;
  font-size: 0.8125rem;
}

.nageochat-consent-accept,
.nageochat-consent-decline {
  margin-top: 0.5rem;
  margin-right: 0.5rem;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  border: none;
  cursor: pointer;
}

.nageochat-consent-accept {
  background: var(--nageochat-primary, #0d9488);
  color: #fff;
}

.nageochat-consent-decline {
  background: #e5e7eb;
}

.nageochat-product-kit {
  padding: 0.25rem 1rem 0.75rem;
  max-width: 100%;
  box-sizing: border-box;
}

.nageochat-kit-heading {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

.nageochat-kit-total {
  margin: 0.5rem 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: #0f766e;
}

.nageochat-kit-note {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  color: #b45309;
}

.nageochat-kit-step-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #0d9488;
}

.nageochat-kit-role {
  font-size: 0.8125rem;
  color: #4b5563;
  line-height: 1.35;
}

.nageochat-kit-lines {
  padding: 0;
}

.nageochat-kit-add {
  width: 100%;
  max-width: 100%;
}

.nageochat-product-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.25rem 1rem 0.75rem;
  max-width: 100%;
  box-sizing: border-box;
}

.nageochat-product-card {
  display: grid;
  grid-template-columns: minmax(110px, 125px) 1fr;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fafafa;
  max-width: 100%;
  box-sizing: border-box;
}

.nageochat-product-card img {
  width: 100%;
  height: 125px;
  max-height: 140px;
  object-fit: contain;
  object-position: center;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #eef2f7;
}

.nageochat-product-card-placeholder {
  width: 100%;
  height: 125px;
  border-radius: 8px;
  background: #f3f4f6;
  border: 1px dashed #d1d5db;
}

.nageochat-product-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.nageochat-product-card-title {
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.3;
  color: #111827;
}

.nageochat-product-card-ref {
  font-size: 0.75rem;
  color: #9ca3af;
}

.nageochat-product-card-price {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #0f766e;
}

.nageochat-product-card-price-promo {
  color: #b45309;
}

.nageochat-product-card-avail {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #6b7280;
}

.nageochat-product-card-avail.is-in-stock {
  color: #047857;
}

.nageochat-product-card-avail.is-backorder {
  color: #b45309;
}

.nageochat-product-card-avail.is-out-of-stock {
  color: #b91c1c;
}

.nageochat-root .primary-action,
.nageochat-root .secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
}

.nageochat-root .primary-action {
  background: var(--nageochat-primary, #0d9488);
  color: #fff;
}

.nageochat-root .secondary-action {
  background: #fff;
  color: #0f766e;
  border: 1px solid #99f6e4;
}

.nageochat-root .primary-action.is-compact,
.nageochat-root .secondary-action.is-compact {
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
}

.nageochat-root .secondary-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.nageochat-product-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.nageochat-product-card-cta,
.nageochat-product-card-cart {
  align-self: flex-start;
  text-decoration: none;
}

.nageochat-tracking-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1rem 0.5rem;
  max-width: 100%;
}

.nageochat-tracking-link {
  text-decoration: none;
}

.nageochat-revoke-link {
  display: block;
  margin: 0 0.75rem 0.75rem;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 0.75rem;
  text-decoration: underline;
  cursor: pointer;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .nageochat-position-bottom-right,
  .nageochat-position-bottom-left {
    right: 0.5rem;
    left: 0.5rem;
    bottom: 0.5rem;
  }

  .nageochat-panel {
    width: calc(100vw - 1rem);
    height: min(82vh, 850px);
    max-height: min(82vh, 850px);
    bottom: 3.75rem;
  }

  .nageochat-product-card {
    grid-template-columns: 96px 1fr;
  }

  .nageochat-product-card img,
  .nageochat-product-card-placeholder {
    height: 110px;
  }
}
