/* The website chat box (site/chat.js). Loaded only while SITE_CHAT is on. Uses the site's own colours and type. */
.chat { position: fixed; right: 20px; bottom: 20px; z-index: 45; font-family: var(--font); }
.chat-open { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--ink); color: var(--paper); font: 600 var(--s-15)/1 var(--font); box-shadow: 0 6px 20px rgba(14, 31, 61, .25); cursor: pointer; border-bottom: 3px solid var(--beam); }
.chat-open:hover { background: var(--blue); }
.chat-open svg { width: 20px; height: 20px; }
.chat-panel { display: flex; flex-direction: column; width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100dvh - 100px)); background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 16px 48px rgba(14, 31, 61, .28); overflow: hidden; }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: var(--ink); color: var(--paper); border-bottom: 3px solid var(--beam); }
.chat-head div { flex: 1; display: grid; gap: 4px; }
.chat-head strong { font-size: var(--s-17); }
.chat-head span { font-size: var(--s-12); color: var(--on-navy); line-height: 1.4; }
.chat-head a { color: var(--paper); }
.chat-close { width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--paper); font-size: 24px; line-height: 1; cursor: pointer; }
.chat-close:hover { background: rgba(255, 255, 255, .12); }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: grid; align-content: start; gap: 12px; background: var(--paper-2); }
.chat-msg { max-width: 88%; display: grid; gap: 8px; }
.chat-msg p { margin: 0; padding: 10px 13px; border-radius: 10px; font-size: var(--s-15); line-height: 1.45; overflow-wrap: anywhere; }
.chat-bot p { background: var(--paper); border: 1px solid var(--rule-2); border-top-left-radius: 3px; }
.chat-bot a { color: var(--blue); font-weight: 600; }
.chat-you { justify-self: end; }
.chat-you p { background: var(--blue); color: var(--paper); border-top-right-radius: 3px; }
.chat-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-examples button { padding: 7px 11px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); color: var(--ink); font: 500 var(--s-13)/1.2 var(--font); cursor: pointer; }
.chat-examples button:hover { border-color: var(--blue); color: var(--blue); }
.chat-card { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 10px; background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; }
.chat-card img { width: 72px; height: 72px; object-fit: contain; background: var(--paper-2); border-radius: 6px; }
.chat-card-body { display: grid; gap: 4px; align-content: start; min-width: 0; }
.chat-card-name { color: var(--ink); font-size: var(--s-14); font-weight: 600; line-height: 1.3; text-decoration: none; }
.chat-card-name:hover { color: var(--blue); text-decoration: underline; }
.chat-card-price { font-size: var(--s-15); font-weight: 700; }
.chat-card-facts { font-size: var(--s-12); color: var(--ink-3); }
.chat-card-add { justify-self: start; min-height: 34px; padding: 6px 12px; margin-top: 4px; font-size: var(--s-13); }
.chat-typing { display: flex; gap: 4px; padding: 14px; background: var(--paper); border: 1px solid var(--rule-2); border-radius: 10px; width: max-content; }
.chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: chat-dot 1s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .chat-typing span { animation: none; } }
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); background: var(--paper); }
.chat-form textarea { flex: 1; resize: none; min-height: 40px; max-height: 120px; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 8px; font: 16px/1.35 var(--font); color: var(--ink); }
.chat-form textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.chat-send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 8px; background: var(--blue); color: var(--paper); cursor: pointer; }
.chat-send svg { width: 20px; height: 20px; }
.chat-send:disabled { background: var(--paper-3); color: var(--ink-3); cursor: default; }
/* A phone: the open chat fills the screen, with no gap under the typing box. */
@media (max-width: 560px) {
  .chat { right: 12px; bottom: 12px; }
  .chat-open span { display: none; }
  .chat-open { width: 52px; height: 52px; padding: 0; justify-content: center; }
  .chat:has(.chat-panel:not([hidden])) { inset: 0; }
  .chat-panel { width: 100%; height: 100dvh; border-radius: 0; border: 0; }
}
/* "Send this to our quotes desk": a button under the chat, opening a short form in place. */
.chat-desk { border-top: 1px solid var(--rule); background: var(--paper); max-height: 75%; overflow-y: auto; }
.chat-desk[hidden], .chat-desk-form[hidden], .chat-desk-open[hidden] { display: none; }
.chat-desk-open { width: 100%; padding: 10px 16px; border: 0; background: var(--blue-tint); color: var(--blue); font: 600 var(--s-14)/1.3 var(--font); text-align: left; cursor: pointer; }
.chat-desk-open::after { content: " →"; }
.chat-desk-open:hover { background: var(--paper-3); }
.chat-desk-form { display: grid; gap: 8px; padding: 12px 16px; }
.chat-desk-form p { margin: 0; font-size: var(--s-13); line-height: 1.4; color: var(--ink-2); }
.chat-desk-form label { display: block; font-size: var(--s-13); font-weight: 600; }
.chat-desk-form label input { display: block; width: 100%; margin-top: 3px; }
.chat-desk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chat-form[hidden] { display: none; }
.chat-desk-form label span { font-weight: 400; color: var(--ink-3); font-size: var(--s-12); }
.chat-desk-form input:not([type="file"]) { min-height: 38px; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 6px; font: 16px/1.3 var(--font); color: var(--ink); }
.chat-desk-form input:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.chat-desk-error { color: var(--beam-ink) !important; font-weight: 600; }
.chat-desk-actions { display: flex; gap: 8px; }
.chat-desk-actions .btn { min-height: 38px; padding: 7px 14px; font-size: var(--s-14); }
.chat-note p { background: var(--ok-bg); border-color: var(--ok); }
.chat-desk-form .signup-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
