/* Therapist matching intake form — mobile-first wizard */

body.page-match {
  --tm-teal: #024442;
  --tm-teal-mid: #0a514d;
  --tm-teal-deep: #013a3a;
  --tm-teal-light: #e8f3f0;
  --tm-ink: #183331;
  --tm-muted: #677a78;
  --tm-line: #d5dfdd;
  --tm-soft: #f3f6f5;
  --tm-white: #ffffff;
  --tm-radius: 18px;
  --tm-shadow: 0 12px 30px rgba(15, 62, 59, 0.08);
  --tm-nav-h: 76px;

  margin: 0;
  font-family: Vazirmatn, IRANSans, Tahoma, Arial, sans-serif;
  background: var(--tm-soft);
  color: var(--tm-ink);
  line-height: 1.75;
}

body.page-match .chat-button,
body.page-match .chat-widget {
  display: none !important;
}

body.page-match .main-header {
  background: rgba(247, 248, 248, 0.92) !important;
  border-bottom: 1px solid var(--tm-line);
  box-shadow: none !important;
}

body.page-match .tm-container {
  width: min(980px, calc(100% - 32px));
  max-width: 980px;
  margin-inline: auto;
  padding-inline: 0;
}

body.page-match .main-header .nav-container {
  width: min(1180px, calc(100% - 48px)) !important;
  max-width: 1180px !important;
  padding-inline: 0 !important;
}

.tm-main {
  padding: 28px 16px 64px;
}

/* Hero */
.tm-hero {
  margin-bottom: 20px;
  text-align: right;
  transition: opacity 0.35s ease, max-height 0.35s ease, margin 0.35s ease;
}

body.tm-started .tm-hero {
  margin-bottom: 12px;
}

body.tm-started .tm-lead,
body.tm-started .tm-trust-row {
  display: none;
}

body.tm-started .tm-hero h1 {
  font-size: clamp(1.1rem, 3.5vw, 1.45rem);
}

.tm-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--tm-teal-mid);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.tm-back:hover {
  color: var(--tm-teal-deep);
}

.tm-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--tm-teal-mid);
  font-size: 0.86rem;
  font-weight: 700;
}

.tm-kicker::before,
.tm-kicker::after {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.4;
}

.tm-hero h1 {
  margin: 0 0 8px;
  color: var(--tm-teal-mid);
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 800;
  line-height: 1.4;
}

.tm-lead {
  margin: 0 0 14px;
  color: var(--tm-muted);
  font-size: 0.95rem;
  line-height: 1.85;
}

.tm-trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 4px;
}

.tm-trust-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(10, 81, 77, 0.12);
  color: var(--tm-teal-mid);
  font-size: 0.78rem;
  font-weight: 700;
}

.tm-trust-row i {
  color: var(--tm-teal);
  font-size: 0.82rem;
}

/* Layout */
.tm-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.tm-layout-side {
  position: sticky;
  top: 88px;
}

.tm-step-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: 20px;
  background: var(--tm-white);
  border: 1px solid rgba(194, 206, 203, 0.75);
  box-shadow: var(--tm-shadow);
}

.tm-step-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--tm-muted);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  text-align: right;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tm-step-pill-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #eef2f1;
  color: var(--tm-teal-mid);
  font-size: 0.68rem;
  flex-shrink: 0;
}

.tm-step-pill-label {
  line-height: 1.4;
}

.tm-step-pill:hover {
  background: #f4f8f6;
}

.tm-step-pill.is-active {
  background: #eef5f2;
  border-color: rgba(10, 81, 77, 0.18);
  color: var(--tm-teal-mid);
}

.tm-step-pill.is-active .tm-step-pill-num {
  background: var(--tm-teal);
  color: #fff;
}

.tm-step-pill.is-done .tm-step-pill-num {
  background: #d7ebe4;
  color: var(--tm-teal);
}

/* Progress */
.tm-progress-wrap {
  margin-bottom: 14px;
}

.tm-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--tm-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

#tmProgressSection {
  color: var(--tm-teal-mid);
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}

.tm-progress-bar {
  height: 5px;
  border-radius: 999px;
  background: #e2ebe8;
  overflow: hidden;
}

