/* Requisitos — tema compartilhado (formulário, resultado, painel) */

:root {
  --req-bg: #f0f4f8;
  --req-bg-accent: #e8eef6;
  --req-surface: #ffffff;
  --req-ink: #0f172a;
  --req-ink-soft: #334155;
  --req-muted: #64748b;
  --req-border: #e2e8f0;
  --req-accent: #2563eb;
  --req-accent-hover: #1d4ed8;
  --req-accent-soft: #eff6ff;
  --req-success: #059669;
  --req-success-hover: #047857;
  --req-danger: #dc2626;
  --req-danger-hover: #b91c1c;
  --req-radius: 14px;
  --req-radius-sm: 10px;
  --req-radius-xs: 6px;
  --req-shadow: 0 4px 24px rgba(15, 23, 42, 0.07);
  --req-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --req-font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
  --req-max: 720px;
  --req-max-wide: 960px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body.req {
  margin: 0;
  min-height: 100vh;
  font-family: var(--req-font);
  color: var(--req-ink);
  background: var(--req-bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 100% 0%, rgba(37, 99, 235, 0.09), transparent 50%),
    radial-gradient(ellipse 80% 60% at 0% 100%, rgba(14, 165, 233, 0.06), transparent 45%);
  line-height: 1.5;
}

/* ——— Top bar ——— */
.req-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--req-border);
  box-shadow: var(--req-shadow-sm);
}

.req-topbar__inner {
  max-width: var(--req-max-wide);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.req-brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--req-ink);
}

.req-topbar__link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--req-accent);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--req-radius-xs);
  transition: background 0.15s, color 0.15s;
}

.req-topbar__link:hover {
  background: var(--req-accent-soft);
  color: var(--req-accent-hover);
}

.req-topbar__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
}

.req-topbar__nav a {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--req-accent);
  text-decoration: none;
}

.req-topbar__nav a:hover {
  text-decoration: underline;
}

/* ——— Layout ——— */
.req-main {
  padding: 1.5rem 1rem 3rem;
}

.req-container {
  max-width: var(--req-max-wide);
  margin: 0 auto;
}

.req-container--narrow {
  max-width: var(--req-max);
}

.req-hero {
  text-align: center;
  margin-bottom: 1.75rem;
  padding: 0 0.5rem;
}

.req-hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--req-ink);
}

.req-hero p {
  margin: 0;
  color: var(--req-muted);
  font-size: 0.95rem;
}

/* ——— Cards / seções ——— */
.req-card {
  background: var(--req-surface);
  border-radius: var(--req-radius);
  border: 1px solid var(--req-border);
  box-shadow: var(--req-shadow);
  padding: 1.25rem 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
}

.req-section-title {
  margin: 0 0 1.1rem;
  padding-bottom: 0.65rem;
  border-bottom: 2px solid var(--req-accent-soft);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--req-ink);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Título da seção + Sim/Não na mesma linha (portão da seção) */
.req-section-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 0.65rem;
  row-gap: 0.35rem;
  margin: 0 0 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 2px solid var(--req-accent-soft);
}

.req-section-title--em-linha {
  margin: 0;
  padding: 0;
  border: none;
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(100%, 28rem);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--req-ink);
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.req-field--yesno--linha {
  margin: 0;
  flex: 0 0 auto;
}

.req-section-head-row > .req-field--yesno--linha {
  margin-left: auto;
}

