:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --tork-orange: #f26522;
  --tork-orange-deep: #d94f12;
  --tork-orange-soft: #fff1e8;
  --tork-orange-line: rgba(242, 101, 34, 0.5);
  --charcoal: #0a0a0f;
  --ink: #1d2735;
  --muted: #697586;
  --bubble: #f3f5f7;
  --line: #e0e5ec;
  --white: #ffffff;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
}

* { box-sizing: border-box; }

html { min-width: 320px; min-height: 100%; background: var(--white); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--white);
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid rgba(242, 101, 34, 0.38);
  outline-offset: 3px;
}

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  z-index: 2;
  top: 0;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(260px, 2.7fr) minmax(78px, 1fr);
  align-items: center;
  gap: var(--space-6);
  min-height: 72px;
  padding: 0 32px;
  color: var(--white);
  background: var(--charcoal);
  box-shadow: 0 2px 9px rgba(10, 10, 15, 0.18);
  border-bottom: 2px solid var(--tork-orange);
}

.brand {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  object-fit: cover;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  letter-spacing: -0.065em;
}

.brand-name { font-size: 1.3rem; font-weight: 820; line-height: 1; }
.brand-name span { color: var(--tork-orange); }
.brand-garage { margin-top: 3px; color: #c7c8cc; font-size: 0.48rem; font-weight: 700; letter-spacing: 0.25em; line-height: 1; }

.progress-wrap { position: relative; height: 22px; margin: 0 10px; }
.progress-rail, .progress-rail span { position: absolute; top: 10px; left: 0; height: 2px; border-radius: 4px; }
.progress-rail { right: 0; background: rgba(255, 255, 255, 0.24); }
.progress-rail span {
  top: 0;
  width: 0;
  background: var(--tork-orange);
  transform-origin: left center;
  transition: width 520ms cubic-bezier(0.2, 0.75, 0.25, 1);
}
.progress-dots { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; }
.progress-dot {
  width: 10px;
  height: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: var(--charcoal);
  transition: background 240ms ease, box-shadow 240ms ease, transform 240ms ease;
}
.progress-dot.is-active, .progress-dot.is-complete {
  border-color: var(--tork-orange);
  background: var(--tork-orange);
}
.progress-dot.is-active { transform: scale(1.14); box-shadow: 0 0 0 3px rgba(242, 101, 34, 0.2); }

.step-count { display: flex; justify-content: flex-end; align-items: baseline; gap: 7px; white-space: nowrap; }
.step-count strong { color: var(--tork-orange); font-size: 1.8rem; font-weight: 720; line-height: 1; }
.step-count span { font-size: 0.84rem; opacity: 0.88; }

.chat-stage { flex: 1; width: 100%; }
.conversation {
  width: min(100% - 40px, 710px);
  margin: 16px auto 64px;
  padding: 0 0 16px;
}

.message-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  margin: 0 0 18px;
  animation: message-arrive 360ms cubic-bezier(0.18, 0.7, 0.2, 1) both;
}

.message-row.user { display: flex; justify-content: flex-end; margin: 0 0 18px; }
.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid var(--white);
  border-radius: 50%;
  color: var(--white);
  background: #182739;
  box-shadow: 0 2px 8px rgba(24, 39, 57, 0.14);
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.01em;
}

.bubble {
  width: fit-content;
  max-width: min(100%, 530px);
  margin: 0;
  padding: 17px 20px;
  border-radius: 17px 17px 17px 5px;
  color: var(--ink);
  background: var(--bubble);
  font-size: 0.98rem;
  line-height: 1.68;
}

.bubble strong { font-weight: 720; }
.user-bubble {
  max-width: min(88%, 430px);
  padding: 13px 18px;
  border-radius: 17px 17px 5px 17px;
  color: var(--white);
  background: var(--tork-orange-deep);
  font-size: 0.94rem;
  line-height: 1.5;
}

.typing-bubble { display: flex; align-items: center; gap: 12px; min-height: 52px; color: #687486; font-size: 0.88rem; }
.typing-dots { display: flex; gap: 4px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--tork-orange); animation: typing 950ms infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: 140ms; }
.typing-dots i:nth-child(3) { animation-delay: 280ms; }

