/* Website chat — New Zealand flavour: koru mark, pōhutukawa red, bush green */
.dnc {
  --dnc-red: #C8102E;
  --dnc-red-2: #E0364E;
  --dnc-green: #1F6B4F;
  --dnc-panel: #0F1626;
  --dnc-panel-2: #151F33;
  --dnc-line: rgba(255, 255, 255, .09);
  --dnc-text: #EAF0FF;
  --dnc-muted: #9AA7C2;
  --dnc-them: #1A2540;
  --dnc-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 1000;
  font-family: var(--font-body, system-ui, sans-serif);
}
:root[data-theme="light"] .dnc {
  --dnc-panel: #FFFFFF;
  --dnc-panel-2: #F4F6FA;
  --dnc-line: rgba(14, 22, 38, .1);
  --dnc-text: #0D1524;
  --dnc-muted: #4E5A72;
  --dnc-them: #EEF2F8;
  --dnc-shadow: 0 24px 60px rgba(14, 22, 38, .2);
}

.dnc-launch {
  display: flex; align-items: center; gap: 10px;
  border: 0; cursor: pointer;
  background: var(--dnc-red); color: #fff;
  font: 600 15px/1 var(--font-head, inherit);
  padding: 12px 18px 12px 12px; border-radius: 999px;
  box-shadow: 0 12px 30px rgba(200, 16, 46, .35);
  transition: transform .15s, background .15s;
}
.dnc-launch:hover { background: var(--dnc-red-2); transform: translateY(-2px); }
.dnc-launch:focus-visible, .dnc button:focus-visible, .dnc input:focus-visible, .dnc textarea:focus-visible {
  outline: 2px solid #00E5FF; outline-offset: 2px;
}
.dnc-koru { width: 30px; height: 30px; flex: none; }
.dnc-open .dnc-launch { display: none; }

.dnc-panel {
  display: none; flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 110px));
  background: var(--dnc-panel); color: var(--dnc-text);
  border: 1px solid var(--dnc-line); border-radius: 20px;
  box-shadow: var(--dnc-shadow); overflow: hidden;
}
.dnc-open .dnc-panel { display: flex; }

.dnc-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px 14px 16px;
  background: linear-gradient(135deg, var(--dnc-green), #154A37);
  color: #fff;
}
.dnc-head .dnc-koru { width: 36px; height: 36px; }
.dnc-head b { display: block; font: 600 16px/1.2 var(--font-head, inherit); }
.dnc-head small { font-size: 12.5px; opacity: .85; }
.dnc-close {
  margin-left: auto; width: 34px; height: 34px; border-radius: 10px;
  border: 0; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; font-size: 20px; line-height: 1;
}
.dnc-close:hover { background: rgba(255, 255, 255, .24); }

.dnc-log {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--dnc-panel-2);
}
.dnc-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.dnc-msg.bot { align-self: flex-start; background: var(--dnc-them); border-bottom-left-radius: 4px; }
.dnc-msg.me  { align-self: flex-end; background: var(--dnc-red); color: #fff; border-bottom-right-radius: 4px; }
.dnc-msg a { color: inherit; text-decoration: underline; }
.dnc-typing { display: inline-flex; gap: 4px; }
.dnc-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--dnc-muted); animation: dnc-dot 1s infinite ease-in-out; }
.dnc-typing i:nth-child(2) { animation-delay: .15s; }
.dnc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dnc-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.dnc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dnc-chip {
  border: 1px solid var(--dnc-line); background: var(--dnc-panel); color: var(--dnc-text);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.dnc-chip:hover { border-color: var(--dnc-red); color: var(--dnc-red-2); }
:root[data-theme="light"] .dnc-chip:hover { color: var(--dnc-red); }

.dnc-form { display: grid; gap: 8px; background: var(--dnc-panel); border: 1px solid var(--dnc-line); border-radius: 14px; padding: 12px; }
.dnc-form label { font-size: 12.5px; color: var(--dnc-muted); display: grid; gap: 4px; }
.dnc-form input[type="text"], .dnc-form input[type="email"], .dnc-form input[type="tel"] {
  width: 100%; font: inherit; font-size: 14px; color: var(--dnc-text);
  background: var(--dnc-panel-2); border: 1px solid var(--dnc-line); border-radius: 10px; padding: 9px 10px;
}
.dnc-form .dnc-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; }
.dnc-form .dnc-consent input { margin-top: 2px; }
.dnc-form .dnc-err { color: var(--dnc-red-2); font-size: 12.5px; min-height: 0; }
.dnc-hp { position: absolute; left: -9999px; }

.dnc-foot { border-top: 1px solid var(--dnc-line); padding: 10px; display: grid; gap: 8px; background: var(--dnc-panel); }
.dnc-row { display: flex; gap: 8px; }
.dnc-row textarea {
  flex: 1; resize: none; height: 42px; font: inherit; font-size: 14.5px; color: var(--dnc-text);
  background: var(--dnc-panel-2); border: 1px solid var(--dnc-line); border-radius: 12px; padding: 10px 12px;
}
.dnc .dnc-row textarea { min-height: 0; height: 42px; max-height: 42px; margin: 0; width: auto; line-height: 1.4; }
.dnc .dnc-row .dnc-send { height: 42px; align-self: flex-end; }
.dnc-send, .dnc-primary {
  border: 0; cursor: pointer; background: var(--dnc-red); color: #fff;
  border-radius: 12px; padding: 0 16px; font-weight: 600; font-size: 14px; min-height: 42px;
}
.dnc-send:hover, .dnc-primary:hover { background: var(--dnc-red-2); }
.dnc-send:disabled { opacity: .5; cursor: default; }
.dnc-leave { background: none; border: 0; color: var(--dnc-muted); font-size: 12.5px; cursor: pointer; text-decoration: underline; justify-self: start; padding: 0; }
.dnc-note { font-size: 11.5px; color: var(--dnc-muted); margin: 0; }

@media (max-width: 480px) {
  .dnc-launch span { font-size: 0; }
  .dnc-launch span::after { content: "Chat"; font-size: 15px; }
  .dnc-launch { padding: 10px 16px 10px 10px; }
  .dnc-open { left: 8px; right: 8px; bottom: 8px; }
  .dnc-panel { width: 100%; height: calc(100vh - 16px); height: calc(100dvh - 16px); }
}
@media (prefers-reduced-motion: reduce) {
  .dnc-launch, .dnc-typing i { transition: none; animation: none; }
}