.req-yesno-checks--linha {
  margin: 0;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.req-yesno-check--compact {
  padding: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.req-yesno-check--compact span {
  font-weight: 600;
}

/* Sim/Não no corpo + demais campos: pergunta à esquerda, respostas + Comentar à direita (end) */
.req-yesno-pergunta-row,
.req-pergunta-linha {
  display: grid;
  grid-template-columns: minmax(11rem, 1fr) minmax(14rem, 1.35fr);
  column-gap: 0.85rem;
  row-gap: 0.4rem;
  align-items: start;
  width: 100%;
}

.req-label__text--yesno-linha,
.req-label__text--linha {
  margin: 0;
  max-width: 100%;
  min-width: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--req-ink);
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.35;
  grid-column: 1;
  align-self: center;
}

.req-pergunta-linha--top {
  align-items: flex-start;
}

.req-pergunta-linha--top .req-ctrl-com-linha {
  align-self: flex-end;
}

.req-input--linha {
  flex: 1 1 12rem;
  min-width: 0;
  width: auto;
  max-width: 100%;
}

/* Controle + link Comentar (caixa de comentário vem na linha seguinte, via afterRow) */
.req-ctrl-com-linha {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 0.65rem;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(100%, 26rem);
  margin-left: 0;
  width: 100%;
  grid-column: 2;
}

.req-ctrl-com-linha--top {
  align-items: flex-start;
}

.req-select--in-combo {
  flex: 1 1 10rem;
  min-width: 0;
  width: auto;
  max-width: 100%;
}

.req-yesno-gate-linha {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.65rem;
  width: 100%;
}

.req-yesno-ctrl-com {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.65rem;
  flex: 0 1 auto;
  min-width: 0;
  margin-left: 0;
  width: 100%;
  grid-column: 2;
}

.req-field--yesno-gate {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.req-field--yesno.req-field--invalid {
  border: 2px solid #dc2626;
  border-radius: var(--req-radius-sm);
  padding: 0.45rem 0.55rem;
  background: #fff7f7;
}

.req-field--yesno.req-field--invalid .req-yesno-checks {
  outline: 2px solid rgba(220, 38, 38, 0.2);
  outline-offset: 3px;
  border-radius: var(--req-radius-xs);
}

.req-field.req-field--invalid {
  border: 2px solid #dc2626;
  border-radius: var(--req-radius-sm);
  padding: 0.45rem 0.55rem;
  background: #fff7f7;
}

.req-field.req-field--invalid .req-input,
.req-field.req-field--invalid .req-select,
.req-field.req-field--invalid .req-textarea {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

/* "Comentar" em linha própria (quebra abaixo do controle) */
.req-comentar-row {
  flex-basis: 100%;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-top: 0.2rem;
  grid-column: 1 / -1;
}

.req-field--yesno-gate > .req-comentar-row {
  margin-top: 0.35rem;
}

.req-comentar-link {
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--req-accent);
  text-decoration: underline;
  text-underline-offset: 0.12em;
  cursor: pointer;
  white-space: nowrap;
}

.req-comentar-link:hover {
  color: var(--req-accent-hover);
}

.req-comentar-link--fechar {
  font-size: 1.25rem;
  line-height: 1;
  text-decoration: none;
  min-width: 1.75rem;
  text-align: center;
  color: var(--req-muted);
}

.req-comentar-link--fechar:hover {
  color: var(--req-ink);
}

.req-comentario-wrap {
  width: 100%;
  flex-basis: 100%;
}

.req-comentario-field {
  margin-top: 0.35rem;
}

.req-field--linha > .req-comentario-wrap,
.req-field--yesno-gate > .req-comentario-wrap {
  margin-top: 0.25rem;
  margin-left: auto;
  width: min(100%, 26rem);
}

.req-comentario-ta {
  width: 100%;
  min-height: 4.5rem;
  margin: 0;
  box-sizing: border-box;
}

.req-textarea--linha {
  flex: 2 1 14rem;
  min-width: min(100%, 10rem);
  width: auto;
  max-width: 100%;
  min-height: 5rem;
}

.req-color-row--linha {
  flex: 1 1 12rem;
  min-width: 0;
  justify-content: flex-end;
}

.req-file-upload-box--linha {
  flex: 1 1 12rem;
  min-width: 0;
  width: auto;
  max-width: 100%;
}

.req-checkbox-group--linha {
  flex: 1 1 14rem;
  min-width: 0;
  margin-top: 0;
  grid-template-columns: 1fr;
}

.req-pergunta-linha__controls {
  flex: 1 1 14rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.req-pergunta-linha__controls .repeatable-container {
  margin-bottom: 0;
}

.req-file-hint-below {
  margin: 0.45rem 0 0;
  width: 100%;
}

.req-field--linha .req-label__text--linha {
  margin-bottom: 0;
}

/* ——— Campos ——— */
.req-field {
  margin-bottom: 1.1rem;
}

.req-field:last-child {
  margin-bottom: 0;
}

.req-label__text,
.req-group-title {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--req-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.req-group-title {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9375rem;
  color: var(--req-ink-soft);
  margin-bottom: 0.65rem;
}

.req-input,
.req-select,
.req-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--req-ink);
  background: #fafbfc;
  border: 1px solid var(--req-border);
  border-radius: var(--req-radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.req-input:hover,
.req-select:hover,
.req-textarea:hover {
  border-color: #cbd5e1;
}

.req-input:focus,
.req-select:focus,
.req-textarea:focus {
  outline: none;
  border-color: var(--req-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.req-textarea {
  min-height: 6.5rem;
  resize: vertical;
}

.req-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.25rem;
}

/* Checkboxes */
.req-checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem 1rem;
  margin-top: 0.25rem;
}

.req-checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--req-ink-soft);
  cursor: pointer;
  padding: 0.45rem 0.5rem;
  border-radius: var(--req-radius-xs);
  transition: background 0.12s;
}

.req-checkbox-group label:hover {
  background: var(--req-bg-accent);
}

.req-checkbox-group input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--req-accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* Condicional */
.req-conditional {
  margin-top: 0.75rem;
  padding: 1rem 1rem 0.25rem;
  border-left: 4px solid var(--req-accent);
  border-radius: 0 var(--req-radius-sm) var(--req-radius-sm) 0;
  background: linear-gradient(90deg, var(--req-accent-soft) 0%, transparent 100%);
}

/* Sim / Não — checkboxes nativos (um de cada vez via JS + campo oculto) */
.req-yesno-checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.35rem;
  margin-top: 0.35rem;
}

.req-yesno-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--req-ink);
}

