:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;
  --dark: #111827;
  --text: #374151;
  --muted: #6B7280;
  --border: #E5E7EB;
  --light-bg: #F9FAFB;
  --white: #fff;
  --green: #22C55E;
  --green-bg: #DCFCE7;
  --red: #EF4444;
  --red-bg: #FEF2F2;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--white);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--dark);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.tagline {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

/* --- Progress Stepper --- */
.stepper {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 24px 32px 0;
  max-width: 800px;
  margin: 0 auto;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: default;
  user-select: none;
}
.step-item .num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--light-bg);
  color: var(--muted);
  border: 2px solid var(--border);
  transition: all 0.25s ease;
  flex-shrink: 0;
}
.step-item.active .num {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.step-item.done .num {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.step-item.active { color: var(--dark); }
.step-item.done { color: var(--green); }
.step-connector {
  width: 60px;
  height: 2px;
  background: var(--border);
  margin: 0 12px;
  align-self: center;
  border-radius: 1px;
  transition: background 0.25s ease;
}
.step-connector.done { background: var(--green); }

/* --- Sections --- */
.section {
  display: none;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px;
  animation: fadeIn 0.3s ease;
}
.section.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.section-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--dark);
  text-align: center;
  margin-bottom: 4px;
}
.section-sub {
  text-align: center;
  color: var(--muted);
  margin-bottom: 32px;
  font-size: 15px;
}

