/* ============================================================
   TribeHired Sales Page — Design System
   tribehired.work — Sprint 1
   Mobile-first. No framework. No build step.
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --color-action:  #ff375e;
  --color-action-hover: #e02e50;
  --color-navy:    #0b1324;
  --color-heading: #1b1d24;
  --color-body:    #606064;
  --color-muted:   #98a6ba;
  --color-border:  #dce2ed;
  --color-surface: #f8f8f2;
  --color-white:   #ffffff;

  --space-1:  8px;
  --space-2:  16px;
  --space-3:  24px;
  --space-4:  32px;
  --space-6:  48px;
  --space-8:  64px;
  --space-12: 96px;
  --space-16: 128px;

  --max-width: 760px;
  --page-px:   24px;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-pill: 999px;
}

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

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

body {
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-body);
  background: var(--color-white);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── Typography ─────────────────────────────────────────── */
.hero-number {
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--color-heading);
}

h1, .h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-heading);
}

h2, .h2 {
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--color-heading);
}

h3, .h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-heading);
}

.body-large { font-size: 1.125rem; line-height: 1.6; }
.text-muted  { color: var(--color-muted); font-size: 0.875rem; }
.text-small  { font-size: 0.875rem; }
.label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-body);
}

/* ── Layout ─────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--page-px);
}

.section {
  padding-block: var(--space-8);
}

.section--surface { background: var(--color-surface); }

.section--navy {
  background: var(--color-navy);
  color: var(--color-white);
}

.section--navy h2,
.section--navy h3,
.section--navy .h2 {
  color: var(--color-white);
}

.section--navy p,
.section--navy .body-large {
  color: rgba(255,255,255,0.75);
}

.section-heading {
  margin-bottom: var(--space-6);
}

.section-heading h2 { margin-bottom: var(--space-1); }
.section-heading p  { font-size: 1.125rem; color: var(--color-body); }

@media (min-width: 768px) {
  :root { --page-px: 48px; }
  .section { padding-block: var(--space-12); }
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  background: var(--color-action);
  color: var(--color-white);
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 16px 32px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  text-align: center;
  white-space: nowrap;
}

.btn-primary:hover  { background: var(--color-action-hover); }
.btn-primary:active { transform: scale(0.98); }

.btn-primary--full { display: block; width: 100%; }

.btn-ghost {
  display: inline-block;
  background: transparent;
  color: var(--color-action);
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 14px 30px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-action);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  text-align: center;
  white-space: nowrap;
}

.btn-ghost:hover {
  background: var(--color-action);
  color: var(--color-white);
}

.btn-ghost--pill { border-radius: var(--radius-pill); }

/* ── Micro copy below CTA ───────────────────────────────── */
.cta-micro {
  font-size: 0.8125rem;
  color: var(--color-body);
  margin-top: var(--space-2);
  line-height: 1.5;
}

.section--navy .cta-micro { color: rgba(255,255,255,0.7); }

/* ── Divider ─────────────────────────────────────────────── */
hr.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0;
}

/* ── Stats grid ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.stat-block { display: flex; flex-direction: column; gap: 4px; }

.stat-number {
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 800;
  line-height: 1;
  color: var(--color-heading);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-heading);
  line-height: 1.35;
}

.stat-source {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 2px;
}

@media (min-width: 640px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Benefits grid ──────────────────────────────────────── */
.benefits-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.benefit-block {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.benefit-anchor {
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  font-weight: 800;
  line-height: 1.25;
  color: var(--color-heading);
  letter-spacing: -0.01em;
}

.benefit-label {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-body);
  margin: 0;
}

@media (min-width: 720px) {
  .benefits-grid { grid-template-columns: 1fr 1fr; gap: var(--space-4); }
}