.req-yesno-check:hover {
  color: var(--req-accent);
}

.req-yesno-check:has(input:checked) {
  color: var(--req-accent-hover);
}

.req-yesno-check input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  accent-color: var(--req-accent);
  cursor: pointer;
  flex-shrink: 0;
  appearance: auto;
}

/* Corpo da seção após pergunta inicial Sim/Não */
.req-section-gate-body {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--req-border);
}

.req-section-gate-body[hidden] {
  display: none !important;
}

.req-section-gate-fieldset {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

/* Formulário público: empilhamento das perguntas + linha entre itens */
.req--form .req-fields-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.req--form .req-fields-stack > .req-field,
.req--form .req-fields-stack > .req-conditional {
  margin-top: 0;
  margin-bottom: 0;
  padding: 0.85rem 1rem;
  border-radius: var(--req-radius-xs);
  border-bottom: 1px solid var(--req-border);
}

.req--form .req-fields-stack > .req-field:last-child,
.req--form .req-fields-stack > .req-conditional:last-child {
  border-bottom: none;
}

.req--form .req-fields-stack > .req-conditional {
  border-left: 4px solid var(--req-accent);
  border-radius: 0 var(--req-radius-sm) var(--req-radius-sm) 0;
}

.req--form .req-fields-stack .req-conditional > .req-field {
  margin-bottom: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--req-radius-xs);
  border-bottom: 1px solid var(--req-border);
}

.req--form .req-fields-stack .req-conditional > .req-field:last-child {
  margin-bottom: 0;
  border-bottom: none;
}

/* Cor e arquivo */
.req-color-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.req-color-native {
  width: 3.5rem;
  height: 2.5rem;
  padding: 0.2rem;
  border: 1px solid var(--req-border);
  border-radius: var(--req-radius-sm);
  cursor: pointer;
  background: var(--req-surface);
}

.req-color-hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--req-muted);
}

.req-file-input {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0;
  font-size: 0.9375rem;
  cursor: pointer;
}

