/* The chat: header, a section list on the left (wide screens), and one
   scrolling conversation. Each question's answer boxes sit right under it in
   the conversation, the way Lemonade does it. The chat's lines are big plain
   text (no bubbles); the person's answers are navy bubbles on the right that
   can be tapped to edit. */

html, body.chat-page { height: 100%; }
body.chat-page {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100dvh;
  overflow: hidden;
}

.chat-top {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem;
  padding: .7rem max(16px, env(safe-area-inset-left)); padding-top: max(.7rem, env(safe-area-inset-top));
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.chat-brand img { height: 32px; width: auto; }
.progress { max-width: 420px; width: 100%; justify-self: center; }
.progress-track { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; width: 4%; background: linear-gradient(90deg, var(--teal), var(--navy)); border-radius: inherit; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.progress-label { margin: .3rem 0 0; font-size: .78rem; font-weight: 600; color: var(--muted); text-align: center; letter-spacing: .02em; }
.chat-restart { background: none; border: 0; color: var(--muted); font: 500 .85rem var(--sans); cursor: pointer; padding: .4rem .2rem; }
.chat-restart:hover { color: var(--navy); text-decoration: underline; }

.chat-body { display: grid; grid-template-columns: 1fr; min-height: 0; }
.steps { display: none; }
@media (min-width: 960px) {
  .chat-body { grid-template-columns: 250px 1fr; }
  .chat-top .progress { visibility: hidden; }
  .steps { display: block; padding: 2.6rem 0 0 max(32px, 4vw); }
  .steps ol { list-style: none; margin: 0; padding: 0; }
  .steps li { position: relative; display: flex; align-items: center; gap: .9rem; padding-bottom: 1.9rem; font-weight: 600; font-size: 1.02rem; color: var(--muted); }
  .steps li:last-child { padding-bottom: 0; }
  .steps li::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 3px; background: var(--line); }
  .steps li:last-child::before { display: none; }
  .steps li.done::before { background: var(--teal); }
  .steps .dot { flex: none; position: relative; z-index: 1; width: 23px; height: 23px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 6px var(--line-strong); }
  .steps li.now { color: var(--ink); }
  .steps li.now .dot { box-shadow: inset 0 0 0 6px var(--gold); }
  .steps li.done { color: var(--body); }
  .steps li.done .dot { background: var(--teal); box-shadow: none; }
  .steps li.done .dot::after { content: ""; position: absolute; left: 8px; top: 4px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
}
.chat-main { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scroll-padding-top: 1rem; }
.thread { max-width: 680px; margin: 0 auto; padding: 1.6rem 16px 1.2rem; display: flex; flex-direction: column; gap: 1.1rem; }

.msg.bot { display: flex; gap: .85rem; align-items: flex-start; }
.msg.bot .lines { display: flex; flex-direction: column; gap: .55rem; padding-top: .35rem; min-width: 0; }
.msg.bot p { margin: 0; color: var(--ink); font-size: clamp(1.12rem, 1.02rem + .4vw, 1.32rem); line-height: 1.42; font-weight: 700; letter-spacing: 0; }
.msg.bot p.in { animation: pop .35s cubic-bezier(.2, .8, .2, 1); }
.msg.bot .aside, .done-card .aside { display: block; font-size: .95rem; font-weight: 400; color: var(--muted); line-height: 1.5; letter-spacing: 0; }
.msg.bot a { color: var(--teal-dark); }

.typing { display: inline-flex; gap: 5px; padding: .7rem .9rem; background: var(--card); border: 1px solid var(--line); border-radius: 16px; width: max-content; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.1s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.msg.me { display: flex; justify-content: flex-end; animation: pop .3s ease; }
.bubble {
  display: inline-flex; align-items: flex-end; gap: .55rem; max-width: 85%;
  background: var(--navy); color: #fff; border: 0; text-align: left;
  padding: .7rem 1rem; border-radius: 20px 20px 6px 20px;
  font: 500 1.02rem/1.45 var(--sans); overflow-wrap: anywhere;
}
button.bubble { cursor: pointer; transition: background .15s ease, transform .12s ease; }
button.bubble:hover { background: var(--navy-deep); }
button.bubble:active { transform: scale(.98); }
button.bubble:disabled { cursor: default; }
button.bubble:disabled .edit { display: none; }
.bubble .edit { opacity: .55; flex: none; padding-bottom: 3px; }
button.bubble:hover .edit { opacity: 1; }

.done-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .5rem; box-shadow: var(--shadow); }
.done-card .calendly-inline-widget, .booking-frame { min-width: 280px; width: 100%; height: 680px; border: 0; border-radius: 14px; display: block; }
.done-card .aside { padding: .4rem .8rem .6rem; }

.turnstile-slot { display: flex; justify-content: center; }
.turnstile-slot:empty { display: none; }

/* --------------------------------------------------------------- composer */

.composer {
  max-width: 680px; margin: -.2rem auto 0;
  padding: 0 16px 2.5rem calc(16px + 40px + .85rem);
  animation: pop .35s cubic-bezier(.2, .8, .2, 1);
}
.composer:empty { display: none; }
.btn-wide { display: flex; width: 100%; max-width: 300px; min-height: 56px; }

.pills { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-start; }
.pill {
  min-height: 48px; padding: 0 1.25rem; border-radius: 999px;
  border: 1.5px solid var(--line-strong); background: #fff; color: var(--ink);
  font: 600 1rem var(--sans); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.pill:hover { border-color: var(--navy); color: var(--ink); }
.pill:active { transform: scale(.97); }
.pill.is-on { background: var(--gold-soft); border-color: var(--gold-dark); }

.cform { display: flex; flex-direction: column; gap: .8rem; }
.cgrid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem .8rem; }
.cgrid.one { grid-template-columns: 1fr; }
.cf { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.cf.wide { grid-column: 1 / -1; }
.cf > label { font-size: .82rem; font-weight: 600; color: var(--body); }
.cf > label em { font-style: normal; font-weight: 400; color: var(--muted); }
.cf small { font-size: .82rem; color: var(--muted); }
.cf input[type=text], .cf input[type=email], .cf input[type=tel], .cf input[type=date], .cf input[type=password], .cf select, .cf textarea {
  width: 100%; min-height: 52px; padding: .75rem .95rem;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink); font: 500 1.06rem var(--sans);
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none; appearance: none;
}
.cf select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236B7686' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.4rem; }
.cf textarea { resize: vertical; line-height: 1.45; }
.cf input:focus, .cf select:focus, .cf textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(13, 136, 176, .14); }
.cf .bad, .cf input.bad, .check.bad { border-color: var(--error) !important; box-shadow: 0 0 0 4px rgba(180, 35, 24, .1); }

.money { position: relative; }
.money span { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); font-weight: 600; color: var(--muted); }
.money input { padding-left: 1.9rem !important; font-variant-numeric: tabular-nums; }

