/* Identidade: aquarela dos rins (azul-petróleo, verde-água, dourado).
   Afya Guanambi e SMS aparecem apenas como apoiadoras, no rodapé. */
@font-face { font-family: "Atkinson"; src: url("/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("/fonts/fraunces-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --navy: #1e3a52; --deep: #0f2236; --teal: #3f6f77; --teal-2: #6f9e98; --sage: #d5e5e0; --mist: #eef4f1;
  --gold: #b8893a; --gold-soft: #f3e6c8; --paper: #fbfaf5; --ink: #1b2733; --muted: #52606d; --line: #d9e1dd;
  --ok: #2e6b4a; --warn: #8a5a00; --bad: #9b2c2c;
  --radius: 18px; --shadow: 0 1px 2px rgba(15,34,54,.06), 0 8px 24px rgba(15,34,54,.06);
  --fs: 1.25rem; /* tamanho base ajustável (A−/A+) */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Atkinson", system-ui, sans-serif; color: var(--ink); background: var(--paper); line-height: 1.5; font-size: 17px; }
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; font-weight: 600; color: var(--deep); line-height: 1.2; margin: 0 0 .5em; }
a { color: var(--teal); }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden { display: none !important; }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 56px; padding: .7em 1.4em; border-radius: 14px; border: 2px solid transparent; font-weight: 700; font-size: 1.05rem; text-decoration: none; transition: background .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--deep); }
.btn-primary:disabled { background: #6f7f8c; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: var(--mist); }
.btn-soft { background: var(--mist); color: var(--navy); }
.btn-danger { background: #fff; color: var(--bad); border-color: #e6c3c3; }
.btn-sm { min-height: 40px; padding: .4em .9em; font-size: .95rem; border-radius: 10px; }

/* ================= ÁREA DO PARTICIPANTE ================= */
.p-shell { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; font-size: var(--fs); }
.p-top { position: sticky; top: 0; z-index: 5; background: rgba(251,250,245,.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); padding: .6rem 1rem; }
.p-top-row { display: flex; align-items: center; gap: .75rem; max-width: 760px; margin: 0 auto; }
.p-brand { display: flex; align-items: center; gap: .6rem; font-size: .9rem; color: var(--muted); flex: 1; min-width: 0; }
.p-brand img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.font-ctrl { display: flex; gap: .35rem; }
.font-ctrl button { min-width: 52px; min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--navy); font-weight: 700; }
.progress { max-width: 760px; margin: .55rem auto 0; }
.progress-bar { height: 12px; background: var(--sage); border-radius: 99px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--navy)); border-radius: 99px; transition: width .3s; }
.progress-meta { display: flex; justify-content: space-between; font-size: .85em; color: var(--muted); margin-top: .3rem; font-size: 15px; }

.p-main { width: 100%; max-width: 760px; margin: 0 auto; padding: 1.25rem 1rem 1rem; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; }
.welcome { text-align: center; }
.welcome .hero { width: min(340px, 80%); aspect-ratio: 385/310; object-fit: cover; margin: 0 auto 1rem; display: block; border-radius: 12px; }
.welcome .leaf { width: 72px; height: 72px; margin: .5rem auto 1rem; display: block; }
.welcome h1 { font-size: 1.9em; }
.welcome p { font-size: 1em; text-align: left; margin: .9em 0; }
.welcome .btn { width: 100%; min-height: 72px; font-size: 1.15em; margin-top: .8rem; }

