/* Avilon enquiry chat — a small utility surface in the site's hairline grid. */

.avilon-chat {
  position: fixed;
  z-index: 60;
  right: clamp(16px, 3vw, 32px);
  bottom: clamp(16px, 3vw, 28px);
  display: grid;
  justify-items: end;
  gap: 8px;
  max-width: calc(100vw - 32px);
}

.chat-launcher,
.chat-close,
.chat-send {
  border: 1px solid var(--line-dark, #2b323d);
  border-radius: 0;
  cursor: pointer;
}

.chat-launcher {
  padding: 11px 16px;
  background: var(--ink, #10141a);
  color: var(--on-dark, #fafbfc);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.chat-launcher:hover,
.chat-send:hover {
  background: var(--accent, #b84a2d);
  border-color: var(--accent, #b84a2d);
}

.chat-panel {
  width: min(520px, calc(100vw - 32px));
  height: min(720px, calc(100dvh - 96px));
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  overflow-y: auto;
  border: 1px solid var(--line-dark, #2b323d);
  border-radius: 0;
  background: var(--bg, #fafbfc);
  color: var(--ink, #10141a);
}

.chat-panel[hidden] { display: none; }

.chat-panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line, #e4e7ec);
}

.chat-kicker {
  margin-bottom: 7px;
  color: var(--accent, #b84a2d);
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.chat-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.chat-close {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  background: none;
  color: var(--ink, #10141a);
  font-size: 22px;
  line-height: 1;
}

.chat-close:hover { color: var(--accent, #b84a2d); }

.chat-notice {
  margin: 0;
  color: var(--muted, #5b6472);
  font-size: 12px;
  line-height: 1.5;
  overflow-y: auto;
  max-height: min(160px, 20dvh);
}

.chat-notice summary {
  cursor: pointer;
  padding: 13px 18px;
}

.chat-notice summary:focus-visible {
  outline: 2px solid var(--accent, #b84a2d);
  outline-offset: -2px;
}

.chat-notice p {
  margin: 0;
  padding: 0 18px 13px;
}

.chat-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 0 18px 13px;
}

.chat-control {
  border: 0;
  padding: 0;
  background: none;
  color: var(--muted, #5b6472);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.chat-control:hover { color: var(--accent, #b84a2d); }
.chat-control:disabled { cursor: wait; opacity: 0.58; }

.chat-messages {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line, #e4e7ec);
  border-bottom: 1px solid var(--line, #e4e7ec);
}

.chat-message {
  margin: 0;
  padding: 10px 12px;
  border-left: 2px solid var(--line-strong, #d6dae1);
  background: var(--surface, #f3f4f7);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-message-user {
  border-left-color: var(--accent, #b84a2d);
  background: none;
}

.chat-citations {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding-left: 14px;
  font-size: 12px;
}

.chat-citations a { color: var(--accent, #b84a2d); text-decoration: underline; text-underline-offset: 3px; }

.chat-form {
  display: grid;
  gap: 10px;
  padding: 14px 18px 16px;
}

.chat-input {
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--line-strong, #d6dae1);
  border-radius: 0;
  background: none;
  padding: 10px;
  color: var(--ink, #10141a);
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
}

.chat-input:focus { outline: none; border-color: var(--ink, #10141a); }
.chat-input:focus-visible { outline: 2px solid var(--accent, #b84a2d); outline-offset: 2px; }

.chat-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-status {
  min-width: 0;
  color: var(--muted, #5b6472);
  font-size: 12px;
  line-height: 1.4;
}

.chat-send {
  flex: 0 0 auto;
  padding: 9px 15px;
  background: var(--ink, #10141a);
  color: var(--on-dark, #fafbfc);
  font-size: 13px;
  font-weight: 600;
}

.chat-send:disabled { cursor: wait; opacity: 0.58; }



@media (prefers-reduced-motion: reduce) {
  .chat-panel,
  .chat-launcher,
  .chat-close,
  .chat-send {
    scroll-behavior: auto;
    transition: none;
  }
}

@media (max-width: 520px) {
  .avilon-chat {
    right: 16px;
    left: 16px;
    max-width: none;
  }

  .chat-launcher { width: auto; }
  .chat-panel { width: 100%; }
}