/* ── Offer section ───────────────────────────────────────── */
.offer-guarantees {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.guarantee-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.guarantee-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: var(--color-action);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.guarantee-icon svg { width: 12px; height: 12px; }

.guarantee-text strong {
  display: block;
  color: var(--color-heading);
  font-weight: 700;
  font-size: 1rem;
}

.guarantee-text span {
  font-size: 0.9375rem;
  color: var(--color-body);
}

.guarantee-callout {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 55, 94, 0.06);
  border-left: 3px solid var(--color-action);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9375rem;
  color: var(--color-heading);
  font-weight: 600;
}

/* Card variant (Variant A only) */
.offer-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.offer-price {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 800;
  color: var(--color-action);
  line-height: 1;
  letter-spacing: -0.02em;
}

.offer-price-label {
  font-size: 0.9375rem;
  color: var(--color-body);
  font-weight: 400;
  margin-top: 4px;
}

.offer-checklist {
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.offer-check-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-body);
}

.offer-check-item .check-icon {
  flex-shrink: 0;
  width: 20px;
  margin-top: 1px;
  font-style: normal;
}

.offer-check-item--yes .check-icon { color: var(--color-action); font-weight: 700; }
.offer-check-item--no  .check-icon { color: var(--color-muted); }

.offer-check-item--divider {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-2);
  margin-top: var(--space-1);
}

/* ── How It Works ────────────────────────────────────────── */
.steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-6);
  position: relative;
}

.step { display: flex; gap: var(--space-3); align-items: flex-start; }

.step-circle {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-action);
  color: var(--color-white);
  font-size: 0.875rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 1;
}

.step-body { padding-top: 4px; }
.step-body h3 { margin-bottom: 4px; }
.step-body p  { font-size: 0.9375rem; }

/* Vertical connector line (mobile) */
.steps--connected .step:not(:last-child) .step-circle::after {
  content: '';
  position: absolute;
  top: 44px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: calc(var(--space-4) + 20px);
  background: var(--color-action);
  opacity: 0.3;
  z-index: 0;
}

@media (min-width: 640px) {
  .steps {
    flex-direction: row;
    align-items: flex-start;
  }

  .step {
    flex: 1;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
  }

  /* Horizontal connector between steps */
  .steps--connected .step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 22px;
    left: calc(50% + 22px);
    right: calc(-50% + 22px);
    height: 2px;
    background: var(--color-action);
    opacity: 0.35;
    z-index: 0;
  }

  /* Remove the vertical connector on desktop */
  .steps--connected .step:not(:last-child) .step-circle::after {
    display: none;
  }

  .step-body { padding-top: var(--space-2); }
}

/* ── FAQ ─────────────────────────────────────────────────── */
.faq-list {
  margin-top: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.faq-list details {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  overflow: hidden;
}

.faq-list details[open] { border-color: var(--color-action); }

.faq-list summary {
  padding: var(--space-3) var(--space-4);
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--color-heading);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  user-select: none;
}

.faq-list summary::-webkit-details-marker { display: none; }

