/* Form section, request flow, footer, sticky bar (W-0047, rev 4a W-0058: one question per screen). */
.form-sec { background: linear-gradient(165deg, #D3E5F1 0%, #F5EAD8 55%, #FFE0AE 100%); }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-6) var(--gap); }
.form-side, .form-main { grid-column: 1 / -1; min-width: 0; }
.form-side h2 { margin-bottom: var(--space-3); max-width: 14ch; text-wrap: balance; }
.form-sub { margin: 0 0 var(--space-6); font-size: var(--fs-lead); color: var(--color-ink-muted); max-width: 34ch; }
.bullets { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.bullets li { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.0625rem; }
.bullets .tick { width: 26px; height: 26px; flex: none; }
.form { position: relative; overflow: clip; background: var(--color-surface); border: 1px solid #fff; border-radius: var(--radius-card); padding: var(--space-6) var(--space-4) 0; box-shadow: 0 2px 4px rgb(15 42 61 / .06), 0 34px 60px -30px rgb(15 42 61 / .5); }
.form::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, #FFB627, #FF8A3D); }
html:not(.js) #req { display: none; }

/* one global progress bar */
.progress { margin-bottom: var(--space-6); }
.progress-label { margin: 0 0 var(--space-2); font-size: var(--fs-small); font-weight: 600; color: var(--color-ink-muted); }
.bar-track { height: 8px; background: var(--color-sun-soft); border-radius: var(--radius-pill); overflow: hidden; }
.bar-fill { height: 100%; width: 4%; background: var(--color-link); border-radius: var(--radius-pill); transition: width 300ms var(--ease-out); }

/* screens: only the active one is shown, it slides in from the side it came from */
.js .step:not(.active) { display: none; }
.step { min-width: 0; }
.js .step.active.fwd { animation: slide-fwd var(--dur-base) var(--ease-out); }
.js .step.active.back { animation: slide-back var(--dur-base) var(--ease-out); }
/* W-0169 (review c37 F4a): a screen change is a fade in place, no sideways slide (the 28 px travel read as the page jumping) */
@keyframes slide-fwd { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-back { from { opacity: 0; } to { opacity: 1; } }
.qh { font-size: clamp(1.3125rem, 1.1rem + 1vw, 1.625rem); line-height: 1.2; margin: 0 0 var(--space-3); outline: none; text-wrap: balance; } /* W-0169 (F4b): 12 px under the screen title (was 8) */
.step > .hint { margin-bottom: var(--space-4); }
.qh .bul { color: var(--color-ink-muted); }
.intro { font-size: var(--fs-small); color: var(--color-ink-muted); margin: 0 0 var(--space-4); }
.hint { font-size: var(--fs-small); color: var(--color-ink-muted); margin: 0 0 var(--space-3); }
.hint.mark { font-weight: 600; }
.tag { font-weight: 500; font-size: var(--fs-small); color: var(--color-ink-muted); margin-left: var(--space-1); }

/* question blocks: fieldset reset; rows on shared screens get a bold legend and breathing room */
.q { border: 0; margin: 0; padding: 0; min-width: 0; }
.q[hidden] { display: none; }
.q + .q { margin-top: var(--space-8); } /* W-0169 (F4b): more air between questions (was 24 px) */
/* W-0169 (F4b): the question title is its own level, above the answers: heading face, 800, larger (was 17 px / 700, same weight family as the answer labels), 16 px to the options */
.rq { padding: 0; margin: 0 0 var(--space-4); font-family: var(--font-heading); font-weight: 800; font-size: clamp(1.1875rem, 1.1rem + .4vw, 1.3125rem); line-height: 1.25; color: var(--color-ink); text-wrap: balance; }
.rq ~ .tiles { margin-top: 0; }
.rq .bul { color: var(--color-ink-muted); }
.js .q.rev { animation: reveal-q var(--dur-base) var(--ease-out); }
@keyframes reveal-q { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* big tap tiles: icon on top, 2 columns on phone, 3 on desktop; selected = sun fill + check (lighter 1.5 px borders, still >= 3:1) */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin-top: var(--space-4); }
.tiles.list { grid-template-columns: minmax(0, 1fr); }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); text-align: center;
  min-height: 112px; padding: var(--space-4) var(--space-3);
  border: 1.5px solid #8497A5; border-radius: 16px; background: var(--color-surface); cursor: pointer;
  transition: background-color 160ms, border-color 160ms, transform var(--dur-fast) var(--ease-out);
}
.tiles.list .tile { flex-direction: row; text-align: left; justify-content: flex-start; min-height: 68px; padding: var(--space-3) var(--space-4); gap: var(--space-3); }
.tile:active { transform: scale(.985); }
.tin { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tile:has(.tin:focus-visible), .seg-o:has(.tin:focus-visible) { outline: var(--focus-ring); outline-offset: 2px; }
.ti { flex: none; width: 48px; height: 48px; border-radius: 14px; background: var(--color-paper); color: var(--color-ink); display: flex; align-items: center; justify-content: center; transition: background-color 160ms; }
.ti .ico { width: 28px; height: 28px; }
.tl { min-width: 0; font-weight: 600; line-height: 1.25; overflow-wrap: break-word; hyphens: manual; display: block; } /* answer labels wrap to 2 lines, never clipped or ellipsised (W-0123) */
.tiles.list .tl { flex: 1; }
.tk { flex: none; width: 22px; height: 22px; }
.tiles.grid .tk { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity 160ms; }
.tiles.grid .is-on .tk { opacity: 1; }
.tk-bg { fill: #fff; stroke: #8497A5; stroke-width: 2; transition: fill 160ms, stroke 160ms; }
.tk-v { stroke: transparent; stroke-width: 2.6; transition: stroke 160ms; }
.tile.is-on { background: var(--color-sun-soft); border-color: var(--color-ink); }
.tile.is-on .ti { background: var(--color-sun); }
.tile.is-on .tk-bg, .seg-o.is-on .tk-bg { fill: var(--color-ink); stroke: var(--color-ink); }
.tile.is-on .tk-v, .seg-o.is-on .tk-v { stroke: #fff; }
@media (hover: hover) { .tile:hover, .seg-o:hover { border-color: var(--color-ink); } }
.tile.consent { flex-direction: row; align-items: flex-start; text-align: left; justify-content: flex-start; min-height: 0; margin-top: var(--space-3); padding: var(--space-4); gap: var(--space-3); }
.tile.consent .tl { font-weight: 500; flex: 1; display: block; -webkit-line-clamp: unset; overflow: visible; }
.tile.consent .tk { margin-top: 2px; position: static; opacity: 1; }
.plink { font-weight: 600; position: relative; z-index: 1; }

/* segmented rows / chips: short answers on one or two lines, wrap on phone */
.seg { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.seg-o { position: relative; flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 6px var(--space-4); border: 1.5px solid #8497A5; border-radius: 12px; background: var(--color-surface); cursor: pointer; text-align: center; transition: background-color 160ms, border-color 160ms, transform var(--dur-fast) var(--ease-out); }
.seg-o:active { transform: scale(.98); }
.seg-o .tl { display: block; -webkit-line-clamp: unset; overflow: visible; }
.seg-o .tk { width: 0; opacity: 0; margin: 0; transition: width 160ms, opacity 160ms; }
.seg-o.is-on { background: var(--color-sun-soft); border-color: var(--color-ink); }
.seg-o.is-on .tk { width: 20px; height: 20px; opacity: 1; }
.fl { display: block; margin: var(--space-4) 0 0; font-weight: 700; }
.q-text:first-child .fl { margin-top: 0; }
.vat { margin: var(--space-2) 0 0; }

/* typed fields */
input[type=text], input[type=tel], input[type=email], textarea {
  width: 100%; min-height: 52px; margin-top: var(--space-2); padding: 0 var(--space-4); font: inherit; font-size: 1.125rem; color: var(--color-ink);
  background: var(--color-surface); border: 1.5px solid #8497A5; border-radius: 12px;
}
textarea { padding: var(--space-3) var(--space-4); resize: vertical; min-height: 88px; }
input[aria-invalid="true"] { border-color: var(--color-error); }
.count { margin: var(--space-1) 0 0; }
.err { color: var(--color-error); font-size: var(--fs-small); font-weight: 600; margin: var(--space-2) 0 0; display: flex; gap: var(--space-2); align-items: flex-start; }
.err::before { content: "!"; flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--color-error); color: #fff; font-size: 12px; line-height: 18px; text-align: center; font-weight: 800; margin-top: 1px; }
.err[hidden] { display: none; }
.panel { background: var(--color-paper); border-radius: 14px; padding: var(--space-4); margin: var(--space-4) 0 0; border: 1px solid #e8dcc3; }
.panel p:last-child { margin-bottom: 0; }
.panel.stop { border-color: var(--color-warn); }
.panel.stop[hidden] { display: none; }
.panel.stop h4 { margin-top: 0; }
.ph { background: var(--color-sun-soft); padding: 0 4px; border-radius: 4px; }
.footer .ph { color: var(--color-ink); }
.footnote { margin-top: var(--space-4); }

.q-text + .q-text { margin-top: 0; }
.q-text + .q-seg, .q-seg + .q-text { margin-top: var(--space-6); }
.consents { margin-top: var(--space-4); }
#sum + .q { margin-top: var(--space-6); }

/* review: compact grouped cards, one Edit per group */
#sum { margin-top: var(--space-3); display: grid; gap: var(--space-3); }
.rcard { border: 1px solid #e8dcc3; border-radius: 14px; padding: var(--space-2) var(--space-4) var(--space-3); background: var(--color-surface); }
.rhead { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.rhead h3 { margin: 0; font-size: 1rem; }
.rhead .link { min-height: 44px; min-width: 44px; padding: 0 var(--space-2); margin-right: calc(var(--space-2) * -1); background: none; border: 0; font: inherit; font-weight: 700; color: var(--color-link); text-decoration: underline; cursor: pointer; }
.rrows { margin: 0; display: grid; gap: 6px; }
.rrow { display: grid; grid-template-columns: minmax(84px, .38fr) minmax(0, 1fr); gap: var(--space-3); font-size: var(--fs-small); }
.rrow dt { color: var(--color-ink-muted); font-weight: 600; }
.rrow dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.vatnote { display: block; font-weight: 500; color: var(--color-ink-muted); font-size: .8125rem; }
.skipped { margin: 0; font-weight: 500; font-style: italic; color: var(--color-ink-muted); font-size: var(--fs-small); }

/* navigation: sticky at the bottom of the card so it is always in reach */
.nav { display: none; align-items: center; gap: var(--space-2); position: static; bottom: 0; z-index: 2; margin: var(--space-6) calc(var(--space-4) * -1) 0; padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgb(255 255 255 / 0), #fff 24%); }
.js .nav { display: flex; }
/* D1 (W-0096): the nav sticks to the viewport bottom only once the card top has scrolled past the viewport top; before that it stays at the card end, so it never floats over the heading and first tiles */
.js .form.pin .nav { position: sticky; }
.nav [hidden] { display: none; }
.nav-gap { flex: 1; }
.nav .btn { padding-inline: var(--space-4); }
.nav .btn-quiet { background: transparent; color: var(--color-link); border-color: transparent; text-decoration: underline; padding-inline: var(--space-3); }
.status { font-weight: 600; margin-top: var(--space-4); }
/* W-0109 (DX-3): visible pending state on the send button: label becomes the status text, dimmed, small spinner, no pointer */
.btn:disabled, .btn[aria-busy="true"] { opacity: .72; cursor: progress; transform: none; }
.btn[aria-busy="true"]::before { content: ""; width: 1em; height: 1em; margin-inline-end: .5em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; vertical-align: -.15em; animation: btn-spin .8s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn[aria-busy="true"]::before { animation: none; border-right-color: currentColor; } }
.panel.fail { border-color: var(--color-error); margin-top: var(--space-4); }
.panel.ok { border-color: var(--color-ok); background: var(--color-surface); }
.panel.ok h2 { color: var(--color-ok); font-size: var(--fs-h3-lg); }
.panel.ok h3 { margin-top: var(--space-4); }
.panel.ok .ok-brand { font-family: var(--font-heading); font-weight: 700; font-size: var(--fs-lead); line-height: 1.35; color: var(--color-ink); text-wrap: balance; } /* W-0119 brand line */
.preview-note { color: var(--color-warn); font-weight: 600; font-size: var(--fs-small); }
.net { background: var(--color-sun-soft); border-radius: 10px; padding: var(--space-3); font-weight: 600; }
.plain { padding-left: 1.25rem; margin: 0 0 var(--space-4); list-style: none; padding: 0; }

/* footer: wordmark, email, region, privacy, language; full consent and privacy texts stay below (LC-8) */
.footer { background: linear-gradient(180deg, #0F2A3D, #07151f); color: #cfe0ec; padding-block: var(--space-12) var(--space-8); font-size: var(--fs-small); }
.foot-top { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-8) var(--gap); padding-bottom: var(--space-8); border-bottom: 1px solid rgb(255 255 255 / .14); }
.foot-top > * { grid-column: 1 / -1; min-width: 0; }
.foot-brand p { margin: var(--space-2) 0 var(--space-4); color: var(--color-sky-on-night); max-width: 30ch; }
.foot-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); font-weight: 600; font-size: 1rem; color: #e6eff6; }
.foot-col a { display: inline-flex; align-items: center; min-height: 40px; text-decoration: none; }
.foot-col a:hover { text-decoration: underline; text-underline-offset: 4px; }
.h-foot { margin: 0 0 var(--space-3); font-size: var(--fs-small); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--color-sky-on-night); }
.footer .lang { display: inline-flex; }
.footer .ph { color: var(--color-ink); }
.foot-legal { padding-top: var(--space-6); display: grid; gap: var(--space-4); color: #a9c0d1; }
.foot-legal p { margin: 0; }
.footer .h-small { font-size: 1rem; color: #e6eff6; margin-bottom: var(--space-2); }
.courtesy { font-weight: 600; }
/* W-0131: small footer on the home page: wordmark, legal links, language; one quiet note line (coverage, courtesy translation) */
.footer.foot-s { padding-block: var(--space-6) calc(var(--space-6) + env(safe-area-inset-bottom)); font-size: .875rem; }
.fs-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-6); }
.fs-brand { font-family: var(--font-heading); font-weight: 800; font-size: 1.125rem; letter-spacing: -.02em; color: #e6eff6; }
.fs-nav { flex: 1 1 auto; min-width: 0; }
.fs-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 var(--space-6); }
.fs-links a { display: inline-flex; align-items: center; min-height: 40px; font-weight: 600; color: #cfe0ec; text-underline-offset: 3px; }
.fs-note { margin: var(--space-2) 0 0; color: #a9c0d1; font-size: .8125rem; }
@media (max-width: 599px) { .fs-nav { flex-basis: 100%; order: 3; } .fs-row { justify-content: space-between; } }
/* W-0134: service links in the footer (launch build), quiet second row under the legal row */
.fs-svc { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid rgb(159 201 227 / .2); }
.fs-svc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 var(--space-4); }
.fs-svc-list a { display: inline-flex; align-items: center; min-height: 40px; color: #cfe0ec; text-underline-offset: 3px; }
/* W-0136: brand and city rows, smaller, label + links on one wrapping line, no extra divider */
.fs-mini { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-3); margin-top: 0; padding-top: 0; border-top: 0; font-size: .8125rem; }
.fs-lab { color: #a9c0d1; font-weight: 600; }
.fs-mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 var(--space-3); }
.fs-mini-list a { display: inline-flex; align-items: center; min-height: 32px; min-width: 24px; color: #cfe0ec; text-underline-offset: 3px; }
/* W-0161 (review c35 B8): launch footer in columns: Serviços · Marcas · Zonas · Informação legal. Wordmark + language on top, columns below. */
.foot-cols .fs-row { justify-content: space-between; padding-bottom: var(--space-4); border-bottom: 1px solid rgb(159 201 227 / .2); }
.fs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6) var(--space-4); padding-top: var(--space-6); }
.fs-col-h { margin: 0 0 var(--space-2); font-family: var(--font-body); font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-sky-on-night); }
.fs-col ul { list-style: none; margin: 0; padding: 0; }
.fs-col a { display: inline-flex; align-items: center; min-height: 32px; color: #cfe0ec; text-underline-offset: 3px; }
.fs-col a:hover { color: #fff; }
.foot-cols .fs-note { margin-top: var(--space-6); }
@media (min-width: 720px) { .fs-grid { grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: var(--space-8); } }

/* sticky mobile bar: Email + Pedir proposta (Q-14: email only); hidden while the form is on screen */
.bar {
  position: fixed; inset: auto 0 0 0; z-index: 50; display: flex; gap: var(--space-2); align-items: center;
  min-height: 56px; padding: var(--space-2) var(--gutter) calc(var(--space-2) + env(safe-area-inset-bottom));
  background: var(--color-surface); border-top: 1px solid #e8dcc3; box-shadow: 0 -2px 8px rgb(15 42 61 / .1);
}
.bar .btn { flex: 1; padding-inline: var(--space-3); }
.bar .btn-primary { flex: 2; }
body.kb .bar, body.in-form .bar, body.in-hero-cta .bar { display: none; }

@media (prefers-reduced-motion: reduce) {
  .js .step.active.fwd, .js .step.active.back { animation: none; }
  .tile, .seg-o, .tk, .tk-bg, .tk-v, .ti, .bar-fill { transition: none; }
  .js .q.rev { animation: none; }
}
@media (min-width: 640px) {
  .form { padding: var(--space-8) var(--space-8) 0; }
  .nav { margin-inline: calc(var(--space-8) * -1); padding-inline: var(--space-8); }
  /* W-0164 (review c36 C1): 10 service tiles (named as the service cards) in 2 columns = 5 full rows; each tile a compact row (icon, name, tick) */
  .tiles.grid .tile { flex-direction: row; justify-content: flex-start; text-align: left; min-height: 72px; padding: var(--space-3) 44px var(--space-3) var(--space-4); gap: var(--space-3); }
  .tiles.grid .tk { top: 50%; margin-top: -11px; right: 12px; }
}
.tiles.grid > .tile:last-child:nth-child(odd) { grid-column: 1 / -1; } /* W-0164: an odd count never leaves a hole in the last row */
@media (min-width: 640px) {
  .foot-brand { grid-column: 1 / -1; }
  .foot-col { grid-column: span 4; }
}
@media (min-width: 768px) {
  body { padding-bottom: 0; }
  .bar { display: none; }
}
@media (min-width: 960px) {
  .foot-brand { grid-column: span 5; }
  .foot-col { grid-column: span 2; }
  .foot-col:last-child { grid-column: span 3; }
  .form-grid { align-items: start; column-gap: var(--space-16); }
  .form-side { grid-column: 1 / span 4; position: sticky; top: var(--space-8); padding-top: var(--space-6); }
  .form-main { grid-column: 5 / -1; }
  .form-side h2 { font-size: clamp(2.25rem, 1.4rem + 2vw, 3.25rem); }
}