.count { display: grid; grid-template-columns: 52px 1fr 52px; border: 1.5px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: #fff; }
.count button { border: 0; background: var(--paper); font: 600 1.4rem var(--sans); color: var(--navy); cursor: pointer; }
.count button:hover { background: var(--gold-soft); }
.count input { border: 0 !important; border-radius: 0 !important; text-align: center; box-shadow: none !important; font-variant-numeric: tabular-nums; }

.ssn { position: relative; }
.ssn input { padding-right: 4.5rem !important; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.ssn .eye { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--teal-dark); font: 600 .88rem var(--sans); cursor: pointer; padding: .5rem; }

.check { display: flex; flex-direction: row; gap: .7rem; align-items: flex-start; padding: .8rem .9rem; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--paper); font-size: .9rem; line-height: 1.5; color: var(--body); cursor: pointer; }
.check input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--navy); cursor: pointer; }

.cerr { margin: 0; color: var(--error); font-size: .92rem; font-weight: 600; }
.cnav { display: flex; gap: .6rem; justify-content: flex-start; margin-top: .6rem; }
.cnav .next { min-width: 220px; min-height: 56px; }

.agreement { max-height: 45dvh; overflow-y: auto; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); font-size: .86rem; line-height: 1.55; }
.agreement h3 { font-size: .95rem; margin: 0 0 .4rem; }
.agreement p { margin: 0 0 .8rem; }
#agreement .consent-line { margin-top: .7rem; background: var(--gold-soft); border-color: var(--gold); }
.sig { font-family: var(--serif) !important; font-size: 1.3rem !important; font-style: italic; }
.dateval { margin: 0; min-height: 52px; display: flex; align-items: center; font-weight: 600; color: var(--ink); }

.chat-foot { padding: .4rem 16px max(.4rem, env(safe-area-inset-bottom)); background: var(--card); }
.chat-foot p { max-width: 680px; margin: 0 auto; font-size: .7rem; line-height: 1.45; color: var(--muted); text-align: center; }
.chat-foot a { color: var(--muted); }
.noscript { padding: 1rem; text-align: center; }

@media (max-width: 560px) {
  .cgrid { grid-template-columns: 1fr; }
  .cgrid.many { grid-template-columns: 1fr 1fr; }
  .cgrid.many .cf.wide, .cgrid.many .t-text:first-child { grid-column: 1 / -1; }
  .agreement { max-height: 40dvh; }
  .composer { padding-left: 16px; }
  .cnav .next { min-width: 0; }
  .progress-label { font-size: .72rem; }
  .chat-restart { font-size: .78rem; }
  .pills { justify-content: stretch; }
  .pill { flex: 1 1 auto; justify-content: center; }
  .cnav .btn { flex: 1; }
  .msg.bot .avatar { width: 34px; height: 34px; border-radius: 11px; }
  .msg.bot .avatar svg { width: 20px; height: 20px; }
  .chat-foot { display: none; }
}

/* Address suggestions (places.js) */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  margin: 0; padding: 4px 0; list-style: none; background: #fff;
  border: 1px solid var(--line-strong, #CBD0D7); border-radius: 12px;
  box-shadow: 0 10px 28px rgba(31, 41, 51, .12); overflow: hidden;
}
.ac-item { display: flex; flex-wrap: wrap; gap: 0 .45rem; align-items: baseline; padding: .7rem .9rem; cursor: pointer; line-height: 1.3; }
.ac-item.on, .ac-item:hover { background: #F4F6F8; }
.ac-main { font-weight: 700; color: var(--ink, #2B3440); }
.ac-sub { font-size: .9rem; color: #5B6673; }
.ac-by { padding: .35rem .9rem .3rem; text-align: right; font-size: .75rem; color: #5B6673; border-top: 1px solid var(--line, #E6E8EC); }
