/* Formulário em passos (diálogo) e aviso de cookies */
.qd { border: 0; padding: 0; width: min(100% - 24px, 620px); max-height: min(92dvh, 760px); border-radius: var(--radius-lg); box-shadow: 0 30px 80px rgba(35,39,42,.35); color: var(--ink); background: var(--white); overflow: hidden; }
.qd::backdrop { background: rgba(35,39,42,.6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.qd[open] { display: flex; flex-direction: column; }
/* o formulário é a coluna flex: o corpo rola e os botões ficam sempre visíveis (telemóveis pequenos) */
.qd form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.qd form[hidden], .qd__done[hidden] { display: none; }
.qd__top { padding: 20px 24px 0; display: flex; align-items: center; gap: 14px; }
.qd__bar { flex: 1; height: 8px; background: var(--mist); border-radius: 99px; overflow: hidden; }
.qd__bar i { display: block; height: 100%; width: 0; background: var(--grad-blue); border-radius: 99px; transition: width .3s ease; }
.qd__count { font: 700 .85rem var(--font-head); color: var(--steel); white-space: nowrap; }
.qd__close { background: none; border: 0; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--steel); padding: 2px 8px; border-radius: 8px; }
.qd__close:hover { color: var(--ink); background: var(--mist); }
.qd__body { padding: 20px 24px 8px; overflow-y: auto; flex: 1; min-height: 0; }
.qd fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.qd legend { font: 800 clamp(1.3rem, 3.5vw, 1.6rem) var(--font-head); line-height: 1.2; padding: 0; margin-bottom: 6px; }
.qd .hint { color: var(--steel); font-size: .95rem; margin: 0 0 18px; }
.opts { display: grid; gap: 10px; }
.opts--2 { grid-template-columns: 1fr 1fr; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.opt span { display: flex; align-items: center; min-height: 54px; padding: 12px 16px; border: 2px solid var(--line); border-radius: var(--radius); font-weight: 600; transition: border-color .15s, background-color .15s; }
.opt input:hover + span { border-color: var(--blue); }
.opt input:checked + span { border-color: var(--blue-deep); background: #f4f6f8; color: var(--navy); }
.opt input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .95rem; }
.field input[type=text], .field input[type=tel], .field input[type=email], .field select {
  width: 100%; min-height: 50px; padding: 10px 14px; font: inherit; color: var(--ink); background: #fff;
  border: 2px solid var(--line); border-radius: 12px;
}
.field input:focus, .field select:focus { border-color: var(--blue-deep); outline: none; }
.field .opt-tag { font-weight: 400; color: var(--steel); }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: .9rem; color: var(--steel); margin: 6px 0 4px; }
.consent input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--blue-deep); }
.hp input { font: inherit; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.qd__err { color: var(--err); font-weight: 600; font-size: .92rem; min-height: 1.4em; margin: 8px 0 0; }
.qd__nav { display: flex; justify-content: space-between; gap: 12px; padding: 14px 24px 22px; border-top: 1px solid var(--line); }
.qd__nav .btn[hidden] { display: none; }
.qd__nav .btn--primary { margin-left: auto; }
.qd__done { padding: 40px 28px 36px; text-align: center; }
.qd__done .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); margin: 0 auto 20px; display: grid; place-items: center; }
.qd__done .tick svg { width: 32px; stroke: #fff; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.qd__done h2 { font-size: 1.6rem; }
.qd__fail { background: #fdecea; color: #7a1f18; border-radius: 12px; padding: 14px 16px; margin-top: 10px; font-size: .95rem; }
@media (max-width: 460px) { .opts--2 { grid-template-columns: 1fr; } .qd { width: 100%; max-height: 100dvh; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; } }

/* Aviso de armazenamento / cookies */
.ck { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60; max-width: 560px; background: var(--ink); color: #e6eaee; border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 20px 50px rgba(0,0,0,.35); font-size: .92rem; }
.ck[hidden] { display: none; }
.ck p { margin: 0 0 12px; } .ck a { color: #e0a08a; }
.ck__row { display: flex; flex-wrap: wrap; gap: 10px; }
.ck .btn { min-height: 44px; padding: 8px 18px; font-size: .9rem; }
.ck .btn--ghost { color: #fff; border-color: #55595f; }
@media (min-width: 900px) { .ck { left: 20px; right: auto; bottom: 20px; } }

.qd__done-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 8px; }
.qd__done-cta .btn[hidden] { display: none; }
.qd__done h2:focus { outline: none; }
.qd__done .demo-tag { font-size: .85rem; color: var(--steel); margin-top: -4px; }

/* Opções: indicador visível (círculo para escolha única, quadrado para várias) */
.opt span { gap: 12px; }
.opt span::before { content: ""; flex: none; width: 20px; height: 20px; border: 2px solid #b9c0c8; border-radius: 50%; background: #fff; transition: border-color .15s, box-shadow .15s, background-color .15s; }
.opt input:checked + span::before { border-color: var(--blue-deep); box-shadow: inset 0 0 0 4px #fff; background: var(--blue-deep); }
.opt--check span::before { border-radius: 6px; }
.opt--check input:checked + span::before { box-shadow: none; background: var(--blue-deep) center / 14px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E"); }
.opt input:checked + span { box-shadow: 0 0 0 1px var(--blue-deep); }
.opt input[aria-invalid=true] ~ span, .opts:has(input[aria-invalid=true]) .opt span { border-color: var(--err); }
.opts__label { font-weight: 700; font-size: .95rem; margin: 4px 0 8px; }
.opts + .opts__label { margin-top: 18px; }
.opts--3 { grid-template-columns: repeat(3, 1fr); }
.opts--3 .opt span { justify-content: flex-start; }
.field--notes { margin-top: 16px; }
.field[hidden] { display: none; }
.field textarea { width: 100%; min-height: 84px; padding: 10px 14px; font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 12px; resize: vertical; }
.field textarea:focus { border-color: var(--blue-deep); outline: none; }
.field input[aria-invalid=true], .field select[aria-invalid=true] { border-color: var(--err); }
.consent input[aria-invalid=true] { outline: 2px solid var(--err); outline-offset: 2px; }
.qd__close:focus-visible, .qsum__edit:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Pormenores: cartões com ícone, todos com a mesma altura (linhas da grelha iguais) */
.xopts { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 10px; }
.xopt { position: relative; display: block; min-width: 0; }
.xopt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.xopt__card { display: grid; grid-template-columns: 36px 1fr 20px; align-items: center; gap: 10px; height: 100%; min-height: 68px; padding: 10px 12px; border: 2px solid var(--line); border-radius: var(--radius); background: #fff; transition: border-color .15s, background-color .15s, box-shadow .15s; }
.xopt__ico { width: 36px; height: 36px; padding: 7px; border-radius: 10px; background: var(--mist); stroke: var(--blue-deep); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: background-color .15s, stroke .15s; }
.xopt__txt { display: grid; gap: 2px; min-width: 0; }
.xopt__txt strong { font-weight: 700; font-size: .92rem; line-height: 1.25; color: var(--ink); }
.xopt__txt small { font-size: .8rem; line-height: 1.3; color: var(--steel); }
.xopt__tick { width: 20px; height: 20px; border: 2px solid #b9c0c8; border-radius: 6px; background: #fff; }
.xopt input:hover + .xopt__card { border-color: var(--blue); }
.xopt input:focus-visible + .xopt__card { outline: 3px solid var(--blue); outline-offset: 2px; }
.xopt input:checked + .xopt__card { border-color: var(--blue-deep); background: #fbf4f1; box-shadow: 0 0 0 1px var(--blue-deep); }
.xopt input:checked + .xopt__card .xopt__ico { background: var(--blue-deep); stroke: #fff; }
.xopt input:checked + .xopt__card .xopt__tick { border-color: var(--blue-deep); background: var(--blue-deep) center / 14px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E"); }
.xcount { margin: 10px 0 0; font-size: .88rem; color: var(--steel); }
.xcount.is-on { color: var(--blue-deep); font-weight: 700; }
.field--notes textarea { min-height: 112px; }
.xnotes__count { justify-self: end; font-size: .8rem; color: var(--steel); }
.xnotes__count.is-near { color: var(--err); font-weight: 600; }
.field__hint { font-size: .82rem; color: var(--steel); }

/* Localização: sugestão a partir do dispositivo */
.geo { margin: 0 0 14px; }
.geo[hidden], .geo__suggest[hidden] { display: none; }
.geo__btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px 8px 12px; font: inherit; font-weight: 600; font-size: .95rem; color: var(--blue-deep); background: #fff; border: 2px solid var(--line); border-radius: 99px; cursor: pointer; transition: border-color .15s, background-color .15s; }
.geo__btn:hover { border-color: var(--blue); }
.geo__btn:focus-visible, .geo__other:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.geo__btn:disabled { cursor: progress; opacity: .7; }
.geo__btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.geo__note { margin: 6px 0 0; font-size: .8rem; color: var(--steel); }
.geo__suggest { margin-top: 12px; padding: 14px 16px; border: 2px solid var(--blue-deep); border-radius: var(--radius); background: #fbf4f1; }
.geo__suggest p { margin: 0 0 10px; font-weight: 600; }
.geo__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.geo__ok { min-height: 44px; padding: 8px 20px; font-size: .95rem; }
.geo__other { background: none; border: 0; padding: 6px 4px; font: inherit; font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; border-radius: 6px; min-height: 44px; }
.geo__status { margin: 6px 0 0; font-size: .88rem; color: var(--steel); min-height: 0; }
.geo__status:empty { display: none; }

/* Resumo antes de enviar */
.qsum { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.qsum__row { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 4px 14px; padding: 11px 14px; border-top: 1px solid var(--line); }
.qsum__row:first-child { border-top: 0; }
.qsum__row:nth-child(even) { background: var(--mist); }
.qsum dt { font-weight: 700; font-size: .88rem; color: var(--steel); }
.qsum dd { margin: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; font-size: .95rem; overflow-wrap: anywhere; }
.qsum__edit { flex: none; background: none; border: 0; padding: 2px 4px; font-family: inherit; font-weight: 600; font-size: .85rem; color: var(--blue-deep); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; border-radius: 6px; min-height: 32px; }
.qsum__edit:hover { color: var(--ink); }

/* Estado "a enviar" */
.qd__nav .btn:disabled { cursor: progress; opacity: .85; }
.btn.is-sending::after { content: ""; width: 16px; height: 16px; margin-left: 10px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: qspin .7s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes qspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.is-sending::after { animation-duration: 2s; } }

@media (max-width: 460px) {
  .qd__top { padding: 16px 16px 0; }
  .qd__body { padding: 16px 16px 8px; }
  .qd__nav { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
  .opts--3 { grid-template-columns: 1fr; }
  .opt span { min-height: 50px; }
  .xopts { grid-template-columns: 1fr; }
  .xopt__card { min-height: 64px; }
  .qsum__row { grid-template-columns: 1fr; }
}
