:root {
  --primary: #14266b;
  --accent: #29a3dc;
  --ink: #1b2430;
  --muted: #6b7685;
  --line: #e7e9ef;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ok: #2e9e5b;
  --warn: #d99a1c;
  --bad: #d2434b;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(20, 38, 107, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }

/* ---------- Pesquisa ---------- */
.wrap { max-width: 680px; margin: 0 auto; padding: 24px 18px 64px; }
.topbar {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  background: #fff; color: var(--ink);
  padding: 28px 20px 20px; border-radius: var(--radius);
  border-top: 6px solid var(--primary);
  box-shadow: var(--shadow);
}
.topbar img { height: 92px; width: auto; max-width: 78%; object-fit: contain; margin-bottom: 4px; }
.topbar .titulo { font-size: 1.05rem; font-weight: 700; color: var(--primary); }
.topbar .sub { font-size: .85rem; color: var(--muted); }

.intro {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-top: 16px;
}
.intro h1 { font-size: 1.25rem; margin: 0 0 6px; }
.intro p { color: var(--muted); margin: 6px 0; font-size: .95rem; }

.aviso {
  display: flex; gap: 10px; align-items: flex-start;
  background: #eef6fb; border: 1px solid #d4e9f5; color: #16557a;
  border-radius: 12px; padding: 12px 14px; margin-top: 14px; font-size: .88rem;
}
.aviso svg { flex: none; margin-top: 1px; }

.campo { margin-top: 18px; }
.campo label { display: block; font-weight: 600; margin-bottom: 8px; font-size: .98rem; }
.campo input[type="text"], .campo textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; font-size: 1rem; font-family: inherit; background: #fff;
}
.campo input:focus, .campo textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.campo textarea { min-height: 96px; resize: vertical; }

