/* ========================================
   CSS Custom Properties & Reset
   ======================================== */
:root {
  --clr-bg: #f4f1ec;
  --clr-surface: #ffffff;
  --clr-surface-hover: #fafaf8;
  --clr-primary: #1a3a2a;
  --clr-primary-light: #2d5e42;
  --clr-accent: #c8875f;
  --clr-accent-light: #e4b48e;
  --clr-text: #1e1e1e;
  --clr-text-muted: #6b6b6b;
  --clr-border: #d4d0ca;
  --clr-border-focus: #1a3a2a;
  --clr-error: #c0392b;
  --clr-error-bg: #fdf0ef;
  --clr-success: #27ae60;
  --clr-success-bg: #eafaf1;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--clr-text);
  background: var(--clr-bg);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ========================================
   Environment Ribbon
   ======================================== */
.env-ribbon {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 9999;
  padding: 4px 14px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  opacity: 0.85;
}

/* ========================================
   Background Texture
   ======================================== */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(200, 135, 95, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(26, 58, 42, 0.06) 0%, transparent 60%), var(--clr-bg);
}

/* Shown when ?reschedule=1 is present in the URL — the candidate clicked
   the "Pick a new time" button on the chat API's /reschedule confirmation
   page after canceling a prior meeting. See app.js isRescheduleLanding. */
.reschedule-banner {
  max-width: 680px;
  margin: 16px auto 0;
  padding: 14px 20px;
  background: var(--clr-success-bg);
  border: 1px solid var(--clr-success);
  border-radius: var(--radius-md);
  color: var(--clr-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.5;
}

.nav-logo {
  color: #1b4029;
  width: 140px;
  position: relative;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 15px;
}

/* ========================================
   Form Container
   ======================================== */
.form-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  position: relative;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   Step Panels — Multi-step Transitions
   ======================================== */
.step-panel {
  display: none;
  opacity: 0;
}

.step-panel.is-active {
  display: block;
  animation: panelEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.step-panel.is-exiting {
  display: block;
  animation: panelExit 0.4s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes panelEnter {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes panelExit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-20px) scale(0.97);
  }
}

/* ========================================
   Step Indicator Dots
   ======================================== */
.step-indicator {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--clr-border);
  transition: all 0.4s ease;
}

.step-dot.is-current {
  background: var(--clr-accent);
  box-shadow: 0 0 0 3px rgba(200, 135, 95, 0.2);
  transform: scale(1.15);
}

.step-dot.is-complete {
  background: var(--clr-success);
}

/* ========================================
   Header
   ======================================== */
.form-header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.header-accent {
  width: 48px;
  height: 4px;
  background: linear-gradient(90deg, var(--clr-accent), var(--clr-accent-light));
  border-radius: 2px;
  margin: 0 auto 20px;
}

.form-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  color: var(--clr-primary);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--clr-text-muted);
  font-size: 0.95rem;
  font-weight: 400;
}

/* ========================================
   Sections
   ======================================== */
.form-section {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px 20px;
  margin-bottom: 15px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.form-section:hover {
  box-shadow: var(--shadow-md);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-primary);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--clr-border);
  text-transform: none;
}

/* ========================================
   Field Layout
   ======================================== */
.field-row {
  display: grid;
  gap: 16px;
  margin-bottom: 0;
}

.field-row.two-col {
  grid-template-columns: 1fr 1fr;
}
.field-row.three-col {
  grid-template-columns: 1fr 1fr 1fr;
}

.field-group {
  margin-bottom: 10px;
  position: relative;
}

.field-row .field-group {
  margin-bottom: 10px;
}

/* ========================================
   Labels
   ======================================== */
label,
span.label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--clr-text);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.req {
  color: var(--clr-accent);
  font-weight: 600;
}

/* ========================================
   Inputs & Selects
   ======================================== */
input,
select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--clr-text);
  background-color: var(--clr-surface);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background-color var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

input::placeholder {
  color: #b5b0a8;
}

input:hover,
select:hover {
  border-color: #aaa69e;
  background-color: var(--clr-surface-hover);
}

input:focus,
select:focus {
  border-color: var(--clr-border-focus);
  box-shadow: 0 0 0 3px rgba(26, 58, 42, 0.1);
  background-color: var(--clr-surface);
}

