:root {
  --ink: #12211f;
  --muted: #5b6b68;
  --line: #dbe5e1;
  --paper: #f6f9f7;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e6f4f1;
  --danger: #a33a2b;
  --shadow: 0 18px 50px rgba(18, 33, 31, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, #e8f5f1 0%, transparent 38%),
    radial-gradient(circle at 100% 20%, #f1f5ef 0%, transparent 32%),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: var(--accent-strong);
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 30px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
  letter-spacing: 0.02em;
  font-size: 14px;
}

.brand-name {
  margin: 0;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.brand-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 34px;
  align-items: start;
}

.intro {
  padding: 18px 6px 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.intro-copy {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 15.5px;
  max-width: 52ch;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.example {
  max-width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.example:hover {
  border-color: #b8d3cc;
  background: #fff;
  transform: translateY(-1px);
}

.chat-card {
  display: flex;
  flex-direction: column;
  min-height: 640px;
  max-height: min(78vh, 780px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.chat-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.chat-status {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  max-width: 92%;
}

.message.user {
  align-self: flex-end;
  justify-content: flex-end;
}

.message.assistant {
  align-self: flex-start;
}

.bubble {
  padding: 12px 15px;
  border-radius: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14.5px;
}

.message.user .bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.message.assistant .bubble {
  background: #f4f8f6;
  border: 1px solid #e3ece8;
  border-bottom-left-radius: 5px;
}

.message.assistant .bubble a {
  color: var(--accent-strong);
}

.typing .bubble {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  color: var(--muted);
}

.typing .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9fb6b0;
  animation: pulse 1.2s infinite ease-in-out;
}

.typing .dot:nth-child(2) {
  animation-delay: 0.16s;
}

.typing .dot:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes pulse {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.sources {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid #d9e6e1;
}

.sources-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid #cfe2dc;
  border-radius: 8px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 12.5px;
  text-decoration: none;
}

.source-link:hover {
  border-color: var(--accent);
}

.source-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.disclaimer {
  margin-top: 10px;
  padding: 9px 11px;
  border-left: 3px solid #e0b34b;
  background: #fffaf0;
  color: #6b5420;
  font-size: 12.5px;
}

.lead-cta {
  margin-top: 11px;
}

.lead-cta button {
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
}

.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 16px 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.composer textarea {
  flex: 1;
  max-height: 130px;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid #cfddd8;
  border-radius: 12px;
  background: #fbfdfc;
  color: var(--ink);
  resize: none;
  outline: none;
}

.composer textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.send-button {
  padding: 11px 17px;
  border: 0;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
  transition: background 160ms ease;
}

.send-button:hover {
  background: var(--accent-strong);
}

.send-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.composer-note {
  margin: 0;
  padding: 0 16px 13px;
  color: var(--muted);
  font-size: 11.5px;
}

.ghost-button {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.ghost-button:hover {
  background: #fff;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  color: var(--muted);
  font-size: 12.5px;
}

.site-footer p {
  margin: 0;
}

.dot {
  margin: 0 6px;
}

.fine-print {
  max-width: 45ch;
  text-align: right;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lead-dialog {
  width: min(480px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(18, 33, 31, 0.22);
}

.lead-dialog::backdrop {
  background: rgba(18, 33, 31, 0.42);
  backdrop-filter: blur(2px);
}

.lead-dialog form {
  padding: 20px;
  display: grid;
  gap: 12px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.dialog-head h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.icon-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.dialog-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.lead-dialog label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 650;
}

.lead-dialog input,
.lead-dialog textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #cfddd8;
  border-radius: 10px;
  background: #fbfdfc;
  font-weight: 400;
  outline: none;
}

.lead-dialog input:focus,
.lead-dialog textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.optional {
  color: var(--muted);
  font-weight: 400;
}

.consent {
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 8px;
  font-weight: 400;
  color: var(--muted);
  font-size: 12.5px;
}

.consent input {
  width: auto;
  margin-top: 3px;
}

.honeypot {
  position: absolute;
  left: -9999px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 12.5px;
}

.dialog-success {
  padding: 22px;
  text-align: center;
}

.dialog-success h2 {
  margin: 0 0 8px;
}

.dialog-success p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .chat-card {
    min-height: 560px;
    max-height: none;
  }

  .intro {
    padding-top: 0;
  }

  .site-footer {
    flex-direction: column;
  }

  .fine-print {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .page {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .site-header {
    margin-bottom: 18px;
  }

  .brand-sub {
    display: none;
  }

  .messages,
  .composer {
    padding-left: 12px;
    padding-right: 12px;
  }

  .message {
    max-width: 96%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
