:root {
  --green: #06bc61;
  --green-dark: #048c49;
  --green-deep: #037a3f;
  --green-soft: #e7f8ef;
  --navy: #0a2342;
  --navy-light: #163761;
  --ink: #122033;
  --muted: #5c6b7a;
  --line: #e1ebe6;
  --bg: #eef3f0;
  --white: #ffffff;
  --bad: #e5484d;
  --bad-soft: #fdecec;
  --warn: #e8a317;
  --warn-soft: #fff6df;
  --orange: #ef7d32;
  --shadow: 0 18px 50px rgba(10, 35, 66, 0.08);
  --shadow-sm: 0 4px 14px rgba(10, 35, 66, 0.05);
  --display: "Outfit", "Segoe UI", sans-serif;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: #eef3f0;
  background-image:
    radial-gradient(900px 420px at 100% -10%, rgba(6, 188, 97, 0.16), transparent 55%),
    radial-gradient(700px 350px at 0% 100%, rgba(10, 35, 66, 0.08), transparent 50%),
    linear-gradient(180deg, #f7faf8 0%, #e7eee9 100%);
  display: flex;
  flex-direction: column;
}

button, input, textarea, select { font: inherit; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--display); color: var(--navy); letter-spacing: -0.02em; }
:focus-visible { outline: 3px solid rgba(6, 188, 97, 0.45); outline-offset: 2px; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-top: 4px solid var(--green);
  border-bottom: 1px solid rgba(10, 35, 66, 0.06);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  max-width: 900px;
  margin: 0 auto;
}

.brand { flex: none; display: flex; align-items: center; }
.brand img { height: 68px; width: auto; display: block; }

.brand-copy { text-align: right; min-width: 0; }
.brand-copy strong { display: block; color: var(--navy); font-size: 1.05rem; }
.brand-copy span { color: var(--muted); font-size: 0.85rem; font-weight: 600; }

.progress { height: 5px; background: #e3eee8; width: 100%; overflow: hidden; }
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green), var(--green-dark));
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.wrap {
  width: min(780px, calc(100% - 24px));
  margin: 24px auto 40px;
  flex: 1;
}

.panel {
  background: var(--white);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px 20px 22px;
  animation: rise 0.35s ease;
}