.faq-list summary::after {
  content: '+';
  color: var(--color-action);
  font-size: 1.25rem;
  font-weight: 400;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.faq-list details[open] summary::after {
  content: '−';
}

.faq-answer {
  padding: 0 var(--space-4) var(--space-3);
  font-size: 0.9375rem;
  color: var(--color-body);
  line-height: 1.65;
}

.faq-answer ol {
  list-style: decimal;
  padding-left: var(--space-3);
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.faq-answer ol li { font-size: 0.9375rem; }

/* Quoted-question style (Variant A FAQ) */
.faq-list--quoted summary {
  font-style: italic;
  font-weight: 600;
  color: var(--color-action);
}

/* ── Header login link ────────────────────────────────────── */
.header-login {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-heading);
  text-decoration: none;
}
.header-login:hover { color: var(--color-action); }

/* ── Nav Bar (Variant A) ──────────────────────────────────── */
.nav-a {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  height: 64px;
  display: flex;
  align-items: center;
  padding-inline: var(--page-px);
}

.nav-a__inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo { height: 28px; width: auto; }

.nav-cta { display: none; }

@media (min-width: 480px) {
  .nav-cta { display: inline-block; }
}

/* ── Hero — Variant B (full white) ──────────────────────── */
.hero-b {
  padding-block: var(--space-12) var(--space-8);
}

.hero-b .hero-subline {
  font-size: clamp(1rem, 3vw, 1.25rem);
  color: var(--color-body);
  margin-top: var(--space-1);
  margin-bottom: var(--space-4);
}

.hero-b h1 {
  margin-bottom: var(--space-4);
}

.hero-b .logo-only {
  display: block;
  height: 28px;
  width: auto;
  margin-bottom: var(--space-6);
}

@media (min-width: 768px) {
  .hero-b { padding-block: var(--space-16) var(--space-12); }
}

/* ── Hero — Variant A (split) ────────────────────────────── */
.hero-a {
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.hero-a__left {
  padding: var(--space-8) var(--page-px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-a__left .hero-subline {
  font-size: 1.125rem;
  color: var(--color-body);
  margin-top: var(--space-1);
  margin-bottom: var(--space-4);
}

.hero-a__left h1 { margin-bottom: var(--space-4); }

.hero-a__right {
  background: var(--color-navy);
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.hero-a__right-pattern {
  opacity: 0.12;
  width: 100%;
  max-width: 320px;
}

@media (min-width: 768px) {
  .hero-a {
    flex-direction: row;
    min-height: 560px;
  }

  .hero-a__left {
    flex: 1;
    padding: var(--space-12) var(--space-8) var(--space-12) var(--page-px);
    max-width: 52%;
  }

  .hero-a__right {
    flex: 1;
    min-height: unset;
  }
}

/* ── Footer (Variant A) ──────────────────────────────────── */
.footer-a {
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-4);
}

.footer-a__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  align-items: center;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--color-muted);
}

@media (min-width: 640px) {
  .footer-a__inner {
    flex-direction: row;
    justify-content: center;
    gap: var(--space-3);
  }

  .footer-a__sep { display: inline; }
}

/* ── Final CTA section ───────────────────────────────────── */
.cta-section-inner {
  text-align: center;
  max-width: 560px;
  margin-inline: auto;
}

.cta-section-inner h2 { margin-bottom: var(--space-4); }

.cta-section-inner .whatsapp-link {
  display: block;
  margin-top: var(--space-3);
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.6);
}

.cta-section-inner .whatsapp-link:hover { color: rgba(255,255,255,0.9); }

/* ── Hero qualifier (Variant A) ─────────────────────────── */
.hero-qualifier {
  font-size: 1.0625rem;
  color: var(--color-body);
  margin-top: var(--space-2);
  margin-bottom: var(--space-4);
  line-height: 1.6;
}

/* ── Comparison Table (Variant A) ───────────────────────── */
.comparison-table {
  margin-top: var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.comparison-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.comparison-table th,
.comparison-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.comparison-table thead th {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-body);
  border-bottom: 2px solid var(--color-border);
}

.comparison-table thead .col-agency,
.comparison-table thead .col-tribe { text-align: right; }

.comparison-table td:first-child { color: var(--color-heading); }

.comparison-table .col-agency {
  color: var(--color-action);
  text-align: right;
}

.comparison-table .col-tribe {
  color: var(--color-heading);
  font-weight: 700;
  text-align: right;
}

.comparison-table tfoot .total-row td {
  border-top: 2px solid var(--color-heading);
  border-bottom: none;
  font-size: 1rem;
  font-weight: 700;
}

.comparison-table tfoot .total-agency { font-size: 1.125rem; }
.comparison-table tfoot .total-tribe  { font-size: 1.125rem; }

.savings-callout {
  margin-top: var(--space-6);
  text-align: center;
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  font-weight: 800;
  color: var(--color-action);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.savings-sub {
  font-size: 0.9375rem;
  color: var(--color-muted);
  font-weight: 400;
  margin-top: var(--space-1);
}

/* ── Utilities ───────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

/* ── Employer Apply Page ─────────────────────────────────── */

.apply-header {
  padding: 24px var(--page-px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.apply-header__logo { height: 28px; width: auto; }

.apply-header__user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  color: var(--color-muted);
}
.apply-header__user-email { color: var(--color-body); }
.apply-header__logout { margin: 0; }

.apply-header__signed-link {
  font-size: 0.875rem;
  color: var(--color-action);
  text-decoration: underline;
}
.apply-header__signed-link:hover { opacity: 0.8; }

/* ── Success toast (post-sign confirmation, auto-dismiss) ─────────────────── */

.success-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 380px;
  padding: 14px 18px;
  background: #ffffff;
  border: 1px solid var(--color-border, #dce2ed);
  border-left: 4px solid #10b981;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  font-size: 0.92rem;
  color: var(--color-heading, #1b1d24);
  animation: success-toast-slide-in 240ms ease-out;
}

.success-toast__icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.success-toast__message {
  line-height: 1.4;
}

@keyframes success-toast-slide-in {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--color-action);
  cursor: pointer;
  text-decoration: underline;
}
.btn-link:hover { color: var(--color-action-hover); }

.apply-main {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 80vh;
  padding-top: var(--space-8);
}

.apply-container {
  width: 100%;
  max-width: 480px;
  padding: 0 var(--page-px) var(--space-12);
}

.apply-container--wide { max-width: 960px; }

.apply-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-action);
  margin-bottom: var(--space-2);
}

.apply-heading {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-heading);
  margin-bottom: var(--space-2);
}