.req-file-input--visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.req-file-upload-btn {
  width: 9.25rem;
  min-height: 6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.7rem;
  border: 2px dashed #94a3b8;
  border-radius: var(--req-radius-sm);
  background: #f8fafc;
  color: var(--req-ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.req-file-upload-btn:hover {
  border-color: var(--req-accent);
  background: var(--req-accent-soft);
  color: var(--req-accent-hover);
}

.req-file-upload-btn.req-file-upload-btn--added {
  border-style: solid;
  border-color: #16a34a;
  background: #f0fdf4;
  color: #166534;
}

.req-file-upload-btn[hidden],
.req-file-thumb[hidden] {
  display: none !important;
}

.req-file-thumb {
  width: 9.25rem;
  min-height: 6rem;
  height: 6rem;
  display: block;
  object-fit: cover;
  border: 2px solid #16a34a;
  border-radius: var(--req-radius-sm);
  background: #fff;
  cursor: pointer;
}

.req-file-choice-pop {
  position: fixed;
  z-index: 1300;
  width: min(14rem, calc(100vw - 1.2rem));
  padding: 0.55rem;
  border: 1px solid var(--req-border);
  border-radius: var(--req-radius-sm);
  background: #fff;
  box-shadow: 0 12px 30px -14px rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.req-file-choice-pop[hidden] {
  display: none !important;
}

.req-file-choice-btn {
  width: 100%;
  border: 1px solid var(--req-border);
  border-radius: var(--req-radius-xs);
  background: #f8fafc;
  color: var(--req-ink-soft);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: left;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
}

.req-file-choice-btn:hover {
  border-color: #cbd5e1;
  background: var(--req-accent-soft);
  color: var(--req-accent-hover);
}

.req-cam-preview {
  width: 100%;
  max-height: min(55vh, 420px);
  border-radius: var(--req-radius-sm);
  background: #0f172a;
  object-fit: cover;
}

.req-file-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--req-muted);
}

/* Lista dinâmica */
.repeatable-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.repeatable-container .req-input {
  margin: 0;
}

/* Botões formulário */
.req-actions {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--req-border);
}

.req-form--locked {
  pointer-events: none;
  opacity: 0.9;
}

.req-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: var(--req-radius-sm);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}

.req-btn:active {
  transform: scale(0.98);
}

a.req-btn {
  display: inline-flex;
  text-decoration: none;
}

.req-btn--primary {
  width: 100%;
  background: linear-gradient(180deg, var(--req-success) 0%, #047857 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35);
}

.req-btn--primary:hover {
  background: linear-gradient(180deg, var(--req-success-hover) 0%, #065f46 100%);
}

.req-btn--secondary {
  background: var(--req-surface);
  color: var(--req-ink-soft);
  border: 1px solid var(--req-border);
}

.req-btn--secondary:hover {
  background: var(--req-bg-accent);
  border-color: #cbd5e1;
}

.btn-add-repeatable {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: var(--req-radius-xs);
  cursor: pointer;
  background: var(--req-ink-soft);
  color: #fff;
  transition: background 0.15s, transform 0.1s;
}

.btn-add-repeatable:hover {
  background: var(--req-ink);
}

/* ——— Resultado (visualizar) ——— */
.req--result .req-page-title {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.req-dl-block {
  margin-bottom: 1.35rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--req-border);
}

.req-dl-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.req-dl-block h2 {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--req-muted);
}

.req-dl-block p {
  margin: 0.25rem 0;
  font-size: 1rem;
  color: var(--req-ink);
}

.req-dl-block p.req-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  background: var(--req-accent-soft);
  color: var(--req-accent-hover);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-right: 0.35rem;
  margin-top: 0.35rem;
}

.req-dl-block .req-empty {
  margin: 0;
  color: var(--req-muted);
  font-size: 0.9375rem;
}

.req-upload {
  margin: 0.5rem 0 0;
  padding: 0;
  border-radius: var(--req-radius-sm);
  overflow: hidden;
  border: 1px solid var(--req-border);
  max-width: 100%;
}