select:focus {
  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' stroke='%236b6b6b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Select arrow */
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' stroke='%236b6b6b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Date input fix */
input[type='date'] {
  cursor: pointer;
}

input[type='date']::-webkit-date-and-time-value {
  text-align: left;
}

/* DOB placeholder state */
.dob-placeholder {
  color: #b5b0a8 !important;
}

/* Number input - remove spinners */
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type='number'] {
  -moz-appearance: textfield;
}

/* ========================================
   Validation States
   ======================================== */
.field-group.is-valid input,
.field-group.is-valid select {
  border-color: var(--clr-success);
}

.field-group.is-valid input:focus,
.field-group.is-valid select:focus {
  box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.12);
}

.field-group.is-invalid input,
.field-group.is-invalid select {
  border-color: var(--clr-error);
  background-color: var(--clr-error-bg);
}

.field-group.is-invalid select {
  border-color: var(--clr-error);
  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' stroke='%236b6b6b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

.field-group.is-invalid input:focus,
.field-group.is-invalid select:focus {
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.field-error {
  display: block;
  min-height: 18px;
  font-size: 0.78rem;
  color: var(--clr-error);
  margin-top: 4px;
  line-height: 1.3;
  transition: opacity var(--transition);
}

/* ========================================
   Radio Card Groups (Yes/No for Step 2)
   ======================================== */
.radio-row {
  display: flex;
  gap: 12px;
}

.radio-card {
  flex: 1;
  position: relative;
  cursor: pointer;
}

.radio-card input[type='radio'] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-label {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--clr-text-muted);
  background: var(--clr-surface);
  transition: all var(--transition);
  user-select: none;
  text-transform: none;
  letter-spacing: 0;
}

.radio-card:hover .radio-label {
  border-color: #aaa69e;
  background: var(--clr-surface-hover);
}

.radio-card input:checked + .radio-label {
  border-color: var(--clr-primary);
  background: rgba(26, 58, 42, 0.05);
  color: var(--clr-primary);
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(26, 58, 42, 0.08);
}

.radio-card input:focus-visible + .radio-label {
  outline: 2px solid var(--clr-primary);
  outline-offset: 2px;
}

/* Validation states for radio groups */
.field-group.is-invalid .radio-label {
  border-color: var(--clr-error);
  background: var(--clr-error-bg);
}

/*.field-group.is-valid .radio-label {
  border-color: var(--clr-success);
}*/
.field-group.is-valid .radio-card input:checked + .radio-label {
  border-color: var(--clr-success);
  background: rgba(39, 174, 96, 0.05);
  color: var(--clr-success);
}

/* ========================================
   Submit Button
   ======================================== */
.form-footer {
  text-align: center;
  font-size: 0.82rem;
  color: #666666;
}

.form-footer a {
  font-size: 0.82rem;
  margin-bottom: 6px;
  color: #666666;
}

.form-footer a:hover {
  text-decoration: none;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  padding: 0 32px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #fff;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-light));
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(26, 58, 42, 0.25);
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    opacity var(--transition);
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  text-decoration: none;
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26, 58, 42, 0.35);
}

.btn-submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(26, 58, 42, 0.25);
}

.btn-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-submit.is-loading .btn-text {
  opacity: 0;
}
.btn-submit.is-loading .btn-spinner {
  display: block;
}

.btn-secondary {
  background: var(--clr-text-muted);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  max-width: 280px;
}