.prompt-row, .form-row { margin: -2px 0 24px 60px; animation: message-arrive 300ms ease both; }
.prompt-row { display: flex; justify-content: flex-end; }
.select-button, .primary-button, .quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.select-button {
  min-height: 54px;
  max-width: 100%;
  gap: 18px;
  padding: 0 18px;
  border-radius: 13px 13px 5px 13px;
  color: var(--white);
  background: var(--tork-orange);
  font-size: 0.94rem;
  text-align: left;
}
.select-button:hover, .primary-button:hover { background: #bd4310; transform: translateY(-1px); }
.select-button .chevron { font-size: 1.1rem; opacity: 0.8; }

.form-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.inline-form { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; width: 100%; }
.field-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.text-field {
  width: min(100%, 320px);
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid #d6dee8;
  border-radius: 11px;
  color: var(--ink);
  background: var(--white);
  font-size: 0.94rem;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.text-field::placeholder { color: #8a95a4; }
.text-field:focus { border-color: var(--tork-orange); outline: none; box-shadow: 0 0 0 3px rgba(242, 101, 34, 0.14); }
.phone-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; justify-content: stretch; }
.phone-form .city-field { grid-column: 1 / -1; width: 100%; max-width: 480px; flex: none; }
.phone-control { display: flex; flex: 1 1 360px; width: min(100%, 392px); min-width: 0; }
.phone-form .phone-control { grid-column: 1; width: 100%; max-width: 480px; }
.phone-form .primary-button { grid-column: 2; grid-row: 2; }
.phone-form .contact-error { grid-column: 1 / -1; grid-row: 3; margin: 0; color: #b42318; font-size: 0.8rem; line-height: 1.45; }
.country-select {
  flex: 0 0 164px;
  width: 164px;
  min-height: 50px;
  padding: 0 10px;
  border: 1px solid #d6dee8;
  border-right: 0;
  border-radius: 11px 0 0 11px;
  color: #334258;
  background: #f8fafc;
  cursor: pointer;
  font-size: 0.82rem;
}
.country-select:focus-visible { position: relative; z-index: 1; }
.phone-number { flex: 1 1 210px !important; width: 1px; min-width: 0; border-radius: 0 11px 11px 0; }
.primary-button, .quiet-button { min-height: 48px; padding: 0 18px; border-radius: 10px; font-size: 0.92rem; font-weight: 630; }
.primary-button { color: var(--white); background: var(--tork-orange); }
.quiet-button { border: 1px solid var(--line); color: #516074; background: var(--white); }
.quiet-button:hover { border-color: #a6b9d0; background: #f7f9fb; }
.form-help { flex: 0 0 100%; margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.5; text-align: right; }
.form-row.stack { display: block; }
.form-row.stack .inline-form { justify-content: flex-start; }
.form-row.stack .form-help { text-align: left; margin-top: 10px; }
.form-row.stack .text-field { flex: 1 1 230px; }

.booking-card {
  width: min(100% - 60px, 580px);
  margin: 4px 0 24px 60px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 5px 18px rgba(34, 55, 81, 0.045);
  animation: message-arrive 360ms ease both;
}
.booking-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.booking-head h2 { margin: 0; color: var(--ink); font-size: 1.02rem; font-weight: 680; letter-spacing: -0.02em; }
.booking-head p { margin: 5px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.booking-badge { flex: 0 0 auto; padding: 6px 8px; border-radius: 20px; color: #923b12; background: var(--tork-orange-soft); font-size: 0.68rem; font-weight: 650; }
.booking-handoff { display: flex; align-items: flex-start; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfd; }
.booking-duration { display: grid; flex: 0 0 48px; width: 48px; height: 48px; align-content: center; justify-items: center; border-radius: 10px; color: #853b1b; background: var(--tork-orange-soft); line-height: 1; }
.booking-duration strong { font-size: 1rem; }
.booking-duration span { margin-top: 3px; font-size: 0.66rem; }
.booking-handoff-copy { min-width: 0; }
.booking-handoff-copy h3 { margin: 0; color: var(--ink); font-size: 0.88rem; font-weight: 680; }
.booking-handoff-copy p { margin: 6px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }
.booking-handoff-copy .booking-privacy-note { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); color: #697789; font-size: 0.72rem; }
.booking-action-row { display: flex; justify-content: flex-end; margin-top: 16px; }
.booking-action-row .primary-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.booking-action-row .primary-button:focus-visible { outline: 3px solid rgba(242, 101, 34, 0.28); outline-offset: 3px; }

.local-note { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 37px; padding: 0 16px 12px; color: #7d8794; font-size: 0.72rem; text-align: center; }
.local-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tork-orange); box-shadow: 0 0 0 3px rgba(242, 101, 34, 0.12); }

.choice-dialog {
  width: min(410px, calc(100% - 32px));
  max-height: min(78vh, 640px);
  padding: 0;
  overflow: auto;
  border: 1px solid #e1e6ed;
  border-radius: 15px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 20px 60px rgba(16, 32, 51, 0.22);
}
.choice-dialog[open] { animation: dialog-arrive 220ms cubic-bezier(0.16, 0.72, 0.24, 1) both; }
.choice-dialog::backdrop { background: rgba(23, 36, 51, 0.27); backdrop-filter: blur(1px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 21px 22px 14px; }
.dialog-head h2 { margin: 0; font-size: 1.03rem; font-weight: 700; letter-spacing: -0.025em; }
.dialog-head p { min-height: 15px; margin: 5px 0 0; color: var(--muted); font-size: 0.76rem; }
.icon-close { width: 30px; height: 30px; margin-top: -4px; border: 0; border-radius: 8px; color: #718096; background: transparent; cursor: pointer; font-size: 1.35rem; line-height: 1; }
.icon-close:hover { color: var(--ink); background: #f1f4f7; }
.choice-list { padding: 0 12px 12px; }
.choice-option {
  display: block;
  width: 100%;
  min-height: 45px;
  padding: 11px 12px;
  border: 0;
  border-radius: 9px;
  color: #39485b;
  background: var(--white);
  cursor: pointer;
  font-size: 0.88rem;
  line-height: 1.4;
  text-align: left;
  transition: background 140ms ease, color 140ms ease;
}
.choice-option:hover, .choice-option:focus-visible { color: var(--tork-orange-deep); background: var(--tork-orange-soft); }

.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; }

@keyframes message-arrive { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dialog-arrive { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes typing { 0%, 60%, 100% { opacity: 0.4; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

@media (max-width: 700px) {
  .topbar { grid-template-columns: 124px minmax(72px, 1fr) 47px; gap: 8px; min-height: 64px; padding: 0 16px; }
  .brand { gap: 7px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 7px; }
  .brand-name { font-size: 1.19rem; }
  .progress-wrap { margin: 0 4px; }
  .progress-dot { width: 9px; height: 9px; }
  .step-count { gap: 5px; }
  .step-count strong { font-size: 1.52rem; }
  .step-count span { font-size: 0.72rem; }
  .conversation { width: min(100% - 28px, 590px); margin-top: 14px; }
  .message-row { grid-template-columns: 38px minmax(0, 1fr); gap: 11px; margin-bottom: 15px; }
  .avatar { width: 38px; height: 38px; font-size: 0.66rem; }
  .bubble { padding: 14px 15px; border-radius: 15px 15px 15px 5px; font-size: 0.92rem; line-height: 1.58; }
  .prompt-row, .form-row { margin-left: 49px; }
  .select-button { min-height: 49px; gap: 12px; padding: 0 14px; font-size: 0.86rem; }
  .booking-card { width: calc(100% - 49px); margin-left: 49px; padding: 16px; }
  .local-note { font-size: 0.68rem; }
}

@media (max-width: 420px) {
  .topbar { grid-template-columns: 116px minmax(70px, 1fr) 44px; gap: 7px; padding: 0 12px; }
  .brand { gap: 6px; }
  .brand-mark { width: 29px; height: 29px; border-radius: 6px; }
  .brand-name { font-size: 1.05rem; }
  .brand-garage { font-size: 0.42rem; }
  .step-count strong { font-size: 1.38rem; }
  .step-count span { font-size: 0.65rem; }
  .conversation { width: calc(100% - 24px); margin-top: 12px; }
  .message-row { grid-template-columns: 34px minmax(0, 1fr); gap: 9px; }
  .avatar { width: 34px; height: 34px; }
  .bubble { padding: 12px 13px; font-size: 0.88rem; }
  .prompt-row, .form-row { margin-left: 43px; }
  .select-button { max-width: 100%; font-size: 0.82rem; }
  .booking-card { width: calc(100% - 43px); margin-left: 43px; padding: 13px; }
  .booking-badge { padding: 5px 6px; font-size: 0.61rem; }
  .booking-head h2 { font-size: 0.94rem; }
  .booking-head p { max-width: 220px; font-size: 0.77rem; }
  .booking-handoff { gap: 10px; padding: 12px; }
  .booking-action-row .primary-button { width: 100%; }
  .country-select { flex-basis: 132px; width: 132px; padding: 0 7px; font-size: 0.76rem; }
  .phone-form { grid-template-columns: minmax(0, 1fr); }
  .phone-form .phone-control, .phone-form .primary-button { grid-column: 1; width: 100%; }
}

@media (max-width: 760px) {
  .phone-form { grid-template-columns: minmax(0, 1fr); row-gap: 10px; }
  .phone-form .city-field,
  .phone-form .phone-control,
  .phone-form .contact-error,
  .phone-form .primary-button {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
    max-width: 480px;
  }
}

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