.req-upload img {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  vertical-align: middle;
}

.req-color-result {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.req-color-swatch {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border-radius: var(--req-radius-xs);
  border: 1px solid var(--req-border);
  vertical-align: middle;
  box-shadow: var(--req-shadow-sm);
}

.req-dl-block code {
  font-size: 0.9em;
  padding: 0.15rem 0.4rem;
  background: #f1f5f9;
  border-radius: 4px;
}

.req-toolbar {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ——— Painel ——— */
.req-topbar__inner--painel {
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.req-p-top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  margin-left: auto;
}

@media (max-width: 640px) {
  .req-topbar__inner--painel .req-brand {
    width: 100%;
  }

  .req-p-top-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
}

.req-btn--panel {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.45rem 0.95rem;
  border: none;
  border-radius: var(--req-radius-xs);
  cursor: pointer;
  background: var(--req-accent);
  color: #fff;
  transition: background 0.15s;
}

.req-btn--panel:hover {
  background: var(--req-accent-hover);
}

.req-btn--panel-secondary {
  background: var(--req-surface);
  color: var(--req-accent);
  border: 1px solid var(--req-border);
}

.req-btn--panel-secondary:hover {
  background: var(--req-accent-soft);
  border-color: #bfdbfe;
}

.req-p-page-title {
  margin-top: 1rem;
}

/* Balão de escolha do tipo (+ Nova pergunta) — largura fina, altura = conteúdo, sem rolagem */
.req-tipo-popover {
  position: fixed;
  z-index: 1200;
  width: min(9.75rem, calc(50vw - 1rem));
  padding: 0.55rem 0.6rem 0.65rem;
  background: var(--req-surface);
  border: 1px solid var(--req-border);
  border-radius: var(--req-radius);
  box-shadow: 0 14px 40px -10px rgba(15, 23, 42, 0.35);
  box-sizing: border-box;
  overflow: visible;
}

.req-tipo-popover__title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--req-muted);
}

.req-modal-type-grid--popover {
  margin-bottom: 0;
}

.req-modal__tipo-resumo {
  margin: 0.2rem 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--req-accent-hover);
}

/* Modais do painel (<dialog>) */
.req-modal {
  padding: 0;
  border: none;
  border-radius: var(--req-radius);
  width: min(100vw - 2rem, 28rem);
  max-width: 100%;
  max-height: min(90vh, 880px);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
}

.req-modal--wide {
  width: min(100vw - 1.5rem, 42rem);
}

.req-modal::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(3px);
}

.req-modal__inner {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 860px);
  background: var(--req-surface);
  border-radius: var(--req-radius);
  overflow: hidden;
}

.req-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--req-border);
  flex-shrink: 0;
}

.req-modal__head > div:first-child {
  flex: 1;
  min-width: 0;
}

.req-modal__head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.req-modal__sub {
  margin: 0.4rem 0 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--req-accent);
  line-height: 1.35;
}

.req-modal__sub--muted {
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--req-muted);
}

.req-modal-options__label {
  margin: 0 0 0.45rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--req-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.req-modal-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
  max-height: min(40vh, 14rem);
  overflow-y: auto;
  padding-right: 0.15rem;
}

.req-modal-option-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.req-modal-option-input {
  flex: 1;
  min-width: 0;
}

