:root {
  color-scheme: light;
  --bg: #f4f3f0;
  --surface: #fcfcfb;
  --surface-2: #f4f3f0;
  --border: #e2e1dc;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #77766f;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --ok: #138a5e;
  --err: #d23b3a;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #6250d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --surface-2: #232321; --border: #33322f;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #9a998f;
    --accent: #3987e5; --ok: #2fbf86; --err: #e66767;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #9085e9;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.topbar {
  position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.topbar .in { max-width: 860px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 15px; font-weight: 800; }
.brand small { font-weight: 500; color: var(--muted); }
.progress { width: 160px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; border: 1px solid var(--border); }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress-wrap { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

main { max-width: 860px; margin: 0 auto; padding: 32px 20px 80px; }
.kicker { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
h1 { font-size: clamp(28px, 4.5vw, 38px); line-height: 1.12; margin: 0 0 10px; letter-spacing: -.02em; }
.lead { color: var(--text-2); font-size: 17px; margin: 0 0 24px; max-width: 680px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
.card + .card { margin-top: 16px; }
.muted { color: var(--muted); font-size: 14px; }

/* Formulário */
.sec-title { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; margin: 0 0 18px; }
.sec-title .n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; display: grid; place-items: center; flex: none; }
.fgroup { margin-bottom: 22px; }
.fgroup:last-child { margin-bottom: 0; }
.fgroup > label, .fgroup > .q { display: block; font-weight: 600; margin-bottom: 8px; font-size: 15.5px; }
.req { color: var(--accent); }
.hint { color: var(--muted); font-size: 13.5px; margin: -4px 0 8px; }
.frow { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 22px; }
.frow .fgroup { margin-bottom: 0; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.rating, .choice { display: flex; gap: 6px; flex-wrap: wrap; }
.rating button, .choice button {
  font: inherit; font-size: 15px; font-weight: 600; min-width: 44px; min-height: 44px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; transition: border-color .1s, background .1s;
}
.rating button { padding: 0; }
.rating button:hover, .choice button:hover { border-color: var(--accent); }
.rating button.sel, .choice button.sel { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.rating button:focus-visible, .choice button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scale-ends { display: flex; justify-content: space-between; max-width: 490px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.fgroup.cond { margin-left: 4px; padding-left: 16px; border-left: 3px solid var(--accent); }
.critrate { display: grid; grid-template-columns: minmax(200px, 1fr); gap: 8px; padding: 14px 0; border-top: 1px solid var(--border); }
.critrate:first-child { border-top: none; padding-top: 4px; }
.critrate .lbl { font-size: 15px; font-weight: 500; }
.invalid .rating button, .invalid .choice button, .invalid input, .invalid select, .invalid textarea,
.critrate.invalid .rating button { border-color: var(--err); }
.err-text { color: var(--err); font-size: 13px; margin-top: 6px; display: none; }
.invalid > .err-text, .critrate.invalid > .err-text { display: block; }

.submitbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 24px; }
.btn {
  font: inherit; font-weight: 700; font-size: 16px; padding: 13px 26px; border-radius: 12px; border: none;
  background: var(--accent); color: #fff; cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); font-weight: 600; }
.btn.small { font-size: 14px; padding: 8px 14px; border-radius: 9px; }
.btn.danger { background: transparent; color: var(--err); border: 1px solid var(--border); }
.fmsg { font-size: 14.5px; font-weight: 600; }
.fmsg.err { color: var(--err); }

.success { text-align: center; padding: 48px 24px; }
.success .check { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 32px; display: grid; place-items: center; margin: 0 auto 16px; }
.success h2 { margin: 0 0 8px; }
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; }

/* Painel */
.login { max-width: 380px; margin: 10vh auto 0; }
.login form { display: grid; gap: 12px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar select { width: auto; padding: 8px 10px; font-size: 14px; }
.toolbar .sp { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; color: var(--text-2); }
.chip b { color: var(--text); font-variant-numeric: tabular-nums; }
.chip.alert b { color: var(--err); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 16px; }
.stat { padding: 16px 18px; }
.stats .card + .card { margin-top: 0; }
.stat h3 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; flex: none; }
.line { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--text-2); padding: 3px 0; }
.line b { color: var(--text); font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(150px, 1.4fr) 2fr 40px; gap: 12px; align-items: center; font-size: 14px; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.bar-fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.bar-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
h2.block { font-size: 17px; margin: 28px 0 12px; }
details.entry { border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; background: var(--surface); }
details.entry summary { cursor: pointer; font-weight: 600; font-size: 14.5px; }
details.entry summary .meta { color: var(--muted); font-weight: 500; }
details.entry dl { margin: 14px 0 6px; display: grid; grid-template-columns: minmax(170px, 260px) 1fr; gap: 6px 16px; font-size: 14px; }
details.entry dt { color: var(--muted); }
details.entry dd { margin: 0; white-space: pre-wrap; }
details.entry dt.sec { grid-column: 1 / -1; color: var(--accent); font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; margin-top: 10px; }
.entry-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
@media (max-width: 600px) {
  .card { padding: 18px; border-radius: 14px; }
  main { padding-top: 22px; }
  details.entry dl { grid-template-columns: 1fr; }
  details.entry dd { margin-bottom: 6px; }
  .bar-row { grid-template-columns: 1fr 40px; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .progress { width: 90px; }
}