.pergunta {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-top: 14px;
}
.pergunta .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: .8rem; font-weight: 700; margin-right: 8px;
}
.pergunta .txt { font-weight: 600; font-size: 1rem; }
.escala { display: grid; grid-template-columns: repeat(11, 1fr); gap: 6px; margin-top: 14px; }
.nota {
  width: 100%; height: 46px; padding: 0; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; font-size: 1rem; font-weight: 600; color: var(--ink);
  cursor: pointer; transition: all .12s; -webkit-tap-highlight-color: transparent;
}
.nota:hover { border-color: var(--accent); }
.nota.sel { background: var(--primary); color: #fff; border-color: var(--primary); }
.legenda { display: flex; justify-content: space-between; color: var(--muted); font-size: .76rem; margin-top: 7px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: 15px 22px; border-radius: 12px; font-size: 1.05rem; font-weight: 700;
  width: 100%; margin-top: 22px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secundario { background: var(--primary); }

.rodape-logan {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 26px; color: var(--muted); font-size: .82rem;
}
.rodape-logan img { height: 28px; }

.tela-fim, .tela-bloqueio {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 40px 24px; margin-top: 16px; text-align: center;
}
.tela-fim svg, .tela-bloqueio svg { margin-bottom: 12px; }
.tela-fim h2, .tela-bloqueio h2 { margin: 0 0 6px; }
.tela-fim p, .tela-bloqueio p { color: var(--muted); margin: 0; }
.erro-inline { color: var(--bad); font-size: .88rem; margin-top: 10px; min-height: 18px; }
.hidden { display: none; }

/* ---------- Painel admin ---------- */
.admin-bg { background: var(--bg); min-height: 100vh; }
.admin-head {
  background: var(--primary); color: #fff; padding: 16px 22px;
  display: flex; align-items: center; gap: 14px;
}
.admin-head img { height: 38px; background:#fff; border-radius:8px; padding:4px; }
.admin-head h1 { font-size: 1.1rem; margin: 0; font-weight: 700; }
.admin-main { max-width: 1080px; margin: 0 auto; padding: 22px 18px 60px; }

.login-box {
  max-width: 380px; margin: 80px auto; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px;
}
.login-box h2 { margin: 0 0 16px; }

.filtros { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; align-items: center; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 16px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted);
}
.chip.sel { background: var(--primary); color: #fff; border-color: var(--primary); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.kpi {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px;
}
.kpi .rotulo { color: var(--muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.kpi .valor { font-size: 2.1rem; font-weight: 800; margin-top: 4px; }
.kpi .pe { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.zona { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; margin-top: 6px; }
.zona.critica { background: #fae3e4; color: var(--bad); }
.zona.aperf { background: #fcefd6; color: var(--warn); }
.zona.qual { background: #e3f1ea; color: var(--ok); }
.zona.exc { background: #d8eede; color: #1c7a43; }

.painel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
@media (max-width: 820px){ .painel-grid { grid-template-columns: 1fr; } }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.card h3 { margin: 0 0 14px; font-size: 1.02rem; }

.barra-tema { margin-bottom: 12px; }
.barra-tema .lbl { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: 5px; }
.barra-tema .lbl b { font-variant-numeric: tabular-nums; }
.trilho { background: #eef0f6; border-radius: 999px; height: 10px; overflow: hidden; }
.preenche { height: 100%; border-radius: 999px; background: var(--accent); }

.dist { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; }
.dist .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.dist .col .b { width: 100%; border-radius: 5px 5px 0 0; min-height: 2px; }
.dist .col .b.det { background: #e89aa0; }
.dist .col .b.neu { background: #f0cd84; }
.dist .col .b.pro { background: #8fd0a8; }
.dist .col .n { font-size: .72rem; color: var(--muted); }
.dist .col .q { font-size: .72rem; color: var(--muted); }

.coment { border-top: 1px solid var(--line); padding: 12px 0; font-size: .92rem; }
.coment:first-child { border-top: none; }
.coment .data { color: var(--muted); font-size: .76rem; margin-top: 4px; }
.vazio { color: var(--muted); font-style: italic; }

/* ---------- Relatorio (A4) ---------- */
.rel-toolbar {
  position: sticky; top: 0; background: var(--primary); color: #fff;
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 20px;
}
.rel-toolbar .btn { width: auto; margin: 0; padding: 10px 18px; font-size: .95rem; }
.folha {
  background: #fff; max-width: 820px; margin: 22px auto; padding: 40px 46px;
  box-shadow: var(--shadow);
}
.rel-cab { display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid var(--primary); padding-bottom: 16px; }
.rel-cab img { height: 52px; }
.rel-cab .meta { text-align: right; color: var(--muted); font-size: .85rem; }
.rel-cab h1 { margin: 0; font-size: 1.4rem; }
.rel-sec { margin-top: 28px; page-break-inside: avoid; }
.rel-sec h2 { font-size: 1.1rem; border-left: 4px solid var(--accent); padding-left: 10px; }
.rel-resumo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.rel-resumo .b { border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.rel-resumo .b .nome { font-weight: 700; font-size: .9rem; }
.rel-resumo .b .nps { font-size: 1.8rem; font-weight: 800; margin: 4px 0; }
.tab { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .9rem; }
.tab th, .tab td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.tab th { color: var(--muted); font-size: .8rem; text-transform: uppercase; }

/* ---------- Ajustes para celular ---------- */
@media (max-width: 480px) {
  .wrap { padding: 14px 12px 56px; }
  .topbar { padding: 22px 16px 16px; }
  .topbar img { height: 74px; max-width: 86%; }
  .intro { padding: 18px 16px; }
  .intro h1 { font-size: 1.15rem; }
  .pergunta { padding: 16px 14px; }
  .pergunta .txt { font-size: .96rem; }
  .escala { grid-template-columns: repeat(6, 1fr); gap: 8px; }
  .nota { height: 48px; font-size: 1.05rem; }
  .legenda { font-size: .72rem; }
  .btn { font-size: 1.05rem; padding: 15px 18px; }
}

@media print {
  .rel-toolbar { display: none; }
  body { background: #fff; }
  .folha { box-shadow: none; margin: 0; max-width: none; padding: 0 12px; }
  .rel-sec { page-break-inside: avoid; }
}