.q-section { display: inline-block; font-size: .8em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--teal); background: var(--mist); padding: .3em .8em; border-radius: 99px; margin-bottom: .8rem; }
.q-stem { font-size: .88em; color: var(--muted); background: var(--mist); border-left: 4px solid var(--teal-2); padding: .7em .9em; border-radius: 0 10px 10px 0; margin: 0 0 1rem; white-space: pre-line; }
.q-text { font-size: 1.3em; font-weight: 700; color: var(--deep); margin: 0 0 1.1rem; }
.q-num { color: var(--teal); margin-right: .25em; }
.q-legend { font-size: .85em; color: var(--muted); margin: -.4rem 0 1rem; }
.options { display: grid; gap: .7rem; }
.options.scale { grid-template-columns: repeat(5, 1fr); }
.opt { width: 100%; min-height: 68px; display: flex; align-items: center; gap: .8rem; text-align: left; padding: .8em 1em; background: #fff; border: 2.5px solid var(--line); border-radius: 16px; font-size: 1em; color: var(--ink); }
.opt:hover { border-color: var(--teal-2); }
.opt .mark { flex: 0 0 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--teal-2); display: grid; place-items: center; color: transparent; font-weight: 700; }
.opt.multi .mark { border-radius: 8px; }
.opt[aria-pressed="true"], .opt[aria-checked="true"] { background: #e7f1ee; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30,58,82,.12) inset; }
.opt[aria-pressed="true"] .mark, .opt[aria-checked="true"] .mark { background: var(--navy); border-color: var(--navy); color: #fff; }
.options.scale .opt { flex-direction: column; justify-content: center; text-align: center; min-height: 96px; padding: .5em; gap: .3rem; }
.options.scale .opt .big { font-size: 1.5em; font-weight: 700; }
.options.scale .opt small { font-size: .7em; color: var(--muted); line-height: 1.2; }
.skip { margin-top: 1rem; display: flex; justify-content: center; }
.skip button { background: none; border: none; color: var(--muted); text-decoration: underline; min-height: 48px; font-size: .9em; }
.skip button[aria-pressed="true"] { color: var(--warn); font-weight: 700; text-decoration: none; }
.chosen { margin-top: .9rem; padding: .6em .9em; border-radius: 12px; background: var(--gold-soft); color: #5b4313; font-size: .9em; }
.other-input, .text-input, textarea.text-input { width: 100%; font: inherit; font-size: 1.05em; padding: .8em 1em; border: 2.5px solid var(--line); border-radius: 14px; background: #fff; margin-top: .8rem; }
textarea.text-input { min-height: 180px; resize: vertical; }
.numpad-display { font-size: 2em; font-weight: 700; text-align: center; padding: .4em; border: 2.5px solid var(--line); border-radius: 14px; background: #fff; min-height: 2.2em; }
.numpad-display .unit { font-size: .5em; color: var(--muted); font-weight: 400; margin-left: .3em; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; margin-top: .8rem; }
.numpad button { min-height: 66px; font-size: 1.4em; font-weight: 700; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--navy); }
.copyright { font-size: 12px; color: var(--muted); margin-top: 1rem; text-align: center; }

.p-nav { position: sticky; bottom: 0; background: rgba(251,250,245,.97); border-top: 1px solid var(--line); padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom)); }
.p-nav-row { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1.6fr; gap: .7rem; }
.p-nav .btn { min-height: 64px; font-size: 1.1rem; }
.save-state { max-width: 760px; margin: 0 auto .4rem; font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; gap: .5rem; }
.save-state .ok { color: var(--ok); } .save-state .warn { color: var(--warn); }
.p-foot { text-align: center; font-size: 13px; color: var(--muted); padding: .8rem 1rem 1.2rem; }
.end-screen { text-align: center; padding-top: 2rem; }
.end-screen h1 { font-size: 2em; }

.modal { position: fixed; inset: 0; background: rgba(15,34,54,.45); display: grid; place-items: center; padding: 1rem; z-index: 20; }
.modal .card { max-width: 480px; width: 100%; }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: 1rem; }

/* ================= ÁREA DOS PESQUISADORES ================= */
.r-shell { min-height: 100vh; background: linear-gradient(to right, var(--deep) 240px, var(--paper) 240px); display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.r-side { background: var(--deep); color: #d9e4ea; padding: 1.2rem 1rem; position: sticky; top: 0; height: 100vh; overflow: auto; }
.r-side .logo { display: flex; gap: .7rem; align-items: center; margin-bottom: 1.4rem; }
.r-side .logo img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: #fff; }
.r-side .logo b { font-family: "Fraunces", serif; color: #fff; font-size: 1.02rem; line-height: 1.2; }
.r-side nav a { display: block; color: #d9e4ea; text-decoration: none; padding: .6rem .8rem; border-radius: 10px; margin-bottom: .2rem; font-weight: 700; }
.r-side nav a.active, .r-side nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.r-side .who { font-size: 12px; margin-top: 1.5rem; color: #9fb3c1; word-break: break-all; }
.r-side .env { display: inline-block; margin-top: .4rem; padding: .15em .6em; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--gold); color: #fff; }
.r-main { padding: 1.6rem 2rem 3rem; max-width: 1200px; }
.r-main h1 { font-size: 1.7rem; }
.banner { padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1rem; font-size: .95rem; }
.banner.warn { background: #fff5e0; border: 1px solid #f0d49b; color: #6b4a00; }
.banner.info { background: var(--mist); border: 1px solid var(--line); color: var(--navy); }
.banner.bad { background: #fdecec; border: 1px solid #efc2c2; color: var(--bad); }
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; margin: 1rem 0 1.5rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; }
.kpi .v { font-size: 1.8rem; font-weight: 700; color: var(--deep); font-family: "Fraunces", serif; }
.kpi .l { font-size: .82rem; color: var(--muted); }
.kpi.hl { background: var(--deep); border-color: var(--deep); }
.kpi.hl .v, .kpi.hl .l { color: #fff; }
.meter { height: 14px; border-radius: 99px; background: var(--sage); overflow: hidden; margin: .4rem 0 .2rem; }
.meter > span { display: block; height: 100%; background: var(--teal); }
.panel { overflow-x: auto; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.panel h2 { font-size: 1.15rem; }
table.t { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.t th, table.t td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
table.t tr:hover td { background: #fafcfb; }
.pill { display: inline-block; padding: .15em .65em; border-radius: 99px; font-size: .8rem; font-weight: 700; background: var(--mist); color: var(--navy); white-space: nowrap; }
.pill.ok { background: #e3f1e8; color: var(--ok); } .pill.warn { background: #fff1d6; color: var(--warn); } .pill.bad { background: #fbe4e4; color: var(--bad); }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin-bottom: 1rem; }
.toolbar label, .form label { display: grid; gap: .25rem; font-size: .85rem; color: var(--muted); }
input.f, select.f, textarea.f { font: inherit; font-size: .95rem; padding: .55rem .7rem; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; min-height: 42px; }
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; border-bottom: 2px solid var(--line); margin: 1rem 0; }
.tabs button { background: none; border: none; padding: .6rem .9rem; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button.active { color: var(--navy); border-color: var(--navy); }
.check { display: flex !important; grid-template-columns: none !important; align-items: center; gap: .6rem; font-size: .95rem !important; color: var(--ink) !important; padding: .35rem 0; }
.check input { width: 22px; height: 22px; }
.bars { display: grid; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: 200px 1fr 70px; gap: .6rem; align-items: center; font-size: .9rem; }
.bar-row .track { height: 18px; background: var(--mist); border-radius: 6px; overflow: hidden; position: relative; }
.bar-row .track > span { display: block; height: 100%; background: var(--teal); }
.bar-row .track > span.pend { background: repeating-linear-gradient(45deg, #c9b37e, #c9b37e 6px, #e5d6ae 6px, #e5d6ae 12px); }
.chart-cols { display: flex; align-items: end; gap: 4px; height: 160px; padding-top: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.chart-cols div { flex: 1 0 18px; background: var(--teal-2); border-radius: 4px 4px 0 0; position: relative; min-width: 18px; }
.chart-cols div span { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); }
.small { font-size: .85rem; color: var(--muted); }
.two { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 1rem; }
.r-main { min-width: 0; overflow-wrap: break-word; }
.r-side .who { overflow-wrap: anywhere; }
table.t td:first-child, table.t td:last-child { white-space: nowrap; }
.mono { font-family: ui-monospace, monospace; font-size: .85rem; }

@media (max-width: 860px) {
  .r-shell { grid-template-columns: minmax(0, 1fr); }
  .r-side { position: static; height: auto; }
  .r-shell { background: var(--paper); }
  .r-side nav { display: flex; flex-wrap: wrap; gap: .2rem; }
  .r-main { padding: 1rem; }
  .two { grid-template-columns: minmax(0, 1fr); }
  .bar-row { grid-template-columns: 120px 1fr 54px; }
}
@media (max-width: 520px) {
  .options.scale { grid-template-columns: 1fr; }
  .options.scale .opt { flex-direction: row; min-height: 64px; justify-content: flex-start; text-align: left; }
  .p-brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