.req-modal-option-remove {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--req-border);
  border-radius: var(--req-radius-xs);
  background: #fff;
  color: var(--req-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.req-modal-option-remove:hover {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.req-modal-add-opt {
  width: 100%;
  justify-content: center;
}

.req-modal__close {
  border: none;
  background: transparent;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
  color: var(--req-muted);
  padding: 0.15rem 0.35rem;
  border-radius: var(--req-radius-xs);
  line-height: 0.85;
}

.req-modal__close:hover {
  background: var(--req-bg-accent);
  color: var(--req-ink);
}

.req-modal__form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.req-modal__body {
  padding: 1rem 1.15rem;
  flex: 1;
  min-height: 0;
}

.req-modal__compact-label {
  margin-bottom: 0.75rem;
}

.req-modal-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 1rem;
}

@media (min-width: 520px) {
  .req-modal-type-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.req-modal-type-grid.req-modal-type-grid--popover {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.req-modal-type-grid.req-modal-type-grid--popover .req-modal-type-btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  padding: 0.35rem 0.45rem;
  min-height: 0;
  font-size: 0.78rem;
  line-height: 1.25;
  hyphens: auto;
  overflow-wrap: break-word;
  word-break: break-word;
}

.req-modal-type-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 2.35rem;
  padding: 0.4rem 0.5rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--req-ink-soft);
  background: #f1f5f9;
  border: 1px solid var(--req-border);
  border-radius: var(--req-radius-xs);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.req-modal-type-btn:hover {
  background: #e2e8f0;
  color: var(--req-ink);
  border-color: #cbd5e1;
}

.req-modal-type-btn--active,
.req-modal-type-btn[aria-pressed="true"] {
  background: var(--req-accent-soft);
  border-color: var(--req-accent);
  color: var(--req-accent-hover);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.req-modal-type-btn:focus-visible {
  outline: 2px solid var(--req-accent);
  outline-offset: 2px;
}

#row-placeholder {
  margin-bottom: 0.65rem;
}

.req-modal__body--scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.req--form #reqModalIntro {
  min-height: 9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.req--form #reqModalIntro[hidden],
.req--form #reqModalCampos[hidden],
.req--form #reqModalRodape[hidden] {
  display: none !important;
}

.req--form #reqModalCampos label {
  display: block;
  margin: 0 0 0.7rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--req-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.req--form #reqModalCampos label:last-child {
  margin-bottom: 0;
}

.req--form #reqModalCampos label .req-input {
  margin-top: 0.35rem;
}

.req-modal__foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem;
  border-top: 1px solid var(--req-border);
  background: #f8fafc;
  flex-shrink: 0;
}

.req-modal__foot--camera {
  justify-content: center;
  gap: 0.8rem;
}

.req-cam-ico-btn {
  width: 2.55rem;
  height: 2.55rem;
  padding: 0;
  border: 1px solid var(--req-border);
  border-radius: 999px;
  background: #fff;
  color: var(--req-ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.req-cam-ico-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--req-ink);
}

.req-cam-ico-btn--capture {
  width: 3.15rem;
  height: 3.15rem;
  font-size: 1.45rem;
  border-color: var(--req-accent);
  color: #fff;
  background: var(--req-accent);
}

.req-cam-ico-btn--capture:hover {
  border-color: var(--req-accent-hover);
  background: var(--req-accent-hover);
  color: #fff;
}

.req-btn.req-btn--primary-solid {
  background: var(--req-accent);
  color: #fff;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: var(--req-radius-xs);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9375rem;
}

.req-btn.req-btn--primary-solid:hover {
  background: var(--req-accent-hover);
}

.req--painel .req-wrap {
  max-width: var(--req-max-wide);
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.req--painel .req-p-ok {
  margin: 1rem auto 0;
  max-width: var(--req-max-wide);
}

.req--painel h1 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.req--painel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.req-p-card {
  background: var(--req-surface);
  border-radius: var(--req-radius);
  border: 1px solid var(--req-border);
  box-shadow: var(--req-shadow);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.1rem;
}

.req-p-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.req-p-actions a {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--req-accent);
  text-decoration: none;
}

.req-p-actions a:hover {
  text-decoration: underline;
}

.req-p-ok {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  padding: 0.75rem 1rem;
  border-radius: var(--req-radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}

.req-p-err {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
  padding: 0.75rem 1rem;
  border-radius: var(--req-radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}

.req-p-sec-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--req-muted);
}

.req-p-sec-sub {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  color: var(--req-muted);
}

.req-p-badge-principal {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: #dbeafe;
  color: #1d4ed8;
  vertical-align: middle;
}

.req-p-badge-principal--inline {
  font-size: 0.68rem;
  padding: 0.12rem 0.35rem;
}