/* --- Plan Cards --- */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.plan-card {
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  background: var(--white);
}
.plan-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}
.plan-card.selected {
  border-color: var(--primary);
  box-shadow: 0 4px 24px rgba(37, 99, 235, 0.12);
}
.plan-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.plan-select-check {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: transparent;
  transition: all 0.2s ease;
}
.plan-card.selected .plan-select-check {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.plan-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 4px;
}
.plan-tagline {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}
.plan-price {
  font-size: 36px;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.1;
}
.plan-price .per {
  font-size: 16px;
  font-weight: 500;
  color: var(--muted);
}
.plan-price-detail {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}
.plan-features {
  list-style: none;
  margin-top: 4px;
  margin-bottom: 16px;
}
.plan-features li {
  font-size: 13.5px;
  padding: 4px 0;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.plan-features li::before {
  content: '\2713';
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.plan-total-row {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.plan-total-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.plan-total-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
}

/* --- Add-ons --- */
.addons-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--dark);
}
.addons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.addon-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.addon-card:hover { border-color: #CBD5E1; }
.addon-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.addon-card.addon-info-only {
  cursor: default;
  background: var(--light-bg);
  border-style: dashed;
}
.addon-card.addon-info-only:hover { border-color: var(--border); }
.addon-info .addon-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--dark);
}
.addon-info .addon-desc {
  font-size: 12px;
  color: var(--muted);
}
.addon-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.addon-price {
  font-weight: 700;
  font-size: 15px;
  color: var(--dark);
  white-space: nowrap;
}
.addon-check {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.addon-card.selected .addon-check {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* --- Summary Bar --- */
.summary-bar {
  background: var(--light-bg);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 8px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 14px;
}
.summary-row .label { color: var(--muted); }
.summary-row .value { font-weight: 600; color: var(--dark); }
.summary-row.total {
  border-top: 2px solid var(--border);
  margin-top: 10px;
  padding-top: 12px;
  font-size: 18px;
  font-weight: 800;
  color: var(--dark);
}
.summary-note {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  margin-top: 4px;
}

/* --- Buttons --- */
.btn {
  padding: 14px 36px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled {
  background: #94A3B8;
  cursor: not-allowed;
}
.btn-outline {
  background: white;
  color: var(--text);
  border: 2px solid var(--border);
}
.btn-outline:hover { border-color: #94A3B8; }
.btn-small {
  padding: 8px 18px;
  font-size: 13px;
  min-height: 36px;
}
.btn-row {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
}

/* --- Spinner --- */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Forms --- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group { margin-bottom: 0; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--dark);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease;
  background: white;
  color: var(--dark);
  min-height: 44px;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-group input.error,
.form-group select.error {
  border-color: var(--red);
}
.form-group input.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.error-text {
  color: var(--red);
  font-size: 12px;
  margin-top: 4px;
  display: none;
}

/* --- Contract --- */
.contract-box {
  background: var(--light-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  max-height: 400px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.8;
  margin-bottom: 24px;
  color: #444;
}
.contract-box h3 {
  color: var(--dark);
  font-size: 16px;
  margin: 0 0 12px;
  text-align: center;
}
.contract-box h4 {
  color: var(--dark);
  margin: 20px 0 6px;
  font-size: 14px;
}
.contract-box h4:first-of-type { margin-top: 12px; }
.contract-box .hl {
  background: #FEF3C7;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}
.contract-box ul {
  margin: 8px 0 8px 20px;
}
.contract-box li {
  margin-bottom: 2px;
}
.contract-box .sig-block {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.contract-box .sig-block-party {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.contract-box .sig-block-party strong {
  display: block;
  margin-bottom: 8px;
  color: var(--dark);
}
.contract-box .sig-block-party .sig-line {
  border-bottom: 1px solid #999;
  padding-bottom: 4px;
  margin-bottom: 6px;
  font-size: 13px;
  min-height: 20px;
}

/* --- Scroll Notice --- */
.scroll-notice {
  text-align: center;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 8px;
  margin-bottom: 20px;
  transition: opacity 0.3s ease;
}
.scroll-notice.hidden {
  opacity: 0;
  pointer-events: none;
  height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
}
.sig-section.locked,
.checkbox-row.locked {
  opacity: 0.35;
  pointer-events: none;
  user-select: none;
}

/* --- Signature --- */
.sig-section { margin-bottom: 20px; }
.sig-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 8px;
}
.sig-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
  cursor: crosshair;
  background: #FAFAFA;
}
.sig-area canvas {
  position: absolute;
  top: 0;
  left: 0;
}
.sig-placeholder {
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
}
.sig-area.has-sig .sig-placeholder { display: none; }
.sig-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

/* --- Checkboxes --- */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13.5px;
  color: var(--text);
}
.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex-shrink: 0;
  cursor: pointer;
}
.checkbox-row label {
  cursor: pointer;
}

/* --- Payment --- */
.payment-summary {
  background: var(--light-bg);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
}
.payment-summary .pay-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}
.payment-summary .pay-row .label { color: var(--muted); }
.payment-summary .pay-row .value { font-weight: 600; }
.payment-summary .pay-row.pay-total {
  border-top: 2px solid var(--border);
  margin-top: 8px;
  padding-top: 10px;
  font-size: 18px;
  font-weight: 800;
  color: var(--dark);
}
.payment-summary .pay-row.pay-recurring {
  font-size: 13px;
  color: var(--muted);
}

.stripe-container {
  margin-bottom: 20px;
}
.stripe-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--dark);
}
.stripe-element {
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: white;
  transition: border-color 0.2s ease;
  min-height: 44px;
}
.stripe-element.StripeElement--focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.stripe-element.StripeElement--invalid {
  border-color: var(--red);
}
.stripe-errors {
  color: var(--red);
  font-size: 12px;
  margin-top: 4px;
  min-height: 18px;
}
/* --- Turnstile --- */
.turnstile-container {
  margin-bottom: 20px;
}
.turnstile-error {
  color: var(--red);
  font-size: 12px;
  margin-top: 4px;
  min-height: 18px;
}

.secure-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

/* --- Confirmation --- */
.confirm-hero {
  text-align: center;
  padding: 48px 24px 32px;
}
.confirm-icon {
  width: 80px;
  height: 80px;
  background: var(--green-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.confirm-hero h2 {
  font-size: 28px;
  color: var(--dark);
  margin-bottom: 8px;
}
.confirm-hero p {
  color: var(--muted);
  font-size: 15px;
  max-width: 500px;
  margin: 0 auto;
}
.confirm-details {
  background: var(--light-bg);
  border-radius: 14px;
  padding: 28px;
  max-width: 600px;
  margin: 0 auto;
}
.confirm-details .row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.confirm-details .row:last-child { border: none; }
.confirm-details .row .label { color: var(--muted); }
.confirm-details .row .val { font-weight: 600; color: var(--dark); }
.confirm-actions {
  text-align: center;
  margin-top: 24px;
}
.confirm-email-note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .plans-grid { grid-template-columns: 1fr; }
  .addons-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
  .stepper { gap: 0; }
  .step-item span { display: none; }
  .step-connector { width: 24px; margin: 0 4px; }
  header { padding: 0 16px; }
  .section { padding: 20px 16px; }
  .section-title { font-size: 24px; }
  .plan-price { font-size: 28px; }
  .contract-box { padding: 16px; max-height: 300px; }
  .contract-box .sig-block { grid-template-columns: 1fr; }
  .btn-row { gap: 12px; }
  .btn { padding: 12px 24px; font-size: 14px; }
}

@media (max-width: 480px) {
  .header-inner { flex-direction: column; gap: 2px; padding: 8px 0; }
  header { height: auto; padding: 8px 16px; }
  .tagline { font-size: 11px; }
}
