@font-face {
  font-family: "Onest";
  src: url("/fonts/onest-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --surface: #edf1ee;
  --panel: #fbfcfa;
  --panel-muted: #e4e9e5;
  --ink: #182321;
  --ink-muted: #5f6965;
  --line: #d8d7cf;
  --confirmed: #137a5a;
  --confirmed-pale: #dff2e9;
  --action: #e96345;
  --action-dark: #b9422c;
  --focus: #315fef;
  --radius: 14px;
  font-family: "Onest", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; background: var(--surface); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
::selection { color: #fff; background: var(--confirmed); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 64px);
  color: #f9f8f3;
  background: var(--ink);
  border-bottom: 1px solid #2f3c38;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-weight: 760;
  letter-spacing: .04em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #6f7b76;
  border-radius: 10px;
  color: #bff0d7;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.project-state { display: flex; align-items: center; gap: 9px; color: #cfd7d3; font-size: 14px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #efb44b; }
.project-state.ready .status-dot { background: #53d49e; }
.project-state.error .status-dot { background: #ff7e66; }

.workspace {
  width: min(1480px, 100%);
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(390px, .94fr);
}

.conversation, .facts-panel { min-width: 0; padding: clamp(28px, 4vw, 64px); }
.conversation { display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); }
.facts-panel { background: var(--surface); }

.conversation-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { max-width: 650px; margin-bottom: 14px; font-size: clamp(32px, 4vw, 58px); line-height: 1.02; letter-spacing: -.035em; }
.conversation-heading p { max-width: 66ch; margin-bottom: 0; color: var(--ink-muted); font-size: 17px; line-height: 1.6; }

.reset-button {
  flex: 0 0 auto;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  cursor: pointer;
}
.reset-button:hover { color: var(--action-dark); border-color: var(--action-dark); }

.message-list {
  flex: 1;
  min-height: 280px;
  max-height: 49vh;
  overflow-y: auto;
  margin: 48px -8px 24px 0;
  padding-right: 18px;
  scrollbar-color: #a8ada7 transparent;
}

.message { width: min(88%, 660px); margin-bottom: 24px; }
.speaker { margin-bottom: 7px; color: var(--ink-muted); font-size: 13px; font-weight: 680; }
.message p { margin: 0; font-size: 17px; line-height: 1.58; }
.user-message { margin-left: auto; padding: 16px 18px; border-radius: var(--radius); background: var(--ink); color: #fff; box-shadow: 0 10px 26px rgba(24, 35, 33, .14); }
.user-message .speaker { color: #bfc9c4; }
.assistant-message { padding-left: 20px; border-left: 1px solid var(--confirmed); }
.assistant-message.pending { color: var(--ink-muted); }
.assistant-message.pending p::after { content: ""; display: inline-block; width: 48px; height: 2px; margin-left: 10px; vertical-align: middle; background: var(--confirmed); animation: scan 1.1s ease-in-out infinite; }

@keyframes scan { 0%, 100% { transform: scaleX(.25); transform-origin: left; } 50% { transform: scaleX(1); transform-origin: left; } }

.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.examples button { padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: #49534f; cursor: pointer; }
.examples button:hover { border-color: var(--confirmed); color: var(--confirmed); background: #f4fbf7; }
.handoff-button { align-self: flex-start; display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 11px 15px; border: 1px solid var(--confirmed); border-radius: 999px; color: var(--confirmed); background: #f6fcf9; font-weight: 680; cursor: pointer; }
.handoff-button:hover { color: #fff; background: var(--confirmed); }
.handoff-button:disabled { color: var(--ink-muted); border-color: var(--line); background: var(--panel-muted); cursor: default; }

.composer { padding-top: 18px; border-top: 1px solid var(--line); }
.composer label { display: block; margin-bottom: 9px; font-size: 14px; font-weight: 680; }
.composer-row { display: flex; align-items: stretch; gap: 10px; }
textarea { flex: 1; min-height: 66px; max-height: 160px; resize: vertical; padding: 15px 16px; border: 1px solid #aeb2ab; border-radius: var(--radius); color: var(--ink); background: #fff; line-height: 1.45; caret-color: var(--action); }
textarea::placeholder { color: #6d7672; }
textarea:focus { border-color: var(--focus); }
.send-button { min-width: 120px; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 20px; border: 0; border-radius: var(--radius); color: #fff; background: var(--action); font-weight: 720; cursor: pointer; box-shadow: 0 8px 22px rgba(185, 66, 44, .22); }
.send-button:hover { background: var(--action-dark); }
.send-button:disabled { cursor: wait; background: #aa9e99; box-shadow: none; }
.send-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.composer-note { margin: 10px 0 0; color: var(--ink-muted); font-size: 12px; }

.facts-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.facts-heading h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.source-badge { padding: 7px 10px; border-radius: 999px; color: var(--confirmed); background: var(--confirmed-pale); font-size: 12px; font-weight: 680; }
.facts-empty { min-height: 430px; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--ink-muted); }
.facts-empty svg { width: 54px; fill: none; stroke: #9da59f; stroke-width: 1.4; stroke-linecap: round; }
.facts-empty p { max-width: 34ch; margin: 20px 0 0; line-height: 1.6; }
.facts-content { padding-top: 24px; }
.understood { display: flex; flex-wrap: wrap; gap: 8px; min-height: 34px; margin-bottom: 34px; }
.understood span { padding: 7px 10px; border: 1px solid #b8d8ca; border-radius: 999px; color: #0d664a; background: #f6fcf9; font-size: 13px; }
.results-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.results-heading h3 { margin: 0; font-size: 15px; }
.results-heading span { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.product-list { border-top: 1px solid var(--line); }
.product-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.product-image-wrap { aspect-ratio: 1; overflow: hidden; border-radius: 12px; background: #e6e5dd; }
.product-image { width: 100%; height: 100%; display: block; object-fit: cover; }
.product-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 12px; }
.product-sku { color: var(--ink-muted); }
.product-stock { color: var(--confirmed); font-weight: 680; }
.product-name { margin-bottom: 8px; font-size: 16px; line-height: 1.35; }
.product-specs { margin-bottom: 16px; color: var(--ink-muted); font-size: 13px; line-height: 1.45; }
.product-price-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.product-total { display: block; font-size: 21px; font-variant-numeric: tabular-nums; }
.product-unit, .product-location { color: var(--ink-muted); font-size: 11px; }
.product-unit { display: block; margin-top: 3px; }

.lead-dialog { width: min(620px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 20px; color: var(--ink); background: var(--panel); box-shadow: 0 24px 80px rgba(24, 35, 33, .28); }
.lead-dialog::backdrop { background: rgba(13, 22, 20, .62); backdrop-filter: blur(4px); }
.lead-form { padding: 30px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-heading h2 { margin: 6px 0 0; font-size: 28px; letter-spacing: -.025em; }
.eyebrow { color: var(--confirmed); font-size: 12px; font-weight: 760; letter-spacing: .12em; text-transform: uppercase; }
.dialog-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; }
.dialog-copy { margin: 18px 0 24px; color: var(--ink-muted); line-height: 1.55; }
.lead-form > label, .contact-grid label { display: grid; gap: 7px; margin-bottom: 16px; font-size: 13px; font-weight: 680; }
.lead-form input:not([type="checkbox"]), .lead-form textarea { width: 100%; padding: 12px 13px; border: 1px solid #aeb2ab; border-radius: 10px; color: var(--ink); background: #fff; font-weight: 400; }
.lead-form textarea { min-height: 88px; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.consent-row { grid-template-columns: 20px 1fr; align-items: start; color: var(--ink-muted); font-weight: 400 !important; line-height: 1.45; }
.consent-row input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--confirmed); }
.form-status { min-height: 20px; margin: 0 0 12px; color: var(--confirmed); font-size: 13px; }
.lead-submit { width: 100%; min-height: 52px; border: 0; border-radius: 12px; color: #fff; background: var(--confirmed); font-weight: 720; cursor: pointer; }
.lead-submit:hover { background: #0d664a; }
.lead-submit:disabled { background: #91aaa0; cursor: wait; }

@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .conversation { min-height: calc(100vh - 72px); border-right: 0; border-bottom: 1px solid var(--line); }
  .facts-panel { min-height: 480px; }
  .message-list { max-height: none; }
}

@media (max-width: 620px) {
  .topbar { height: 64px; padding: 0 16px; }
  .project-state { font-size: 12px; }
  .conversation, .facts-panel { padding: 28px 18px; }
  .conversation-heading { display: block; }
  h1 { font-size: 36px; }
  .reset-button { margin-top: 18px; }
  .message-list { min-height: 250px; margin-top: 36px; padding-right: 10px; }
  .message { width: 95%; }
  .composer-row { display: block; }
  textarea { width: 100%; }
  .send-button { width: 100%; min-height: 54px; margin-top: 10px; }
  .facts-heading { align-items: flex-start; }
  .product-row { grid-template-columns: 82px minmax(0, 1fr); gap: 13px; }
  .product-price-row { display: block; }
  .product-location { display: block; margin-top: 8px; }
  .lead-form { padding: 22px 18px; }
  .contact-grid { grid-template-columns: 1fr; gap: 0; }
}

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

.embedded, .embedded body { height: 100%; min-height: 100%; }
.embedded body { overflow: hidden; }
.embedded .topbar { height: 58px; padding: 0 58px 0 18px; }
.embedded .project-state { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.embedded .workspace { display: block; height: calc(100vh - 58px); min-height: 0; overflow-y: auto; }
.embedded .conversation { min-height: 0; padding: 20px; border-right: 0; }
.embedded .conversation-heading { justify-content: flex-end; }
.embedded .conversation-heading > div { display: none; }
.embedded .reset-button { margin: 0; padding-top: 0; }
.embedded .message-list { flex: none; min-height: 0; max-height: 250px; margin: 24px -4px 18px 0; padding-right: 10px; }
.embedded .message { width: 100%; margin-bottom: 17px; }
.embedded .message p { font-size: 15px; line-height: 1.5; }
.embedded .examples { display: grid; gap: 7px; margin-bottom: 15px; }
.embedded .examples button { width: 100%; padding: 9px 12px; }
.embedded .handoff-button { margin-bottom: 14px; }
.embedded .composer { padding-top: 14px; }
.embedded .composer-row { display: block; }
.embedded .composer textarea { width: 100%; min-height: 74px; }
.embedded .send-button { width: 100%; min-height: 50px; margin-top: 9px; }
.embedded .composer-note { margin-bottom: 0; }
.embedded .facts-panel { min-height: 0; padding: 22px 20px 28px; }
.embedded .facts-empty { min-height: 190px; }
.embedded .facts-content { padding-top: 18px; }