.req-p-field-row--principal {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.req-p-fix-msg {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--req-muted);
  flex-shrink: 0;
}

.req-p-type-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--req-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.req-p-code-name {
  font-size: 0.85rem;
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.req-p-field-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--req-muted);
}

.req-hint--tight {
  margin-top: -0.35rem;
  margin-bottom: 0.65rem;
}

.req-p-sec-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--req-border);
}

.req-p-sec-head h2 {
  margin: 0;
  font-size: 1.05rem;
  flex: 1;
  min-width: 10rem;
}

.req-p-sec-head__actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  min-width: 0;
}

.req-p-sec-head__actions .req-btn--insec,
.req-p-sec-head__actions .req-btn-danger,
.req-p-sec-head__actions .req-btn--panel-secondary {
  padding: 0.35rem 0.62rem;
  font-size: 0.76rem;
}

.req-btn--insec {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--req-radius-xs);
  cursor: pointer;
  background: var(--req-accent-soft);
  color: var(--req-accent);
  border: 1px solid #bfdbfe;
  transition: background 0.15s, border-color 0.15s;
}

.req-btn--insec:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.req-p-cond-toolbar {
  margin: 0.1rem 0 0.45rem;
}

.req-p-field-row {
  margin: 0.4rem 0;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--req-border);
  border-radius: var(--req-radius-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.req-p-field-row__title {
  flex: 1;
  min-width: 12rem;
}

.req-p-field-row__form {
  margin: 0;
  flex-shrink: 0;
}

.req-p-field-row__actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.req-p-depth-0 {
  margin-left: 0;
}

.req-p-depth-1 {
  margin-left: 0.65rem;
  padding-left: 0.65rem;
  border-left: 3px solid #cbd5e1;
}

.req-p-depth-2 {
  margin-left: 1.25rem;
  padding-left: 0.65rem;
  border-left: 3px solid #e2e8f0;
}

.req-p-depth-3 {
  margin-left: 1.85rem;
  padding-left: 0.65rem;
  border-left: 3px solid #f1f5f9;
}

.req-p-depth-4 {
  margin-left: 2.45rem;
  padding-left: 0.65rem;
  border-left: 3px solid #f1f5f9;
}

.req-p-field-row strong {
  font-size: 0.9rem;
  color: var(--req-ink-soft);
  font-weight: 600;
}

.req-btn-danger {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border: none;
  border-radius: var(--req-radius-xs);
  cursor: pointer;
  background: var(--req-danger);
  color: #fff;
  transition: background 0.15s;
}

.req-btn-danger:hover {
  background: var(--req-danger-hover);
}

.req--painel label {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--req-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.req--painel label:first-of-type {
  margin-top: 0;
}

.req--painel input[type="text"],
.req--painel input[type="password"],
.req--painel select,
.req--painel textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.9375rem;
  border: 1px solid var(--req-border);
  border-radius: var(--req-radius-xs);
  background: #fafbfc;
}

.req--painel input:focus,
.req--painel select:focus,
.req--painel textarea:focus {
  outline: none;
  border-color: var(--req-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.req--painel textarea {
  min-height: 5.5rem;
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
}

.req--painel button[type="submit"]:not(.req-btn-danger) {
  margin-top: 1rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 0.6rem 1.1rem;
  border: none;
  border-radius: var(--req-radius-xs);
  cursor: pointer;
  background: var(--req-accent);
  color: #fff;
  transition: background 0.15s;
}

.req--painel button[type="submit"]:not(.req-btn-danger):hover {
  background: var(--req-accent-hover);
}

.req--painel .req-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--req-muted);
}

.req--painel code {
  font-size: 0.85em;
  padding: 0.1rem 0.35rem;
  background: #f1f5f9;
  border-radius: 4px;
}

.req-p-inline {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--req-ink-soft);
}

.req-p-inline input[type="checkbox"] {
  margin-top: 0.2rem;
  accent-color: var(--req-accent);
  flex-shrink: 0;
}

