.site-chat {
  position: fixed;
  right: clamp(18px, 2.4vw, 38px);
  bottom: clamp(18px, 2.4vw, 34px);
  z-index: 90;
  color: #132139;
  font-family: inherit;
}

.site-chat-panel[hidden] { display: none; }

.site-chat-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 7px 17px 7px 8px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  background: #10213b;
  box-shadow: 0 14px 34px rgba(6, 24, 40, .2);
  color: #fff;
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.site-chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 17px 38px rgba(6, 24, 40, .25); }
.site-chat-launcher:focus-visible,
.site-chat-header button:focus-visible,
.site-chat-form button:focus-visible,
.site-chat-form textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 40%, white); outline-offset: 2px; }
.site-chat.is-open .site-chat-launcher { visibility: hidden; pointer-events: none; }

.site-chat-launcher-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand);
}

.site-chat svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.site-chat-panel {
  display: grid;
  grid-template-rows: auto minmax(230px, 1fr) auto;
  width: min(390px, calc(100vw - 32px));
  height: min(570px, calc(100vh - 118px));
  overflow: hidden;
  border: 1px solid #d2dce0;
  border-top: 3px solid var(--brand);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(6, 24, 40, .24);
  animation: site-chat-in .2s ease-out;
}

.site-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px 15px;
  border-bottom: 1px solid #e1e7e9;
  background: linear-gradient(115deg, #f7faf9 0%, #fff 75%);
}

.site-chat-header > div { display: grid; grid-template-columns: 10px 1fr; column-gap: 9px; align-items: center; }
.site-chat-header p { margin: 0; font-size: .94rem; font-weight: 750; }
.site-chat-header small { grid-column: 2; margin-top: 2px; color: #6c7a83; font-size: .69rem; }
.site-chat-status { width: 8px; height: 8px; border-radius: 50%; background: #2b8a5a; box-shadow: 0 0 0 4px #e4f2e9; }
.site-chat-header button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #52636d; cursor: pointer; }
.site-chat-header button:hover { background: #eef3f3; color: #10213b; }

.site-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 18px;
  background-color: #f3f6f5;
  background-image: linear-gradient(rgba(8, 127, 158, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(8, 127, 158, .035) 1px, transparent 1px);
  background-size: 28px 28px;
  scrollbar-width: thin;
}

.site-chat-message {
  max-width: 88%;
  padding: 11px 13px;
  border: 1px solid #dbe3e5;
  border-radius: 4px 13px 13px 13px;
  background: #fff;
  color: #253943;
  font-size: .8rem;
  line-height: 1.55;
  white-space: normal;
  overflow-wrap: anywhere;
}

.site-chat-message > p { margin: 0; }
.site-chat-message > p + p { margin-top: 8px; }
.site-chat-message > p:empty { display: none; }

.site-chat-detail-sections {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.site-chat-detail-sections section {
  padding-top: 9px;
  border-top: 1px solid #d9e2e4;
}

.site-chat-detail-sections strong {
  display: block;
  margin-bottom: 6px;
  color: #10213b;
  font-size: .73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.site-chat-detail-sections ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 17px;
}

.site-chat-detail-sections li {
  padding-left: 1px;
  color: #41555e;
  font-size: .73rem;
  line-height: 1.5;
}

.site-chat-detail-sections li::marker { color: var(--brand); }

.site-chat-message.is-error {
  border-color: #e7c3c0;
  background: #fff7f6;
  color: #9f352f;
  font-size: .78rem;
}

.site-chat-prompts,
.site-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.site-chat-prompts button,
.site-chat-action {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #b9cbd1;
  border-radius: 999px;
  background: #f8fbfb;
  color: #075d78;
  font: inherit;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.site-chat-prompts button:hover,
.site-chat-action:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.site-chat-result-list {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.site-chat-result {
  position: relative;
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 9px 32px 9px 10px;
  border: 1px solid #d6e0e3;
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  background: #f8faf9;
  color: #1d3540;
  text-decoration: none;
}

.site-chat-result strong { font-size: .75rem; line-height: 1.35; }
.site-chat-result > span:not(.site-chat-result-arrow) { color: #64767e; font-size: .68rem; line-height: 1.4; }
.site-chat-result-arrow { position: absolute; top: 50%; right: 10px; color: var(--brand); font-size: .9rem; transform: translateY(-50%); }
.site-chat-result[href]:hover { border-color: color-mix(in srgb, var(--brand) 55%, #d6e0e3); background: #fff; }
.site-chat-action:first-child { border-color: var(--brand); background: var(--brand); color: #fff; }
.site-chat-action:first-child:hover { background: #075d78; }

.site-chat-message.is-user { align-self: flex-end; border-color: #10213b; border-radius: 13px 4px 13px 13px; background: #10213b; color: #fff; white-space: pre-wrap; }
.site-chat-message.is-assistant.has-results { width: 94%; max-width: 94%; }
.site-chat-message.is-pending { color: #6c7a83; }
.site-chat-message.is-error { border-color: #e7c3c0; background: #fff7f6; color: #9f352f; }

.site-chat-form { padding: 13px 14px 12px; border-top: 1px solid #e1e7e9; background: #fff; }
.site-chat-form > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.site-chat-form > div { display: flex; align-items: flex-end; gap: 8px; padding: 7px 7px 7px 12px; border: 1px solid #bdcbd0; border-radius: 11px; background: #fff; }
.site-chat-form > div:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 13%, transparent); }
.site-chat-form textarea { flex: 1; min-height: 36px; max-height: 112px; padding: 8px 0 5px; resize: none; border: 0; outline: 0; background: transparent; color: #132139; font: inherit; font-size: .81rem; line-height: 1.4; }
.site-chat-form button { display: grid; flex: none; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 9px; background: var(--brand); color: #fff; cursor: pointer; }
.site-chat-form button:disabled { cursor: wait; opacity: .55; }
.site-chat-form > small { display: block; margin-top: 7px; color: #7b898f; font-size: .64rem; text-align: center; }

@keyframes site-chat-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 600px) {
  .site-chat { right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); }
  .site-chat-launcher { min-height: 46px; }
  .site-chat-panel { width: calc(100vw - 24px); height: min(620px, calc(100dvh - 84px)); border-radius: 14px; }
  .site-chat-messages { padding: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .site-chat-panel { animation: none; }
  .site-chat-launcher { transition: none; }
}
