:root {
  --nomade-gold: #d8b15f;
  --nomade-gold-soft: #f3d98c;
  --nomade-ink: #08080c;
  --nomade-panel: rgba(17, 17, 24, 0.92);
  --nomade-border: rgba(255, 255, 255, 0.12);
  --nomade-muted: rgba(255, 255, 255, 0.66);
}

.nomade-chat {
  position: relative;
  min-height: 400px;
  overflow: hidden;
  background: transparent;
}

.nomade-chat__loading {
  display: grid;
  min-height: 400px;
  place-items: center;
  padding: 24px;
  color: var(--nomade-muted);
  text-align: center;
}

.nomade-chat__shell {
  display: flex;
  min-height: 400px;
  flex-direction: column;
}

.nomade-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid rgba(216, 177, 95, 0.2);
}

.nomade-chat__step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nomade-chat__presence-dot,
.nomade-contact-cta__pulse {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #57d98b;
  box-shadow: 0 0 0 4px rgba(87, 217, 139, 0.1);
}

.nomade-chat__reset {
  display: inline-flex;
  min-width: 36px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.64);
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.nomade-chat__reset:hover,
.nomade-chat__reset:focus-visible {
  border-color: var(--nomade-border);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nomade-chat__reset:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.nomade-chat__messages {
  display: flex;
  min-height: 190px;
  max-height: 330px;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 13px;
  overflow-y: auto;
  padding: 20px 0 16px;
  scroll-behavior: smooth;
  scrollbar-color: rgba(216, 177, 95, 0.35) transparent;
  scrollbar-width: thin;
}

.nomade-chat__message {
  display: flex;
  max-width: 92%;
  flex-direction: column;
  gap: 4px;
  animation: nomade-message-in 240ms ease both;
}

.nomade-chat__message--assistant {
  align-self: flex-start;
}

.nomade-chat__message--user {
  align-self: flex-end;
  align-items: flex-end;
}

.nomade-chat__bubble {
  padding: 10px 13px;
  border: 1px solid var(--nomade-border);
  border-radius: 18px 18px 18px 6px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.89);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.nomade-chat__messages > .nomade-chat__message:first-child .nomade-chat__bubble {
  padding: 2px 0 8px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.96);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
}

.nomade-chat__message--user .nomade-chat__bubble {
  border-color: rgba(216, 177, 95, 0.34);
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(145deg, rgba(216, 177, 95, 0.2), rgba(216, 177, 95, 0.09));
}

.nomade-chat__time {
  padding: 0 4px;
  color: rgba(255, 255, 255, 0.39);
  font-size: 10px;
}

.nomade-chat__typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
}

.nomade-chat__typing span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--nomade-gold);
  animation: nomade-typing 1s infinite ease-in-out;
}

.nomade-chat__typing span:nth-child(2) { animation-delay: 120ms; }
.nomade-chat__typing span:nth-child(3) { animation-delay: 240ms; }

.nomade-chat__quick-replies {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 0 14px;
}

.nomade-chat__quick-replies::-webkit-scrollbar { display: none; }

.nomade-chat__quick-reply {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(216, 177, 95, 0.28);
  border-radius: 14px;
  background: rgba(216, 177, 95, 0.055);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.nomade-chat__quick-reply::after {
  content: "→";
  flex: 0 0 auto;
  color: var(--nomade-gold);
  font-size: 15px;
}

.nomade-chat__quick-reply:hover,
.nomade-chat__quick-reply:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(216, 177, 95, 0.55);
  background: rgba(216, 177, 95, 0.14);
}

.nomade-chat__composer {
  padding: 14px 0 0;
  border-top: 1px solid var(--nomade-border);
}

.nomade-chat__form {
  display: flex;
  align-items: flex-end;
  gap: 9px;
}

.nomade-chat__input-wrap {
  position: relative;
  flex: 1 1 auto;
}

.nomade-chat__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.nomade-chat__input {
  width: 100%;
  min-height: 48px;
  max-height: 120px;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  outline: none;
  background: rgba(255, 255, 255, 0.055);
  padding: 12px 14px;
  color: #fff;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.nomade-chat__input::placeholder { color: rgba(255, 255, 255, 0.4); }

.nomade-chat__input:focus {
  border-color: rgba(216, 177, 95, 0.65);
  box-shadow: 0 0 0 3px rgba(216, 177, 95, 0.12);
}

.nomade-chat__send {
  display: inline-grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(216, 177, 95, 0.55);
  border-radius: 16px;
  background: linear-gradient(145deg, #e1bf71, #af8434);
  color: #0a0907;
  box-shadow: 0 10px 28px rgba(216, 177, 95, 0.16);
  transition: transform 180ms ease, filter 180ms ease;
}

.nomade-chat__send:hover,
.nomade-chat__send:focus-visible { transform: translateY(-1px); filter: brightness(1.08); }
.nomade-chat__send:disabled { cursor: not-allowed; opacity: 0.48; transform: none; }

.nomade-chat__notice {
  min-height: 18px;
  margin-top: 8px;
  color: var(--nomade-muted);
  font-size: 10px;
  line-height: 1.4;
}

.nomade-chat__notice--error { color: #ff9b9b; }
.nomade-chat__notice--success { color: #86e5aa; }

.nomade-chat__handoff {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 14px;
}

.nomade-chat__handoff a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid rgba(216, 177, 95, 0.38);
  border-radius: 14px;
  background: rgba(216, 177, 95, 0.12);
  color: #f5dfa6;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.nomade-contact-cta__status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #93e7af;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

@keyframes nomade-message-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes nomade-typing {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 900px) {
  .nomade-chat__quick-replies,
  .nomade-chat__handoff {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nomade-chat__quick-reply,
  .nomade-chat__handoff a {
    width: 100%;
    min-width: 0;
    white-space: normal;
    line-height: 1.35;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .nomade-chat,
  .nomade-chat__shell,
  .nomade-chat__loading { min-height: 410px; }
  .nomade-chat__messages { min-height: 180px; max-height: 320px; padding: 18px 0 14px; }
  .nomade-chat__message { max-width: 96%; }
  .nomade-chat__quick-replies,
  .nomade-chat__handoff {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .nomade-chat *,
  .nomade-chat *::before,
  .nomade-chat *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