.req-p-optional {
  font-weight: 400;
  color: var(--req-muted);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
}

.req-p-mini-btn {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--req-border);
  border-radius: var(--req-radius-xs);
  background: #fff;
  cursor: pointer;
  color: var(--req-accent);
}

.req-p-mini-btn:hover {
  background: var(--req-accent-soft);
  border-color: #bfdbfe;
}

/* Login card */
.req-login-card {
  max-width: 400px;
  margin: 3rem auto;
}

/* ——— Responsividade mobile ——— */
@media (max-width: 860px) {
  .req-main {
    padding: 1.1rem 0.7rem 2.25rem;
  }

  .req-card,
  .req-p-card {
    padding: 1rem 0.9rem 1.15rem;
  }

  .req-section-head-row {
    align-items: stretch;
    gap: 0.5rem;
  }

  .req-section-title--em-linha {
    max-width: 100%;
    flex-basis: 100%;
  }

  .req-section-head-row > .req-field--yesno--linha {
    width: 100%;
    margin-left: 0;
  }

  .req-yesno-gate-linha,
  .req-yesno-ctrl-com,
  .req-ctrl-com-linha {
    justify-content: flex-start;
    margin-left: 0;
    max-width: 100%;
    width: 100%;
  }

  .req-label__text--yesno-linha,
  .req-label__text--linha {
    max-width: 100%;
    flex-basis: 100%;
  }

  .req-yesno-pergunta-row,
  .req-pergunta-linha {
    grid-template-columns: 1fr;
  }

  .req-yesno-ctrl-com,
  .req-ctrl-com-linha,
  .req-comentar-row {
    grid-column: 1;
  }

  .req-color-row--linha {
    justify-content: flex-start;
  }

  .req-pergunta-linha__controls {
    flex-basis: 100%;
  }

  .req-comentar-row {
    justify-content: flex-end;
    margin-top: 0.1rem;
  }

  .req-field--linha > .req-comentario-wrap,
  .req-field--yesno-gate > .req-comentario-wrap {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .req-topbar__inner {
    padding: 0.65rem 0.8rem;
    gap: 0.45rem;
    flex-wrap: wrap;
  }

  .req-brand {
    font-size: 0.95rem;
  }

  .req-topbar__link {
    padding: 0.32rem 0.62rem;
    font-size: 0.84rem;
  }

  .req-hero {
    margin-bottom: 1.15rem;
    text-align: left;
    padding: 0;
  }

  .req-hero p {
    font-size: 0.9rem;
  }

  .req--form .req-fields-stack > .req-field,
  .req--form .req-fields-stack > .req-conditional {
    padding: 0.72rem 0.75rem;
  }

  .req-input,
  .req-select,
  .req-textarea {
    font-size: 0.95rem;
    padding: 0.6rem 0.72rem;
  }

  .req-btn {
    font-size: 0.95rem;
    padding: 0.8rem 1rem;
  }

  .req-section-title,
  .req-section-title--em-linha {
    font-size: 1rem;
  }

  .req-modal {
    width: calc(100vw - 1rem);
  }

  .req-modal__head,
  .req-modal__body,
  .req-modal__foot {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  .req-p-sec-head__actions {
    width: 100%;
  }

  .req-p-field-row {
    padding: 0.6rem 0.65rem;
  }

  .req-p-depth-1,
  .req-p-depth-2,
  .req-p-depth-3,
  .req-p-depth-4 {
    margin-left: 0.4rem;
    padding-left: 0.45rem;
  }
}

/* ——— Impressão ——— */
@media print {
  body.req {
    background: #fff;
    background-image: none;
  }

  .req-topbar,
  .req-toolbar,
  .req-p-actions,
  .req-btn,
  .btn-add-repeatable,
  .req-btn-danger,
  button {
    display: none !important;
  }

  .req-card,
  .req-p-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  .req-main {
    padding: 0;
  }
}

@media (min-width: 640px) {
  .req-main {
    padding: 2rem 1.5rem 3.5rem;
  }
}
