:root {
  --bg: #f4efe6;
  --bg-accent: #ece4d6;
  --surface: #fffcf7;
  --ink: #2c2416;
  --muted: #6a5e4d;
  --line: #e3d8c6;
  --accent: #5b6b4a;
  --accent-ink: #f7f1e8;
  --accent-soft: #e7eddf;
  --shadow: 0 18px 50px rgba(44, 36, 22, 0.08);
  --radius: 22px;
  font-family: "Source Serif 4", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
}

body[data-brand="livre_de_pelo"] {
  --bg: #f6f0ec;
  --bg-accent: #efe4de;
  --surface: #fffaf8;
  --ink: #2b1f24;
  --muted: #7a5f68;
  --line: #ead8d4;
  --accent: #9a5b6e;
  --accent-ink: #fff7f5;
  --accent-soft: #f3e4e8;
  --shadow: 0 18px 50px rgba(43, 31, 36, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--bg-accent), transparent 60%),
    var(--bg);
  color: var(--ink);
}

body {
  font-family: "Segoe UI", "Avenir Next", "Nunito Sans", system-ui, -apple-system, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.75rem 0 3.5rem;
}

.top, .foot, .thanks-card {
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.45rem;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 650;
  color: var(--accent);
}

h1, h2, .terms-block h3 {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 {
  margin: 0 0 0.7rem;
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  line-height: 1.15;
}

.lede, .foot, .thanks-meta, .form-error {
  color: var(--muted);
}

.lede {
  margin: 0 auto 1.6rem;
  max-width: 34rem;
  font-size: 1.05rem;
}

main {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.4rem 0.4rem 1rem;
}

.foot {
  margin: 1.4rem 0 0;
  font-size: 0.82rem;
}

.noscript, .form-error {
  margin: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: #f8e8e6;
  color: #7a2e2a;
  text-align: center;
}

.form-error[hidden], .thanks[hidden] { display: none; }

.thanks {
  padding: 2.2rem 1.2rem 2.4rem;
}

.thanks-card h2 {
  margin: 0 0 0.6rem;
  font-size: 2rem;
}

.thanks-card p {
  margin: 0.35rem auto;
  max-width: 28rem;
}

.thanks-meta {
  margin-top: 1rem !important;
  font-size: 0.88rem;
}

/* Terms inside the form */
.terms-block {
  max-height: min(52vh, 420px);
  overflow: auto;
  padding: 0.15rem 0.15rem 0.4rem;
  text-align: left;
  color: var(--ink);
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}

.terms-block h3 {
  margin: 1.15rem 0 0.4rem;
  font-size: 1.05rem;
}

.terms-block h3:first-child { margin-top: 0; }

.terms-block p, .terms-block li {
  font-size: 0.95rem;
  color: #3a3226;
}

body[data-brand="livre_de_pelo"] .terms-block p,
body[data-brand="livre_de_pelo"] .terms-block li {
  color: #3a2b31;
}

.terms-block ul {
  margin: 0.2rem 0 0.4rem;
  padding-left: 1.15rem;
}

.terms-block .version-note {
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--muted);
}

/* SurveyJS theming */
#survey {
  --sjs-corner-radius: 12px;
  --sjs-font-family: "Segoe UI", "Avenir Next", "Nunito Sans", system-ui, -apple-system, sans-serif;
  --primary: var(--accent);
  --secondary: var(--accent);
}

#survey .sd-root-modern,
#survey .sd-container-modern,
#survey,
#survey .sd-body,
#survey .sd-page {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}

#survey .sd-title,
#survey .sd-header__text,
#survey .sd-page__title {
  display: none;
}

#survey .sd-row {
  margin: 0;
}

#survey .sd-element,
#survey .sd-question {
  padding: 0.55rem 1rem 0.35rem;
}

#survey .sd-question__title,
#survey .sd-question__title span,
#survey .sd-element__title {
  font-size: 0.98rem;
  font-weight: 650;
  color: var(--ink);
}

#survey .sd-description,
#survey .sd-question__description {
  color: var(--muted);
  font-size: 0.88rem;
}

#survey input.sd-input,
#survey .sd-input,
#survey .sd-dropdown,
#survey .sd-selectbase {
  font-size: 16px;
}

#survey .sd-input,
#survey input[type="text"],
#survey input[type="tel"] {
  border: 1px solid var(--line) !important;
  background: #fff !important;
  border-radius: 14px !important;
  padding: 0.85rem 0.95rem !important;
  color: var(--ink) !important;
  box-shadow: none !important;
}

#survey .sd-input:focus,
#survey input:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft) !important;
}

#survey .sd-selectbase__label,
#survey .sd-item__control-label,
#survey .sd-radio__label,
#survey .sd-checkbox__label {
  color: var(--ink);
  font-size: 0.98rem;
}

#survey .sd-checkbox,
#survey .sd-radio {
  margin: 0.15rem 0;
}

#survey .sd-checkbox .sd-item__decorator,
#survey .sd-radio .sd-item__decorator,
#survey .sd-checkbox__decorator,
#survey .sd-radio__decorator {
  border-color: #c9bba6 !important;
}

body[data-brand="livre_de_pelo"] #survey .sd-checkbox__decorator,
body[data-brand="livre_de_pelo"] #survey .sd-radio__decorator {
  border-color: #d4b8bf !important;
}

#survey .sd-item--checked .sd-item__decorator,
#survey .sd-checkbox--checked .sd-checkbox__decorator,
#survey .sd-radio--checked .sd-radio__decorator {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
}

#survey .sv-signaturepad,
#survey .sd-signaturepad,
#survey canvas {
  border-radius: 16px;
  background: #fff;
}

#survey .sjs_sp_container,
#survey .sd-signaturepad__container,
#survey .sv-signaturepad__container {
  border: 1px dashed #c9bba6 !important;
  border-radius: 16px !important;
  background: #fff !important;
  overflow: hidden;
}

body[data-brand="livre_de_pelo"] #survey .sjs_sp_container,
body[data-brand="livre_de_pelo"] #survey .sd-signaturepad__container {
  border-color: #d4b8bf !important;
}

#survey .sd-btn,
#survey .sd-navigation__complete-btn,
#survey button.sd-btn--action {
  background: var(--accent) !important;
  color: var(--accent-ink) !important;
  border: 0 !important;
  border-radius: 999px !important;
  padding: 0.95rem 1.4rem !important;
  font-weight: 650 !important;
  font-size: 1rem !important;
  letter-spacing: 0.01em;
  box-shadow: none !important;
  width: min(100%, 24rem);
}

#survey .sd-action-bar,
#survey .sd-footer,
#survey .sd-navigator,
#survey .sd-body__navigation {
  justify-content: center !important;
  padding: 0.4rem 1rem 1.1rem !important;
}

#survey .sd-action-title,
#survey .sv-action,
#survey .sd-signaturepad__actions,
#survey .sjs_sp_controls {
  color: var(--muted);
}

#survey .sd-completedpage {
  display: none !important;
}

@media (max-width: 640px) {
  .page { width: min(100% - 1.2rem, 760px); padding-top: 1.15rem; }
  main { padding: 0.15rem 0 0.6rem; border-radius: 18px; }
  #survey .sd-element, #survey .sd-question { padding: 0.45rem 0.8rem 0.25rem; }
  .terms-block { max-height: 46vh; }
}
