:root {
  --bg: #ffffff;
  --bg-raised: #f5faf9;
  --text: #142523;
  --text-muted: #4b615e;
  --border: #d8e6e3;
  --accent: #1f8f81;
  --accent-bright: #29a999;
  --accent-soft: #e3f4f1;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
}

a { color: var(--accent); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  max-width: 72rem;
  margin: 0 auto;
}
.wordmark {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}
.wordmark span { color: var(--accent-bright); }

.site-nav { display: flex; gap: 1.75rem; }
.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
}
.site-nav a:hover { color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.4rem;
  background: var(--accent-bright);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--accent); }
.btn:disabled, .btn-outline:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background: var(--accent-bright);
}
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-bright);
}
.btn-outline:hover { background: var(--accent-soft); }
.btn-outline:disabled { background: transparent; }

.btn .spinner {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.5em;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

main { max-width: 46rem; margin: 0 auto; padding: 4rem 2rem 6rem; }
main.wide { max-width: 72rem; }

h1 { font-size: 2.3rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance; }
h2 { font-size: 1.4rem; font-weight: 700; margin-top: 2.5rem; }
p.lead { color: var(--text-muted); font-size: 1.1rem; }

.hero {
  max-width: 72rem;
  margin: 0 auto;
  padding: 5rem 2rem;
  text-align: center;
}
.hero-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  color: var(--accent-bright);
}
.hero p.lead { max-width: 34rem; margin: 1rem auto 2.5rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  max-width: 72rem;
  margin: 3rem auto;
  padding: 0 2rem;
}
.feature-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}
.feature-card h3 { margin: 0 0 0.5rem; font-size: 1.02rem; }
.feature-card p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- Wizard --- */
.wizard-steps {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.wizard-steps .step { padding: 0.3rem 0.7rem; border-radius: 999px; background: var(--bg-raised); }
.wizard-steps .step.active { background: var(--accent-bright); color: #fff; font-weight: 600; }

.field { margin-bottom: 1.25rem; }
.field label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 0.35rem; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent-bright);
  outline-offset: 1px;
}
.field-hint { font-size: 0.8rem; color: var(--text-muted); margin: 0.35rem 0 0; }

/* --- Step 3: conditional question engine --- */
.question-group-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin: 2.5rem 0 0.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--accent-soft);
}
.question-group-heading:first-child { margin-top: 1.5rem; padding-top: 0; border-top: none; }

.question {
  padding: 1.25rem 0;
}
/* Only divide two consecutive questions within the same section — a
   question immediately preceded by a section heading (not another
   question) shouldn't get its own line on top of the heading's spacing,
   which previously produced two adjacent dividers at every section
   boundary. */
.question + .question { border-top: 1px solid var(--border); }
.question:first-child { padding-top: 0; }
.question-text { display: block; font-size: 0.95rem; font-weight: 600; margin-bottom: 0.4rem; }
.question-desc { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 0.7rem; white-space: pre-line; }
.question-control input[type="text"],
.question-control input[type="date"],
.question-control textarea {
  width: 100%;
  max-width: 26rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: inherit;
}
.question-control textarea { min-height: 4.5rem; resize: vertical; }
.option-list { display: flex; flex-direction: column; gap: 0.5rem; }
.option-list label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
}
.option-list input[type="radio"], .option-list input[type="checkbox"] { margin-top: 0.2rem; flex-shrink: 0; }
.question-file { font-size: 0.88rem; }
.question-file .upload-status { margin-top: 0.4rem; font-size: 0.8rem; color: var(--accent); }

.dropzone {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.1rem;
  border: 1.5px dashed var(--accent-bright);
  border-radius: 10px;
  background: var(--accent-soft);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  max-width: 26rem;
}
.dropzone:hover, .dropzone-active { background: var(--bg); border-color: var(--accent); }
.dropzone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}
.dropzone-icon { width: 1.4rem; height: 1.4rem; flex-shrink: 0; color: var(--accent); }
.dropzone-label { font-size: 0.88rem; color: var(--text); }
.dropzone-browse { color: var(--accent); font-weight: 600; text-decoration: underline; }

.uploaded-file-list { list-style: none; margin: 0.6rem 0 0; padding: 0; max-width: 26rem; display: flex; flex-direction: column; gap: 0.4rem; }
.uploaded-file-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
}
.uploaded-file-icon { width: 1.1rem; height: 1.1rem; flex-shrink: 0; color: var(--accent); }
.uploaded-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remove-upload-btn {
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.remove-upload-btn:hover { background: #fbe9e2; color: #a3401a; }
.remove-upload-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.currency-input {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 26rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.currency-input .currency-prefix {
  padding: 0.6rem 0 0.6rem 0.75rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  user-select: none;
}
.currency-input input[type="text"] {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 0;
  padding: 0.6rem 0.75rem 0.6rem 0.25rem;
  max-width: none;
  font-size: 0.92rem;
  font-family: inherit;
}
.currency-input input[type="text"]:focus { outline: none; }
.currency-input:focus-within { outline: 2px solid var(--accent-bright); outline-offset: 1px; }
.question-nested { margin-top: 1rem; padding: 1rem; background: var(--bg-raised); border-radius: 8px; }

#address-results {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 0.4rem;
  overflow: hidden;
}
#address-results .candidate {
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
#address-results .candidate:last-child { border-bottom: none; }
#address-results .candidate:hover { background: var(--accent-soft); }

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.result-row:last-child { border-bottom: none; }
.result-row .k { color: var(--text-muted); }
.result-row .v { font-weight: 600; text-align: right; flex-shrink: 0; }
.result-row .v select,
.result-row .v input[type="text"] {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  background: var(--bg);
  min-width: 8rem;
}
.result-row .v input[type="text"] { min-width: 14rem; text-align: left; }
.result-row .v select:focus,
.result-row .v input[type="text"]:focus {
  outline: 2px solid var(--accent-bright);
  outline-offset: 1px;
}

.status-pill { font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 999px; font-weight: 600; }
.status-success { background: #e5f4ea; color: #256a41; }
.status-failed { background: #fbe9e2; color: #a3401a; }
.status-pending { background: var(--accent-soft); color: var(--accent); }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1917;
    --bg-raised: #15211f;
    --text: #e7f3f1;
    --text-muted: #9db5b1;
    --border: #24413c;
    --accent: #4fd0be;
    --accent-bright: #3fc7b5;
    --accent-soft: #163330;
  }
}
