:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f2f5f8;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 12% 0%, rgb(84 111 255 / 12%), transparent 32rem), #f2f5f8;
}

a { color: inherit; }
button, textarea { font: inherit; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: rgb(255 255 255 / 86%);
  border-bottom: 1px solid #dde4ec;
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: #172033;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #3156b7, #6a4bf5);
  border-radius: 0.7rem;
  box-shadow: 0 0.5rem 1.2rem rgb(71 75 219 / 24%);
}

nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
nav a { color: #43506a; font-size: 0.94rem; font-weight: 650; text-decoration: none; }
nav a:hover { color: #3156b7; }
.header-cta {
  padding: 0.55rem 0.8rem;
  color: #fff;
  background: #3156b7;
  border-radius: 0.65rem;
}
.header-cta:hover { color: #fff; background: #26489f; }

.page-shell {
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 5rem) 0;
}

h1, h2, p { overflow-wrap: anywhere; }
h1 {
  max-width: 16ch;
  margin: 0.45rem 0 1.2rem;
  font-size: clamp(2.35rem, 6vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}
h2 { margin: 0.25rem 0 0; font-size: 1.35rem; letter-spacing: -0.02em; }

.eyebrow, .chat-kicker {
  margin: 0;
  color: #3156b7;
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.lead-text {
  max-width: 60ch;
  color: #5d687c;
  font-size: clamp(1rem, 2vw, 1.16rem);
  line-height: 1.7;
}

.demo-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(390px, 1.15fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.process-list { display: grid; gap: 0.85rem; padding: 0; margin: 2rem 0 0; list-style: none; }
.process-list li { display: flex; align-items: center; gap: 0.8rem; color: #3f4a60; font-weight: 650; }
.process-list span {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  place-items: center;
  color: #3156b7;
  background: #e6ebff;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 850;
}

.chat-card, .leads-panel, .lead-card, .empty-state {
  background: #fff;
  border: 1px solid #dfe5ec;
  border-radius: 1.4rem;
  box-shadow: 0 1.5rem 4rem rgb(32 44 70 / 10%);
}

.chat-card, .leads-panel, .lead-card { overflow: hidden; }
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.35rem;
  border-bottom: 1px solid #e7ebf0;
}

.online-indicator { display: inline-flex; align-items: center; gap: 0.45rem; color: #53705c; font-size: 0.78rem; font-weight: 700; }
.online-indicator span { width: 0.55rem; height: 0.55rem; background: #2fac65; border-radius: 999px; box-shadow: 0 0 0 0.28rem #e5f7ec; }

.chat-messages {
  display: flex;
  min-height: 360px;
  max-height: 480px;
  flex-direction: column;
  gap: 0.9rem;
  overflow-y: auto;
  padding: 1.35rem;
  background: #f7f8fb;
}

.message { max-width: min(86%, 34rem); padding: 0.85rem 1rem; border-radius: 1rem; line-height: 1.48; }
.message p { margin: 0.28rem 0 0; }
.message-label { font-size: 0.72rem; font-weight: 800; opacity: 0.68; }
.message-system { align-self: flex-start; background: #fff; border: 1px solid #e0e5ec; border-bottom-left-radius: 0.25rem; }
.message-user { align-self: flex-end; color: #fff; background: linear-gradient(135deg, #3156b7, #5744d8); border-bottom-right-radius: 0.25rem; box-shadow: 0 0.7rem 1.4rem rgb(49 86 183 / 20%); }
.manager-link { align-self: flex-start; color: #3156b7; font-weight: 800; text-decoration: none; }

.chat-form { display: grid; gap: 0.9rem; padding: 1.2rem 1.35rem 1.35rem; border-top: 1px solid #e7ebf0; }
.chat-form textarea { width: 100%; min-height: 82px; resize: vertical; padding: 0.85rem 1rem; color: #172033; background: #fff; border: 1px solid #cbd4df; border-radius: 0.85rem; outline: none; }
.chat-form textarea:focus { border-color: #526ee0; box-shadow: 0 0 0 0.25rem rgb(82 110 224 / 13%); }

.chat-actions, .manager-heading, .lead-card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 0.7rem 1rem; border: 0; border-radius: 0.75rem; font-weight: 800; text-decoration: none; cursor: pointer; }
.button:disabled { cursor: not-allowed; opacity: 0.55; }
.button-primary { color: #fff; background: #3156b7; }
.button-primary:hover:not(:disabled) { background: #26489f; }
.button-secondary { color: #344158; background: #edf0f4; }
.back-link { display: inline-flex; margin-bottom: 1.5rem; color: #3156b7; font-weight: 800; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.form-error { margin: 0; color: #9f2b33; font-size: 0.88rem; font-weight: 700; }
.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; }

.manager-heading { align-items: flex-end; margin-bottom: 1.5rem; }
.manager-heading h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.manager-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr); gap: 1.25rem; align-items: start; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.9rem 0.8rem; text-align: left; border-bottom: 1px solid #e8ecf1; vertical-align: top; }
th { color: #667187; background: #f6f8fa; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }
td a { color: #3156b7; font-weight: 750; text-decoration: none; }
td strong, td small { display: block; }
td small { margin-top: 0.25rem; color: #68748a; }
.selected-row { background: #f1f4ff; }

.badge { display: inline-flex; padding: 0.36rem 0.5rem; border-radius: 0.5rem; font-size: 0.7rem; font-weight: 850; letter-spacing: 0.025em; }
.badge-high { color: #9c2c2c; background: #ffe7e7; }
.badge-normal, .badge-status { color: #36517a; background: #e9eef6; }

.lead-card { padding: 1.35rem; }
.value-block { margin-top: 1rem; padding: 1rem; background: #f5f7fa; border-radius: 0.9rem; }
.value-block-accent { color: #263966; background: linear-gradient(135deg, #e8edff, #f0ecff); border: 1px solid #d8dfff; }
.value-block span { display: block; margin-bottom: 0.4rem; color: #667187; font-size: 0.72rem; font-weight: 850; letter-spacing: 0.05em; text-transform: uppercase; }
.value-block p, .value-block strong { margin: 0; line-height: 1.55; }

.lead-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 1rem 0 0; border: 1px solid #e3e8ee; border-radius: 0.9rem; overflow: hidden; }
.lead-fields div { padding: 0.8rem; border-bottom: 1px solid #e3e8ee; }
.lead-fields div:nth-child(odd) { border-right: 1px solid #e3e8ee; }
.lead-fields dt { color: #6b7588; font-size: 0.72rem; }
.lead-fields dd { margin: 0.28rem 0 0; font-weight: 720; }

.dialog-history { margin-top: 1rem; padding: 1rem; border: 1px solid #e3e8ee; border-radius: 0.9rem; }
.dialog-history summary { color: #3156b7; font-weight: 800; cursor: pointer; }
.history-row { margin-top: 0.85rem; padding-top: 0.85rem; border-top: 1px solid #e8ecf1; }
.history-row strong { font-size: 0.74rem; }
.history-row p { margin: 0.3rem 0 0; line-height: 1.5; }

.empty-state { padding: clamp(2rem, 7vw, 5rem); text-align: center; }
.empty-state > span { color: #3156b7; font-weight: 850; }
.empty-state h2 { margin-top: 0.7rem; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.empty-state p { color: #667187; }
.empty-state .button { margin-top: 1rem; }
.legal-document {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  background: #fff;
  border: 1px solid #dfe5ec;
  border-radius: 1.4rem;
  box-shadow: 0 1.5rem 4rem rgb(32 44 70 / 8%);
}
.legal-document h1 { max-width: 18ch; font-size: clamp(2.1rem, 5vw, 3.8rem); }
.legal-document h2 { margin-top: 2.2rem; font-size: 1.25rem; }
.legal-document p { color: #4f5c72; line-height: 1.72; }
.legal-document a { color: #3156b7; }
.legal-lead { font-size: 1.08rem; }
.legal-actions { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-top: 2.5rem; }
.legal-actions .button { color: #fff; }
.error-state h1 { max-width: none; font-size: clamp(2rem, 5vw, 3.5rem); }

@media (max-width: 940px) {
  .demo-layout, .manager-layout { grid-template-columns: 1fr; }
  .demo-copy { max-width: 760px; }
}

@media (max-width: 640px) {
  .site-header, .manager-heading, .chat-actions { align-items: stretch; flex-direction: column; }
  .site-header { min-height: 0; }
  nav { gap: 0.75rem 0.9rem; }
  nav a { font-size: 0.86rem; }
  .header-cta { width: 100%; margin-top: 0.15rem; text-align: center; }
  .page-shell { width: min(100% - 1rem, 1220px); padding: 1.5rem 0 2.5rem; }
  h1 { font-size: clamp(2.25rem, 13vw, 3.4rem); }
  .chat-header { align-items: flex-start; flex-direction: column; }
  .chat-messages { min-height: 330px; max-height: 58vh; }
  .message { max-width: 94%; }
  .button { width: 100%; }
  .lead-fields { grid-template-columns: 1fr; }
  .lead-fields div:nth-child(odd) { border-right: 0; }
}