.tm-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--tm-teal), var(--tm-teal-mid));
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Card & wizard viewport */
.tm-card {
  border: 1px solid rgba(194, 206, 203, 0.75);
  border-radius: 24px;
  background: var(--tm-white);
  box-shadow: var(--tm-shadow);
  overflow: hidden;
}

.tm-card-wizard {
  display: flex;
  flex-direction: column;
  position: relative;
}

.tm-slide-viewport {
  flex: 1;
  min-height: 320px;
  position: relative;
}

.tm-form {
  padding: 0;
}

.tm-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 280px;
  color: var(--tm-muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.tm-loading[hidden],
.tm-form[hidden] {
  display: none !important;
}

.tm-loading i {
  font-size: 1.6rem;
  color: var(--tm-teal);
}

/* Slides */
.tm-slide {
  display: flex;
  flex-direction: column;
  padding: 24px 26px 16px;
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.32s ease, transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.tm-slide-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.tm-slide-body-intro {
  justify-content: center;
}

.tm-slide[hidden] {
  display: none !important;
}

.tm-slide-active {
  opacity: 1;
  transform: translateX(0);
}

.tm-slide-enter {
  animation: tmSlideIn 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes tmSlideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.tm-slide-shake {
  animation: tmShake 0.45s ease;
}

@keyframes tmShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.tm-slide-head {
  margin-bottom: 16px;
}

.tm-slide-section {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--tm-teal-light);
  color: var(--tm-teal-mid);
  font-size: 0.72rem;
  font-weight: 700;
}

/* Intro slide */
.tm-intro {
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
}

.tm-intro-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--tm-teal-light), #fff);
  color: var(--tm-teal);
  font-size: 1.6rem;
}

.tm-intro h2 {
  margin: 0 0 14px;
  color: var(--tm-teal-mid);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.5;
}

.tm-intro p {
  margin: 0 0 10px;
  color: var(--tm-muted);
  font-size: 0.92rem;
  line-height: 1.9;
  text-align: right;
}

.tm-intro-highlight {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #eef5f2;
  border: 1px solid rgba(10, 81, 77, 0.12);
  text-align: right;
}

.tm-intro-highlight i {
  color: var(--tm-teal);
  font-size: 1.25rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.tm-intro-highlight p {
  margin: 0;
  color: var(--tm-teal-mid);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.75;
}

.tm-intro-features {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tm-intro-features li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #f7faf9;
  border: 1px solid rgba(10, 81, 77, 0.1);
  color: var(--tm-teal-mid);
  font-size: 0.78rem;
  font-weight: 700;
}

.tm-intro-features i {
  color: var(--tm-teal);
  font-size: 0.8rem;
}

/* Fields — one question per slide */
.tm-field {
  margin-bottom: 0;
}

.tm-field[hidden] {
  display: none !important;
}

.tm-field-solo .tm-question {
  font-size: clamp(1.05rem, 3.5vw, 1.2rem);
  margin-bottom: 4px;
}

.tm-question,
.tm-choice-group legend {
  display: block;
  margin: 0 0 14px;
  color: var(--tm-ink);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.65;
  padding: 0;
  border: none;
}

.tm-choice-group {
  margin: 0;
  padding: 0;
  border: none;
}

.tm-req {
  color: #c0392b;
}

.tm-hint {
  margin: -8px 0 14px;
  color: var(--tm-muted);
  font-size: 0.82rem;
  line-height: 1.65;
}

.tm-input,
.tm-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 2px solid var(--tm-line);
  border-radius: 16px;
  background: #fafbfb;
  color: var(--tm-ink);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  text-align: right;
  direction: rtl;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.tm-input::placeholder,
.tm-form textarea::placeholder {
  text-align: right;
  direction: rtl;
  color: #9aa8a6;
  opacity: 1;
}

.tm-input[type="tel"],
.tm-input[type="number"],
.tm-input[type="email"] {
  text-align: right;
  direction: rtl;
}

.tm-input[type="tel"]::placeholder,
.tm-input[type="number"]::placeholder,
.tm-input[type="email"]::placeholder {
  text-align: right;
  direction: rtl;
}

.tm-input[type="tel"]:not(:placeholder-shown),
.tm-input[type="number"]:not(:placeholder-shown) {
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
}

.tm-input:focus,
.tm-form textarea:focus {
  outline: none;
  border-color: var(--tm-teal);
  box-shadow: 0 0 0 4px rgba(2, 68, 66, 0.1);
  background: #fff;
}

.tm-form textarea {
  resize: vertical;
  min-height: 120px;
}

/* Choice cards */
.tm-choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tm-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 16px 16px;
  min-height: 56px;
  border: 2px solid var(--tm-line);
  border-radius: 16px;
  background: #fafbfb;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.tm-choice:active {
  transform: scale(0.985);
}