.btn-spinner {
  display: none;
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   Form Messages
   ======================================== */
.form-message {
  padding: 0;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

.form-message.is-visible {
  padding: 12px 16px;
  max-height: 100px;
  opacity: 1;
  margin-bottom: 16px;
}

.form-message.is-error {
  background-color: var(--clr-error-bg);
  color: var(--clr-error);
  border: 1px solid rgba(192, 57, 43, 0.2);
}

.form-message.is-success {
  background-color: var(--clr-success-bg);
  color: var(--clr-success);
  border: 1px solid rgba(39, 174, 96, 0.2);
}

/* ========================================
   Loading Overlay
   ======================================== */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(244, 241, 236, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
}

.loading-overlay.is-active {
  display: flex;
  animation: overlayIn 0.3s ease-out;
}

.loading-overlay.is-exiting {
  animation: overlayOut 0.4s ease-in forwards;
}

@keyframes overlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes overlayOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.loading-content {
  text-align: center;
}

.loading-ring {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  position: relative;
}

.loading-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  transform-origin: center center;
}

.ring-track {
  fill: none;
  stroke: var(--clr-border);
  stroke-width: 4;
}

.ring-progress {
  fill: none;
  stroke: var(--clr-primary);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 201;
  stroke-dashoffset: 201;
  transition: stroke-dashoffset 0.6s ease;
}

/* Spinning: animate dash on the circle, rotate the whole SVG for the sweeping effect */
.loading-ring.is-spinning .ring-progress {
  animation: ringDash 1.4s ease-in-out infinite;
}

.loading-ring.is-spinning svg {
  animation: ringRotate 1.8s linear infinite;
}

@keyframes ringDash {
  0% {
    stroke-dashoffset: 201;
  }
  50% {
    stroke-dashoffset: 50;
  }
  100% {
    stroke-dashoffset: 201;
  }
}

@keyframes ringRotate {
  0% {
    transform: rotate(-90deg);
  }
  100% {
    transform: rotate(270deg);
  }
}

.loading-ring.is-complete svg {
  animation: none;
  transform: rotate(-90deg);
}

.loading-ring.is-complete .ring-progress {
  animation: none;
  stroke-dashoffset: 0;
  stroke: var(--clr-success);
  transition:
    stroke-dashoffset 0.5s ease,
    stroke 0.3s ease;
}

.loading-check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.loading-check svg {
  width: 32px;
  height: 32px;
  color: var(--clr-success);
}

.loading-ring.is-complete .loading-check {
  opacity: 1;
  transform: scale(1);
  transform: rotate(90deg);
}

.loading-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--clr-text-muted);
  transition: opacity 0.3s ease;
}

/* ========================================
   DQ Screen & Success Screen
   ======================================== */
.dq-screen .dq-content,
.success-screen .success-content {
  text-align: center;
  padding: 60px 20px;
}

.dq-icon,
.success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dq-icon {
  background: var(--clr-error-bg);
  color: var(--clr-error);
}
.dq-icon svg,
.success-icon svg {
  width: 36px;
  height: 36px;
}

.dq-content h2,
.success-content h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--clr-primary);
  margin-bottom: 12px;
}