.apply-subheading {
  font-size: 1rem;
  color: var(--color-body);
  margin-bottom: var(--space-5);
}

/* Form */
.qualification-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-field label {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-heading);
}

.form-field input:not([type="radio"]):not([type="checkbox"]),
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  color: var(--color-heading);
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.form-field textarea {
  resize: vertical;
  min-height: 80px;
  font-family: 'Nunito', sans-serif;
  line-height: 1.5;
}

.form-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2398a6ba' 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;
}

.form-field input:not([type="radio"]):not([type="checkbox"]):focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--color-action);
}

.form-field input:not([type="radio"]):not([type="checkbox"])::placeholder,
.form-field textarea::placeholder { color: var(--color-muted); }

.form-field__radios {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: 4px;
}

.form-field__radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  color: var(--color-heading);
  background: var(--color-white);
  transition: border-color 0.15s, background 0.15s;
}

.form-field__radio:hover { border-color: var(--color-action); }

.form-field__radio input[type="radio"] {
  margin: 0;
  accent-color: var(--color-action);
  cursor: pointer;
}

.form-field__radio:has(input:checked) {
  border-color: var(--color-action);
  background: rgba(255, 55, 94, 0.05);
}

.form-field__error {
  font-size: 0.8rem;
  color: var(--color-action);
}

.qualification-form .btn-primary {
  width: 100%;
  text-align: center;
  margin-top: var(--space-1);
}

/* Loading state */
.apply-loading {
  text-align: center;
  padding: var(--space-8) 0;
  color: var(--color-muted);
}

.apply-loading__pulse {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-action);
  border-radius: 50%;
  animation: apply-spin 0.8s linear infinite;
  margin: 0 auto var(--space-3);
}

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

/* Error state */
.apply-error {
  padding: var(--space-4);
  background: #fff5f7;
  border: 1px solid rgba(255, 55, 94, 0.25);
  border-radius: var(--radius-md);
  color: var(--color-heading);
  line-height: 1.6;
}

.apply-error a { color: var(--color-action); }

/* Reveal sections */
.reveal { padding-top: var(--space-2); }

.reveal__heading {
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--color-heading);
  margin-bottom: var(--space-3);
}