.tm-choice:hover {
  border-color: rgba(10, 81, 77, 0.35);
  background: #f4f8f6;
}

.tm-choice input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.tm-choice-text {
  flex: 1;
  color: var(--tm-ink);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.6;
  text-align: right;
}

.tm-choice-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid var(--tm-line);
  color: transparent;
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tm-choice:has(input:checked) {
  border-color: var(--tm-teal);
  background: #eef5f2;
  box-shadow: 0 4px 16px rgba(2, 68, 66, 0.08);
}

.tm-choice:has(input:checked) .tm-choice-check {
  background: var(--tm-teal);
  border-color: var(--tm-teal);
  color: #fff;
}

/* Scale */
.tm-scale-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--tm-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.tm-scale-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
}

.tm-scale-item {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-height: 48px;
  border: 2px solid var(--tm-line);
  border-radius: 14px;
  background: #fafbfb;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--tm-teal-mid);
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.tm-scale-item:active {
  transform: scale(0.95);
}

.tm-scale-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tm-scale-item:has(input:checked) {
  border-color: var(--tm-teal);
  background: var(--tm-teal);
  color: #fff;
  box-shadow: 0 4px 12px rgba(2, 68, 66, 0.2);
}

/* Nav buttons */
.tm-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 22px 22px;
  border-top: 1px solid var(--tm-line);
  background: #fafbfb;
}

.tm-nav[hidden],
.tm-submitting[hidden],
.tm-success-screen[hidden],
#tmWizardCard[hidden] {
  display: none !important;
}

.tm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 12px 20px;
  border-radius: 16px;
  border: none;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.tm-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.tm-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tm-btn.primary {
  background: var(--tm-teal);
  color: #fff;
  margin-right: auto;
  min-width: 140px;
  box-shadow: 0 6px 20px rgba(2, 68, 66, 0.22);
}

.tm-btn.primary:hover:not(:disabled) {
  background: var(--tm-teal-deep);
}

.tm-btn.ghost {
  background: transparent;
  border: 2px solid rgba(10, 81, 77, 0.22);
  color: var(--tm-teal-mid);
  min-width: 90px;
}

.tm-btn.ghost:hover:not(:disabled) {
  background: #eef5f2;
}

/* Alert */
.tm-alert {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fdeeee;
  border: 1px solid #f0caca;
  color: #8b2e2e;
  font-size: 0.88rem;
  font-weight: 600;
  transform: translateY(-8px);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.tm-alert[hidden] {
  display: none !important;
}

.tm-alert.tm-alert-show {
  opacity: 1;
  transform: translateY(0);
}

/* Error & success */
.tm-error {
  padding: 36px 24px;
  text-align: center;
}

.tm-error i {
  font-size: 2.2rem;
  color: #c0392b;
  margin-bottom: 10px;
}

.tm-error h2 {
  margin: 0 0 8px;
  color: var(--tm-teal-mid);
  font-size: 1.1rem;
}

.tm-error p {
  margin: 0 0 16px;
  color: var(--tm-muted);
  font-size: 0.9rem;
}

body.tm-pre-consult .tm-kicker::before,
body.tm-pre-consult .tm-kicker::after {
  background: linear-gradient(90deg, transparent, var(--tm-teal-mid));
}

body.tm-pre-consult .tm-btn.primary {
  background: linear-gradient(135deg, #024442, #0a6b65);
}

/* Submitting overlay */
.tm-submitting {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.96);
  border-radius: inherit;
}

.tm-submitting-inner {
  text-align: center;
  color: var(--tm-muted);
}

.tm-submitting-inner i {
  font-size: 2rem;
  color: var(--tm-teal);
  margin-bottom: 14px;
}

.tm-submitting-inner p {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

/* Success screen */
.tm-success-screen {
  animation: tmSlideIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.tm-success-card {
  background: var(--tm-white);
  border: 1px solid rgba(194, 206, 203, 0.75);
  border-radius: 24px;
  padding: 36px 24px 28px;
  text-align: center;
  box-shadow: var(--tm-shadow);
}

.tm-success-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--tm-teal), var(--tm-teal-mid));
  color: #fff;
  font-size: 1.9rem;
  box-shadow: 0 10px 28px rgba(2, 68, 66, 0.28);
  animation: tmSuccessPop 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.tm-success-title {
  margin: 0 0 12px;
  color: var(--tm-teal-mid);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.5;
}

.tm-success-message {
  margin: 0 auto 24px;
  color: var(--tm-muted);
  font-size: 0.92rem;
  line-height: 1.85;
  max-width: 420px;
}

.tm-success-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
  text-align: right;
}

