/* Chat assistant widget (src/assets/js/chat.js). Brand palette only: charcoal, cedar, white. */
.chat { position: fixed; right: 20px; bottom: 20px; z-index: 60; font-family: var(--font); }
.chat__launch {
  display: inline-flex; align-items: center; gap: .55em; min-height: 52px; padding: 0 1.15em;
  background: var(--ink); color: var(--white); border: 1px solid var(--line-dark); border-radius: 999px;
  font: 600 .98rem/1 var(--font); font-stretch: 108%; cursor: pointer; box-shadow: var(--shadow);
}
.chat__launch:hover { background: #22272a; }
.chat__launch svg { color: var(--cedar); flex: none; }
.chat.is-open .chat__launch { display: none; }

.chat__panel {
  width: min(390px, calc(100vw - 32px)); height: min(600px, calc(100vh - 40px)); min-height: 240px;
  display: flex; flex-direction: column; background: var(--white); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.22); overflow: hidden;
}
.chat__panel[hidden] { display: none; }
.chat__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--ink); color: var(--white); border-bottom: 3px solid var(--cedar); }
.chat__head strong { display: block; font-size: .98rem; font-stretch: 110%; letter-spacing: .01em; }
.chat__head small { display: block; color: var(--muted-on-dark); font-size: var(--fs-xs); margin-top: 2px; }
.chat__close { width: 44px; height: 44px; margin: -8px -8px -8px 0; background: none; border: 0; color: var(--white); font-size: 1.7rem; line-height: 1; cursor: pointer; }

.chat__log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); overscroll-behavior: contain; }
.chat__msg { max-width: 88%; padding: 10px 13px; border-radius: 8px; font-size: .95rem; line-height: 1.45; overflow-wrap: anywhere; }
.chat__msg p { margin: 0; }
.chat__msg p + p, .chat__msg ul + p, .chat__msg p + ul { margin-top: .5em; }
.chat__msg ul { margin: 0; padding-left: 1.15em; }
.chat__msg--assistant { align-self: flex-start; background: var(--white); border: 1px solid var(--line); border-top-left-radius: 2px; }
.chat__msg--assistant a { color: var(--cedar-ink); font-weight: 600; }
.chat__msg--user { align-self: flex-end; background: var(--ink); color: var(--white); border-top-right-radius: 2px; }

.chat__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chat__chips:empty { display: none; }
.chat__chip { min-height: 36px; padding: 0 .85em; background: var(--white); color: var(--ink); border: 1px solid var(--cedar); border-radius: 999px; font: 500 .86rem var(--font); cursor: pointer; }
.chat__chip:hover { background: #fbf4ee; }

.chat__form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat__form textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 120px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius); font: 400 16px/1.35 var(--font); resize: none; color: var(--ink); }
.chat__form textarea:focus { outline: 2px solid var(--cedar); outline-offset: 0; border-color: transparent; }
.chat__send { min-height: 44px; padding: 0 1em; }
.chat__send:disabled { opacity: .55; cursor: default; }
.chat__fine { margin: 0; padding: 0 12px 10px; font-size: var(--fs-xs); color: var(--muted); }
.chat__fine a { color: var(--cedar-ink); }

.chat__dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.chat__dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: chat-dot 1s infinite ease-in-out; }
.chat__dots i:nth-child(2) { animation-delay: .15s; }
.chat__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .chat__dots i { animation: none; opacity: .6; } }

/* Phones: sit above the fixed Call / Request bar; open full-width. */
@media (max-width: 760px) {
  .chat { right: 12px; bottom: calc(82px + env(safe-area-inset-bottom)); }
  .chat__launch { min-height: 48px; padding: 0 1em; }
  .chat__launch span { font-size: .92rem; }
  .chat.is-open { left: 0; right: 0; bottom: 0; top: 0; }
  .chat__panel { width: 100%; height: 100%; border-radius: 0; border: 0; }
}
@media print { .chat { display: none; } }