.reveal__body {
  color: var(--color-body);
  line-height: 1.7;
  margin-bottom: var(--space-5);
}

.reveal__cta { display: inline-block; }

.reveal__micro {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: var(--space-2);
}

.reveal__override {
  font-size: 0.9rem;
  color: var(--color-body);
  margin-top: var(--space-4);
  line-height: 1.6;
}

.reveal__override a { color: var(--color-action); }

.reveal__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.reveal__actions .btn-primary { display: inline-flex; align-items: center; }
.reveal__actions .btn-link { font-weight: 600; }

/* ── Agreement signing form ────────────────────────────────── */

/* ── Agreement segment html-chunk wrapper ─────────────────────────────── */

/* display: contents lets block content (tables, divs) render in the parent's
   block formatting context, while still allowing the wrapper to coexist with
   inline placeholders (inputs/mirrors) inside flowing paragraphs. */
.agreement-segment-html {
  display: contents;
}

/* ── Cursive signature font (registered locally so dompdf can render the PDF) ── */

@font-face {
  font-family: 'Dancing Script';
  font-style: normal;
  font-weight: 600;
  src: url('/fonts/DancingScript-Regular.ttf') format('truetype');
}

/* ── Agreement inline input (HelloSign-style field inside the document) ── */

.agreement-inline-input {
  display: inline-block;
  min-width: 180px;
  padding: 2px 8px;
  margin: 0 2px;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  background: #fffbe6;
  border: 1px dashed var(--color-action);
  border-radius: var(--radius-sm);
  color: var(--color-heading);
  outline: none;
  vertical-align: baseline;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.agreement-inline-input:hover {
  background: #fff;
}

.agreement-inline-input:focus {
  background: #fff;
  border: 1.5px solid var(--color-action);
  box-shadow: 0 0 0 3px rgba(255, 55, 94, 0.15);
}

.agreement-inline-input::placeholder {
  color: var(--color-muted);
  font-weight: 400;
}

.agreement-preview input[data-testid="agreement-inline-input-signature_text"] {
  font-family: 'Dancing Script', cursive;
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1.2;
  min-width: 280px;
  padding: 4px 12px;
}

.agreement-preview input[data-testid="agreement-inline-input-signature_text"]::placeholder {
  font-family: var(--font-body, 'Nunito', sans-serif);
  font-size: 1rem;
  font-weight: 400;
  font-style: italic;
}

/* ── Agreement inline mirror (read-only display of a typed field's value) ── */

.agreement-inline-mirror {
  display: inline-block;
  padding: 1px 6px;
  font-weight: 600;
  color: var(--color-heading);
  background: #eef9e8;
  border-radius: 3px;
}

.agreement-inline-mirror:empty::before {
  content: '___________';
  color: var(--color-muted);
  font-style: italic;
  font-weight: 400;
}

/* ── Agreement-preview version pill (substituted from agreementVersion prop) ── */

.agreement-preview__version {
  font-weight: 600;
  color: var(--color-heading);
}

/* ── Agreement stepper (sticky bottom panel with Continue/Sign/Choice) ── */

.agreement-stepper {
  position: sticky;
  bottom: 0;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
  z-index: 10;
}

.agreement-stepper__indicator {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-muted);
  margin-right: auto;
}

.agreement-stepper__continue,
.agreement-stepper__sign {
  padding: 10px 28px;
  font-size: 1rem;
}

.agreement-stepper__sign {
  font-weight: 700;
}

.agreement-stepper__sign:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Inline spinner shown inside the Sign button while the agreement submits.
   Reuses the apply-spin keyframe defined above. */
.agreement-stepper__spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.5em;
  vertical-align: -0.15em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: apply-spin 0.8s linear infinite;
}

.agreement-stepper__choice {
  padding: 10px 24px;
  font-size: 0.9375rem;
}