.tm-success-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f7faf9;
  border: 1px solid rgba(10, 81, 77, 0.1);
  color: var(--tm-ink);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.5;
}

.tm-success-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--tm-teal-light);
  color: var(--tm-teal);
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
}

.tm-success-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.tm-success-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 14px 20px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.tm-success-btn.primary {
  background: var(--tm-teal);
  color: #fff !important;
  box-shadow: 0 6px 20px rgba(2, 68, 66, 0.22);
}

.tm-success-btn.primary:active {
  transform: scale(0.98);
}

.tm-success-btn.secondary {
  background: #fff;
  color: var(--tm-teal-mid) !important;
  border: 1.5px solid rgba(10, 81, 77, 0.28);
}

.tm-success-btn.secondary:hover {
  background: var(--tm-teal-light);
}

/* Completed state — reclaim full width (sidebar was taking the first grid track) */
body.tm-completed .tm-layout {
  display: block;
}

body.tm-completed .tm-layout-side {
  display: none !important;
}

body.tm-completed .tm-layout-main,
body.tm-completed .tm-wizard-shell {
  width: 100%;
  max-width: none;
}

body.tm-completed .tm-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - var(--tm-nav-h, 76px));
  padding: 40px 20px 56px;
}

body.tm-completed .tm-container {
  width: min(720px, calc(100% - 32px));
  max-width: 720px;
  margin-inline: auto;
}

body.tm-completed .tm-success-screen {
  width: 100%;
}

body.tm-completed .tm-success-card {
  padding: 48px 44px 36px;
  border-radius: 28px;
}

body.tm-completed .tm-success-badge {
  width: 88px;
  height: 88px;
  font-size: 2.1rem;
  margin-bottom: 22px;
}

body.tm-completed .tm-success-title {
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  margin-bottom: 14px;
}

body.tm-completed .tm-success-message {
  max-width: 540px;
  font-size: 1rem;
  margin-bottom: 28px;
}

body.tm-completed .tm-success-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  text-align: center;
}

body.tm-completed .tm-success-step {
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 14px;
  text-align: center;
  font-size: 0.86rem;
  line-height: 1.65;
  min-height: 100%;
}

body.tm-completed .tm-success-actions {
  flex-direction: row;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

body.tm-completed .tm-success-btn {
  min-width: 200px;
  flex: 1 1 200px;
  max-width: 280px;
}

@media (max-width: 900px) {
  body.tm-completed .tm-success-steps {
    grid-template-columns: 1fr;
    text-align: right;
  }

  body.tm-completed .tm-success-step {
    flex-direction: row;
    align-items: center;
    text-align: right;
    padding: 12px 14px;
    gap: 12px;
  }

  body.tm-completed .tm-success-actions {
    flex-direction: column;
  }

  body.tm-completed .tm-success-btn {
    max-width: none;
    width: 100%;
  }

  body.tm-completed .tm-success-card {
    padding: 36px 24px 28px;
  }
}

/* Legacy success (error states) */
.tm-success {
  padding: 40px 24px 48px;
  text-align: center;
}

.tm-success-icon {
  font-size: 3.5rem;
  color: var(--tm-teal);
  margin-bottom: 16px;
  animation: tmSuccessPop 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes tmSuccessPop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.tm-success h2 {
  margin: 0 0 10px;
  color: var(--tm-teal-mid);
  font-size: 1.25rem;
}

.tm-success p {
  margin: 0 0 20px;
  color: var(--tm-muted);
  font-size: 0.92rem;
  line-height: 1.85;
}

/* Team page — therapist match CTA */
body.page-team .team-match-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  left: auto;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: min(calc(100vw - 32px), 360px);
  padding: 13px 16px 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14) 0%, transparent 42%),
    linear-gradient(135deg, #7a3f8f 0%, #9b4d9f 48%, #c45f7a 100%);
  color: #fff;
  font-family: Vazirmatn, IRANSans, Tahoma, Arial, sans-serif;
  text-decoration: none;
  box-shadow:
    0 10px 28px rgba(122, 63, 143, 0.34),
    0 2px 0 rgba(255, 255, 255, 0.08) inset;
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
  overflow: hidden;
}