.dq-message,
.success-message {
  color: var(--clr-text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 460px;
  margin: 0 auto 28px;
}

.success-icon {
  background: var(--clr-success-bg);
  color: var(--clr-success);
  animation: successPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

@keyframes successPop {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========================================
   Chat Interface (iMessage-style)
   ======================================== */
.chat-container {
  max-width: 480px;
  margin: 0 auto;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

.chat-container.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--clr-primary);
  color: #fff;
}

.chat-avatar {
  position: relative;
  flex-shrink: 0;
}

.avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.avatar-online {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  background: #4ade80;
  border: 2px solid var(--clr-primary);
  border-radius: 50%;
}

.chat-header-info {
  display: flex;
  flex-direction: column;
}

.chat-name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
}

.chat-role {
  font-size: 0.75rem;
  opacity: 0.75;
  font-weight: 400;
}

.chat-messages {
  padding: 20px 16px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Incoming message bubble */
.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(8px) scale(0.95);
  animation: bubbleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  /* Wrap long words / URLs so nothing overflows the bubble or the
     viewport on mobile. `overflow-wrap: anywhere` is the modern safe
     default; `word-break: break-word` is a fallback for older WebKit. */
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-bubble.incoming {
  background: #e9e9eb;
  color: var(--clr-text);
  border-bottom-left-radius: 6px;
  align-self: flex-start;
}

.chat-bubble.outgoing {
  background: #007aff;
  color: #fff;
  border-bottom-right-radius: 6px;
  align-self: flex-end;
}

.chat-bubble a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  /* Inherit the bubble's wrap rules so a long URL breaks mid-token
     instead of escaping the bubble. */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-bubble.outgoing a {
  color: #fff;
}

@keyframes bubbleIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Typing indicator */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #e9e9eb;
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  align-self: flex-start;
  opacity: 0;
  animation: bubbleIn 0.3s ease forwards;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #8e8e93;
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

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

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* ========================================
    Full Chat View
    ======================================== */
.chat-fullview {
  display: none;
}

.chat-fullview.is-active {
  display: block;
  animation: panelEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.chat-fullview .chat-container {
  opacity: 1;
  transform: none;
  max-width: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: var(--clr-bg);
}

.chat-fullview .chat-header {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.chat-fullview .chat-messages {
  min-height: 200px;
  max-height: 50vh;
  overflow-y: auto;
  background: var(--clr-surface);
  border-left: 1px solid var(--clr-border);
  border-right: 1px solid var(--clr-border);
}

.chat-fullview .chat-input-bar {
  display: flex;
  /* `flex-end` keeps the send button anchored to the bottom of the
     textarea as it grows, matching native messaging-app affordances. */
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.chat-fullview .chat-input {
  flex: 1;
  /* Textarea auto-grows from one line up to ~6 lines (then scrolls).
     Padding is symmetric so the single-line resting state looks like a
     pill input, but the textarea reflows naturally as text wraps. */
  min-height: 42px;
  max-height: 144px;
  padding: 10px 14px;
  border: 1.5px solid var(--clr-border);
  border-radius: 21px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--clr-text);
  background: var(--clr-bg);
  outline: none;
  resize: none;
  overflow-y: auto;
  transition: border-color var(--transition);
  /* Match the chat-bubble wrap behavior so a giant pasted token breaks
     instead of triggering horizontal scroll on mobile. */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-fullview .chat-input:focus {
  border-color: #007aff;
}

.chat-fullview .chat-input::placeholder {
  color: #b5b0a8;
}

.chat-fullview .chat-send-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: #007aff;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--transition),
    transform var(--transition);
  flex-shrink: 0;
}

.chat-fullview .chat-send-btn:hover {
  background: #0066d6;
  transform: scale(1.05);
}

.chat-fullview .chat-send-btn svg {
  width: 18px;
  height: 18px;
}

/* ========================================
   Chat End Screen (SMS handoff / post-booking)
   ======================================== */
.chat-end-screen {
  background: var(--clr-surface);
  border-top: 1px solid var(--clr-border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 20px 18px 22px;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}

.chat-end-screen.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.chat-end-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.chat-end-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--clr-success-bg);
  color: var(--clr-success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.chat-end-icon svg {
  width: 24px;
  height: 24px;
}

.chat-end-title {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--clr-text);
  margin: 0;
}

.chat-end-body {
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--clr-text-muted);
  margin: 0;
  /* Wrap meeting details / long words gracefully on narrow screens. */
  overflow-wrap: anywhere;
}

.chat-end-body strong {
  color: var(--clr-text);
  font-weight: 600;
}

.chat-end-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  margin-top: 8px;
}

.chat-end-btn {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 22px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--transition),
    transform var(--transition);
}

.chat-end-btn.primary {
  background: #007aff;
  color: #fff;
}

.chat-end-btn.primary:hover {
  background: #0066d6;
  transform: scale(1.02);
}

.chat-end-btn.secondary {
  background: transparent;
  color: #007aff;
  border: 1.5px solid #007aff;
}

.chat-end-btn.secondary:hover {
  background: rgba(0, 122, 255, 0.08);
}

/* Generic visibility utility used by the chat end-screen flow to
   temporarily hide the input bar while keeping the DOM intact. */
.is-hidden {
  display: none !important;
}

/* ========================================
   Mobile Responsive
   ======================================== */
@media (max-width: 600px) {
  .form-container {
    padding: 24px 16px 48px;
  }

  .form-section {
    padding: 20px 16px 16px;
  }

  .field-row.two-col,
  .field-row.three-col {
    grid-template-columns: 1fr;
  }

  .field-row.three-col {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .btn-submit {
    max-width: 100%;
  }

  .form-header {
    margin-bottom: 28px;
  }

  .field-row .field-group {
    margin-bottom: 5px;
  }

  .field-row {
    margin-bottom: 0px;
    gap: 0px;
  }
  .field-group {
    margin-left: 5px;
    margin-right: 5px;
  }

  /* Bump the chat-input font-size to 16px on mobile so iOS Safari
     doesn't auto-zoom the viewport when the textarea gains focus. */
  .chat-fullview .chat-input {
    font-size: 16px;
  }

  .chat-end-screen {
    padding: 18px 14px 20px;
  }
  .chat-end-actions {
    max-width: 100%;
  }
}

@media (max-width: 380px) {
  .field-row.three-col {
    grid-template-columns: 1fr 1fr;
  }
  .field-row.three-col .field-group:last-child {
    grid-column: 1 / -1;
  }
}

/* ========================================
   Focus Visible (keyboard nav)
   ======================================== */
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--clr-primary);
  outline-offset: 2px;
}

.btn-submit:focus-visible {
  outline: 2px solid var(--clr-accent);
  outline-offset: 3px;
}

/* ========================================
   Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