.agreement-stepper__choice.btn-secondary {
  background: var(--color-white);
  color: var(--color-heading);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.agreement-stepper__choice.btn-secondary:hover {
  background: var(--color-surface);
  border-color: var(--color-muted);
}

.agreement-stepper__skip {
  background: none;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.875rem;
  padding: 4px 8px;
}

.agreement-stepper__skip:hover {
  color: var(--color-heading);
}

.agreement-stepper__checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9375rem;
  color: var(--color-body);
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.agreement-stepper__checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-action);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Agreement reveal (parent wrapper) ─────────────────────── */

.agreement-reveal__header {
  margin-bottom: var(--space-5);
}

.agreement-reveal__header h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  color: var(--color-heading);
  margin: 0 0 var(--space-2) 0;
}

.agreement-reveal__header p {
  color: var(--color-body);
  margin: 0;
}

.agreement-reveal__error {
  padding: var(--space-2) var(--space-3);
  background: #fff5f7;
  border: 1px solid rgba(255, 55, 94, 0.25);
  border-radius: var(--radius-md);
  color: var(--color-heading);
  margin-top: var(--space-4);
  line-height: 1.5;
}

/* ── Agreement preview panel (live document next to the form) ──────────────── */

.agreement-preview {
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fafafa;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--color-heading);
  margin-bottom: var(--space-5);
}

.agreement-preview h1 {
  font-size: 1.25rem;
  margin: 0 0 var(--space-2) 0;
  text-align: center;
}

.agreement-preview .subtitle {
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: var(--space-3);
}

.agreement-preview .preamble-address {
  text-align: center;
  font-size: 0.875rem;
  margin-bottom: var(--space-3);
}

.agreement-preview h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: var(--space-4) 0 var(--space-2) 0;
}

.agreement-preview h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  margin: var(--space-3) 0 var(--space-1) 0;
}

.agreement-preview p {
  margin: 0 0 var(--space-2) 0;
  text-align: justify;
}

.agreement-preview ol,
.agreement-preview ul {
  margin: 0 0 var(--space-2) var(--space-4);
  padding: 0;
}

.agreement-preview ol.alpha { list-style: lower-alpha; }

.agreement-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-2) 0;
  font-size: 0.875rem;
}

.agreement-preview th,
.agreement-preview td {
  border: 1px solid var(--color-border);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.agreement-preview th { background: #f0f0f0; font-weight: 700; }

.agreement-preview .signature-block {
  border: 1px solid var(--color-border);
  background: #fff;
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0;
}

.agreement-preview .signature-row {
  display: block;
  margin: 0 0 6px 0;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.agreement-preview .signature-row:last-child { margin-bottom: 0; }

.agreement-preview .signature-row--cursive {
  font-family: 'Dancing Script', cursive;
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.3;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.agreement-preview .signature-row--cursive .signature-label {
  font-family: var(--font-body, 'Nunito', sans-serif);
  font-size: 0.8125rem;
  vertical-align: middle;
}

.agreement-preview .signature-label {
  display: inline-block;
  min-width: 220px;
  font-weight: 700;
  color: var(--color-muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.agreement-preview .toc {
  border: 1px solid var(--color-border);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}

.agreement-preview .toc h2 {
  font-size: 0.9375rem;
  margin: 0 0 var(--space-1) 0;
  text-align: center;
}

.agreement-preview .toc ol { margin: 0; padding-left: var(--space-3); }
.agreement-preview .toc li { font-size: 0.8125rem; margin: 0 0 2px 0; }

.agreement-preview .end-marker {
  text-align: center;
  font-style: italic;
  color: var(--color-muted);
  margin: var(--space-3) 0;
}

.agreement-preview__placeholder {
  display: inline-block;
  min-width: 120px;
  color: var(--color-muted);
  border-bottom: 1px dashed var(--color-border);
  font-style: italic;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--color-action);
}
.btn-primary:disabled:hover { background: var(--color-action); }