body.page-team .team-match-fab::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.12) 50%, transparent 70%);
  transform: translateX(120%);
  transition: transform 0.55s ease;
  pointer-events: none;
}

body.page-team .team-match-fab:hover::before {
  transform: translateX(-120%);
}

body.page-team .team-match-fab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 1rem;
}

body.page-team .team-match-fab-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  text-align: right;
}

body.page-team .team-match-fab-label {
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

body.page-team .team-match-fab-sub {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.82);
}

body.page-team .team-match-fab-arrow {
  font-size: 0.82rem;
  opacity: 0.9;
  flex-shrink: 0;
  margin-inline-start: 2px;
  transition: transform 0.22s ease;
}

body.page-team .team-match-fab:hover {
  transform: translateY(-3px);
  filter: saturate(1.05);
  box-shadow:
    0 16px 36px rgba(122, 63, 143, 0.4),
    0 2px 0 rgba(255, 255, 255, 0.1) inset;
  color: #fff;
}

body.page-team .team-match-fab:hover .team-match-fab-arrow {
  transform: translateX(-4px);
}

body.page-team .team-match-fab:active {
  transform: translateY(-1px);
}

/* Tablet */
@media (max-width: 860px) {
  .tm-layout {
    grid-template-columns: 1fr;
  }

  .tm-layout-side {
    display: none;
  }
}