@media (min-width: 720px) {
  .panel { padding: 36px 36px 30px; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.kicker {
  margin: 0 0 8px;
  color: var(--green-deep);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lead { font-size: 1.1rem; color: var(--ink); margin: 0 0 12px; line-height: 1.45; }
.help { color: var(--muted); margin: 6px 0 0; font-size: 0.95rem; line-height: 1.4; }

.anon-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #eef8f3;
  border: 1.5px solid #c2e8d3;
  border-radius: 16px;
  padding: 14px 18px;
  margin: 16px 0;
  color: var(--green-deep);
}

.anon-banner svg {
  flex: none;
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.anon-banner strong {
  display: block;
  font-size: 0.98rem;
  margin-bottom: 2px;
}

.anon-banner span {
  font-size: 0.86rem;
  color: #245738;
}

.context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  background: var(--green-soft);
  color: var(--green-deep);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip.dark {
  background: #e7eef6;
  color: var(--navy);
}

.control {
  width: 100%;
  border: 1.5px solid #d5e0da;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fbfefc;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.control:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(6, 188, 97, 0.15);
  background: #ffffff;
}

textarea.control {
  min-height: 130px;
  resize: vertical;
  line-height: 1.45;
}

label {
  display: block;
  font-weight: 700;
  margin: 14px 0 6px;
  color: var(--navy);
}

.count {
  text-align: right;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 6px;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 13px 22px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  color: var(--navy);
  background: #e7eee9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn.primary {
  background: var(--green);
  color: white;
  box-shadow: 0 8px 20px rgba(6, 188, 97, 0.28);
}

.btn.primary:hover:not(:disabled) {
  background: var(--green-dark);
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

.btn.ghost:hover {
  background: #f1f4f2;
  color: var(--navy);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.actions .btn.primary { margin-left: auto; }

.error {
  background: var(--bad-soft);
  color: #9f1c1c;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 14px;
  font-weight: 600;
}

.callout {
  background: var(--warn-soft);
  color: #6d4b00;
  border-radius: 14px;
  padding: 12px 14px;
  margin: 14px 0;
  font-weight: 600;
}

/* Escala 1 a 5 */
.rates-container {
  margin: 20px 0 10px;
}

.rates-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.rates {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

@media (max-width: 500px) {
  .rates { gap: 6px; }
}

.rate {
  border: 2px solid var(--line);
  background: #ffffff;
  border-radius: 16px;
  padding: 14px 4px 12px;
  cursor: pointer;
  color: var(--navy);
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  user-select: none;
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.rate:hover {
  transform: translateY(-2px);
  border-color: #c0d3c8;
}

.rate .rate-num {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}

.rate .rate-emoji {
  font-size: 1.4rem;
  margin: 4px 0;
  display: block;
}

.rate .rate-text {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.15;
  margin-top: 2px;
  padding: 0 2px;
}

/* Active states for ratings */
.rate.on {
  color: white;
  border-color: transparent;
  transform: scale(1.02);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.rate.on .rate-text { color: rgba(255, 255, 255, 0.95); }

.rate.on.s1 { background: var(--bad); }
.rate.on.s2 { background: var(--orange); }
.rate.on.s3 { background: #d9930f; color: #ffffff; }
.rate.on.s4 { background: #2f9e44; }
.rate.on.s5 { background: var(--green); }

.comment-box {
  background: #f8faf8;
  border: 1px dashed #c8dbcf;
  border-radius: 16px;
  padding: 14px;
  margin-top: 14px;
}

.comment-box label {
  margin-top: 0;
  font-size: 0.92rem;
}

.linkish {
  background: none;
  border: 0;
  color: var(--green-deep);
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.linkish:hover { text-decoration: underline; }

/* Setores Cards */
.sectors-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 16px 0;
}

@media (min-width: 600px) {
  .sectors-grid { grid-template-columns: 1fr 1fr; }
  .sector-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

.sector-card {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 1.5px solid var(--line);
  background: white;
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  color: var(--navy);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.sector-card:hover {
  border-color: var(--green);
  background: #fbfefc;
}

.sector-card.selected {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 0 0 3px rgba(6, 188, 97, 0.18);
}

.sector-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #f0f4f2;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  flex: none;
}

.sector-card.selected .sector-icon {
  background: var(--green);
  color: white;
}

/* Revisão */
.rev-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0;
}

.rev-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: #fcfdfc;
  border-radius: 14px;
  padding: 12px 14px;
}

.rev-item-content { min-width: 0; }
.rev-item-content b { display: block; font-size: 0.95rem; color: var(--navy); }
.rev-item-content span.sub { font-size: 0.82rem; color: var(--muted); }
.rev-item-content span.obs { display: block; font-size: 0.85rem; color: #334e68; margin-top: 4px; font-style: italic; }

.rev-badge {
  font-weight: 800;
  font-size: 0.9rem;
  padding: 4px 10px;
  border-radius: 999px;
  color: white;
  white-space: nowrap;
}

.rev-badge.s1 { background: var(--bad); }
.rev-badge.s2 { background: var(--orange); }
.rev-badge.s3 { background: #d9930f; }
.rev-badge.s4 { background: #2f9e44; }
.rev-badge.s5 { background: var(--green); }

.rev-edit {
  background: transparent;
  border: 0;
  color: var(--green-deep);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 8px;
}

.rev-edit:hover { background: #eaf4ee; }

/* Agradecimento */
.thanks {
  text-align: center;
  position: relative;
  overflow: hidden;
  padding: 42px 24px !important;
}

.thanks-icon {
  width: 76px;
  height: 76px;
  background: var(--green-soft);
  color: var(--green);
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  font-size: 2.4rem;
}

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 20px auto;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--circle-color, #06bc61) calc(var(--circle-pct, 100) * 1%), #e6ede8 0);
  padding: 8px;
}

.score-circle-inner {
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-circle-inner strong {
  font-family: var(--display);
  font-size: 2rem;
  color: var(--navy);
  line-height: 1;
}

.score-circle-inner span {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}

.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.confetti i {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 2px;
  animation: fall 2.5s ease-out infinite;
}

.confetti i:nth-child(2) { left: 20%; background: var(--orange); animation-delay: 0.3s; }
.confetti i:nth-child(3) { left: 40%; background: var(--navy); animation-delay: 0.7s; }
.confetti i:nth-child(4) { left: 60%; background: var(--warn); animation-delay: 0.2s; }
.confetti i:nth-child(5) { left: 80%; background: #00b4d8; animation-delay: 0.5s; }
.confetti i:nth-child(6) { left: 90%; background: var(--green); animation-delay: 0.8s; }

@keyframes fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(350px) rotate(360deg); opacity: 0; }
}

/* Loading spin */
.loading {
  text-align: center;
  padding: 48px 20px;
}

.spin {
  width: 36px;
  height: 36px;
  border: 3px solid #e1eee8;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 16px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 16px 20px 24px;
}

.foot a {
  color: var(--green-deep);
  font-weight: 700;
  text-decoration: none;
}

.foot a:hover { text-decoration: underline; }

/* LGPD & ANPD Banner & Terms */
.lgpd-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #f0f7f4;
  border: 1.5px solid #bce4d0;
  border-radius: 16px;
  padding: 16px 18px;
  margin: 18px 0;
}

.lgpd-icon {
  font-size: 1.8rem;
  line-height: 1;
  flex: none;
}

.lgpd-content strong {
  display: block;
  font-size: 1rem;
  color: var(--navy);
  margin-bottom: 4px;
}

.lgpd-content p {
  margin: 0;
  font-size: 0.88rem;
  color: #1e4a32;
  line-height: 1.45;
}

.terms-agreement-box {
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  margin: 20px 0 12px;
  transition: all 0.25s ease;
}

.terms-agreement-box.highlight-error {
  border-color: var(--bad);
  background: var(--bad-soft);
  box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.2);
}

.terms-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
  user-select: none;
}

.terms-label input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
  cursor: pointer;
  margin-top: 2px;
  flex: none;
}

/* Dialog & Modal */
dialog {
  border: 0;
  border-radius: 20px;
  padding: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  max-width: min(650px, calc(100% - 32px));
  background: white;
}

dialog::backdrop {
  background: rgba(10, 35, 66, 0.6);
  backdrop-filter: blur(4px);
}

.modal-card {
  padding: 24px 28px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
  color: var(--navy);
  font-size: 1.25rem;
}

.lgpd-modal-body {
  max-height: 380px;
  overflow-y: auto;
  padding-right: 6px;
  font-size: 0.92rem;
  color: #243342;
  line-height: 1.5;
}

.lgpd-modal-body p {
  margin: 0 0 14px;
}