/* Mobile wizard — Porsline-style full-screen */
@media (max-width: 768px) {
  body.page-match {
    --tm-nav-h: 72px;
    --tm-header-h: 62px;
  }

  body.page-match .main-header {
    padding: 6px 0;
  }

  body.page-match .navbar {
    padding: 6px 0;
  }

  body.page-match .nav-container {
    padding: 0 12px;
  }

  body.page-match .logo img {
    width: 44px;
    height: 44px;
  }

  body.page-match .logo-title {
    font-size: 0.92rem;
  }

  body.page-match .logo-subtitle {
    display: none;
  }

  body.page-match .btn-appointment {
    padding: 8px 10px;
    font-size: 0.72rem;
  }

  body.page-match .btn-appointment i {
    margin: 0;
  }

  .tm-main {
    padding: 12px 14px 20px;
  }

  .tm-container {
    width: 100%;
    max-width: 100%;
    padding-inline: 0;
  }

  /* ── Active form: full-viewport shell ── */
  body.tm-started.page-match {
    overflow: hidden;
    background: #fff;
  }

  body.tm-started .tm-main {
    padding: 0;
    min-height: calc(100dvh - var(--tm-header-h));
    max-height: calc(100dvh - var(--tm-header-h));
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.tm-started .tm-container,
  body.tm-started .tm-layout,
  body.tm-started .tm-layout-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin: 0;
    width: 100%;
  }

  body.tm-started .tm-hero {
    display: none;
  }

  body.tm-started .tm-wizard-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fff;
  }

  body.tm-started .tm-progress-wrap {
    position: relative;
    top: auto;
    flex-shrink: 0;
    margin: 0;
    padding: 12px 18px 10px;
    background: #fff;
    border-bottom: 1px solid rgba(213, 223, 221, 0.8);
    z-index: 2;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  body.tm-started .tm-progress-bar {
    height: 4px;
  }

  body.tm-started .tm-progress-meta {
    font-size: 0.74rem;
    margin-bottom: 6px;
  }

  body.tm-started .tm-alert {
    flex-shrink: 0;
    margin: 8px 16px 0;
  }

  body.tm-started .tm-card-wizard {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
    overflow: hidden;
  }

  body.tm-started .tm-slide-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 0;
  }

  body.tm-started .tm-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    min-height: 0;
    box-sizing: border-box;
    padding: 20px 22px 24px;
    overflow: hidden;
  }

  body.tm-started .tm-slide {
    width: 100%;
    padding: 0;
    min-height: auto;
    opacity: 1;
    transform: none;
    flex-shrink: 0;
    display: none;
    flex-direction: column;
    justify-content: center;
  }

  body.tm-started .tm-slide.tm-slide-active {
    display: flex;
    width: 100%;
    margin-block: 0;
  }

  /* سوالات بلند: از بالا شروع شود و اسکرول شود */
  body.tm-started .tm-slide-viewport.is-tall {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-padding-top: 12px;
    scroll-padding-bottom: 16px;
  }

  body.tm-started .tm-slide-viewport.is-tall .tm-form {
    justify-content: flex-start;
    min-height: min-content;
    overflow: visible;
  }

  body.tm-started .tm-slide-viewport.is-tall .tm-slide.tm-slide-active {
    justify-content: flex-start;
  }

  body.tm-started .tm-slide.tm-slide-enter {
    animation: tmSlideInMobile 0.28s ease;
  }

  @keyframes tmSlideInMobile {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  body.tm-started .tm-slide:not(.tm-slide-active) {
    display: none !important;
  }

  body.tm-started .tm-slide-head {
    margin-bottom: 10px;
  }

  body.tm-started .tm-slide-body {
    gap: 18px;
    width: 100%;
    max-width: 520px;
    margin-inline: auto;
  }

  body.tm-started .tm-slide-section {
    font-size: 0.68rem;
    padding: 4px 10px;
    margin-bottom: 4px;
  }

  body.tm-started .tm-field-solo .tm-question,
  body.tm-started .tm-choice-group legend {
    font-size: 1.28rem;
    font-weight: 800;
    line-height: 1.7;
    margin-bottom: 6px;
    color: var(--tm-ink);
  }

  body.tm-started .tm-hint {
    font-size: 0.82rem;
    color: var(--tm-muted);
    margin: 0 0 8px;
    line-height: 1.6;
  }

  body.tm-started .tm-input,
  body.tm-started .tm-form textarea {
    font-size: 17px;
    padding: 14px 0;
    border: none;
    border-bottom: 2px solid var(--tm-line);
    border-radius: 0;
    background: transparent;
    margin-top: 8px;
    text-align: right;
    direction: rtl;
  }

  body.tm-started .tm-input::placeholder,
  body.tm-started .tm-form textarea::placeholder {
    text-align: right;
    direction: rtl;
  }

  body.tm-started .tm-input[type="tel"]:not(:placeholder-shown),
  body.tm-started .tm-input[type="number"]:not(:placeholder-shown) {
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
  }

  body.tm-started .tm-input:focus,
  body.tm-started .tm-form textarea:focus {
    border-bottom-color: var(--tm-teal);
    box-shadow: none;
    background: transparent;
  }

  body.tm-started .tm-form textarea {
    border: 2px solid var(--tm-line);
    border-radius: 14px;
    padding: 14px 16px;
    min-height: 120px;
    background: #fafbfb;
  }

  body.tm-started .tm-choice {
    padding: 16px 18px;
    min-height: 56px;
    border-radius: 14px;
    border-width: 1.5px;
  }

  body.tm-started .tm-choice-text {
    font-size: 0.92rem;
  }

  body.tm-started .tm-nav {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    flex-shrink: 0;
    margin: 0;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(213, 223, 221, 0.8);
    background: #fff;
    box-shadow: none;
    backdrop-filter: none;
    gap: 10px;
  }

  body.tm-started .tm-btn.primary {
    flex: 1;
    min-height: 52px;
    border-radius: 14px;
    font-size: 0.95rem;
    box-shadow: 0 4px 16px rgba(2, 68, 66, 0.18);
  }

  body.tm-started .tm-btn.ghost {
    flex: 0 0 52px;
    width: 52px;
    min-width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 14px;
  }

  /* ── Intro / before start ── */
  body.tm-started .tm-kicker,
  body.tm-started .tm-back {
    display: none;
  }

  body:not(.tm-started) .tm-hero {
    margin-bottom: 16px;
    text-align: center;
    padding: 0 4px;
  }

  body:not(.tm-started) .tm-hero h1 {
    font-size: 1.2rem;
  }

  body:not(.tm-started) .tm-lead {
    font-size: 0.88rem;
  }

  body:not(.tm-started) .tm-trust-row {
    justify-content: center;
  }

  body:not(.tm-started) .tm-wizard-shell {
    display: flex;
    flex-direction: column;
  }

  body:not(.tm-started) .tm-progress-wrap {
    margin-bottom: 10px;
    padding: 0 2px;
  }

  body:not(.tm-started) .tm-card {
    border-radius: 20px;
    border: none;
    box-shadow: 0 4px 24px rgba(15, 62, 59, 0.09);
  }

  body:not(.tm-started) .tm-card-wizard {
    display: flex;
    flex-direction: column;
  }

  body:not(.tm-started) .tm-slide-viewport {
    padding: 8px 0;
  }

  body:not(.tm-started) .tm-slide {
    padding: 20px 18px 8px;
  }

  body:not(.tm-started) .tm-nav {
    position: relative;
    border-top: 1px solid var(--tm-line);
    padding: 14px 16px 18px;
    background: #fafbfb;
    border-radius: 0 0 20px 20px;
  }

  /* ── Shared mobile field styles ── */
  .tm-progress-meta {
    font-size: 0.76rem;
  }

  #tmProgressSection {
    font-size: 0.72rem;
    max-width: 48%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tm-field-solo .tm-question,
  .tm-choice-group legend {
    font-size: 1.1rem;
    line-height: 1.65;
  }

  .tm-choice {
    padding: 16px 14px;
    min-height: 54px;
  }

  .tm-scale-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .tm-scale-item {
    min-height: 42px;
    font-size: 0.84rem;
  }

  .tm-input,
  .tm-form textarea {
    font-size: 16px;
  }

  .tm-intro h2 {
    font-size: 1.15rem;
  }

  .tm-intro-features {
    flex-direction: column;
    align-items: stretch;
  }

  .tm-intro-features li {
    justify-content: center;
  }

  body.tm-completed .tm-main {
    padding: 16px 14px 24px;
    min-height: auto;
    max-height: none;
    overflow: visible;
    display: block;
  }

  body.tm-completed .tm-container {
    width: 100%;
    max-width: 100%;
  }

  body.tm-completed .tm-wizard-shell {
    background: transparent;
  }

  body.tm-completed .tm-success-screen {
    margin-top: 0;
  }

  body.tm-completed .tm-success-card,
  .tm-success-card {
    border-radius: 18px;
    padding: 28px 18px 22px;
    border: none;
    box-shadow: 0 2px 16px rgba(15, 62, 59, 0.08);
  }

  body.tm-completed .tm-success-steps {
    grid-template-columns: 1fr;
    text-align: right;
  }

  body.tm-completed .tm-success-step {
    flex-direction: row;
    align-items: center;
    text-align: right;
    padding: 12px 14px;
    gap: 12px;
  }

  body.tm-completed .tm-success-actions {
    flex-direction: column;
  }

  body.tm-completed .tm-success-btn {
    max-width: none;
    width: 100%;
    min-width: 0;
  }

  .tm-success-badge {
    width: 68px;
    height: 68px;
    font-size: 1.7rem;
    margin-bottom: 16px;
  }

  .tm-success-title {
    font-size: 1.15rem;
  }

  .tm-success-message {
    font-size: 0.88rem;
    margin-bottom: 18px;
  }

  .tm-success-btn {
    width: 100%;
    min-height: 50px;
  }

  .tm-btn.ghost .tm-btn-label {
    display: none;
  }
}

@media (max-width: 600px) {
  body.page-team .team-match-fab {
    bottom: 16px;
    right: 16px;
    left: auto;
    width: fit-content;
    max-width: calc(100vw - 32px);
    justify-content: flex-start;
    padding: 12px 14px;
    border-radius: 11px;
  }

  body.page-team .team-match-fab-label {
    font-size: 0.84rem;
  }

  body.page-team .team-match-fab-sub {
    font-size: 0.68rem;
  }

  body.page-team .team-match-fab-icon {
    width: 36px;
    height: 36px;
    font-size: 0.92rem;
  }
}

@media (max-width: 380px) {
  .tm-scale-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .tm-btn.ghost {
    min-width: 52px;
    padding: 12px;
  }
}
