/* ==========================================================================
   Apoio ao Laudo Psicológico — interface clínica (vanilla CSS, sem libs).
   Tema claro, profissional, responsivo, PT-BR.
   Telas: Meus laudos -> Novo laudo -> Editor (Materiais / Comparar / Laudo /
   Conferência) · Testes aplicados · Ajuda.
   ========================================================================== */

:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --line: #e2e7ef;
  --line-2: #cbd3e0;
  --ink: #1d2530;
  --ink-2: #3a4655;
  --muted: #69748a;
  --muted-2: #9aa4b6;
  --accent: #2f6bf0;
  --accent-soft: #e8f0ff;
  --accent-ink: #1c4dbb;
  --ok: #1f9d57;
  --ok-soft: #e4f6ec;
  --warn: #c98a00;
  --warn-soft: #fdf3da;
  --err: #d83b46;
  --err-soft: #fdeaeb;
  --infer: #2f6bf0;
  --infer-soft: #e8f0ff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 6px 24px rgba(29, 37, 48, .08);
  --shadow-sm: 0 2px 8px rgba(29, 37, 48, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button { font: inherit; cursor: pointer; border: none; border-radius: var(--radius-sm); }
a { color: var(--accent); }
.hidden { display: none !important; }

/* -------- Topo / header ---------------------------------------------------- */
.app-header {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky; top: 0; z-index: 30;
  box-shadow: var(--shadow-sm);
}
.brand { display: flex; flex-direction: column; cursor: pointer; }
.brand h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.brand .tag { font-size: 11.5px; color: var(--muted); }
.app-header .spacer { flex: 1; }

/* abas */
.tabs { display: flex; gap: 4px; }
.tab {
  padding: 8px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  color: var(--muted); background: transparent; white-space: nowrap;
  border: 1px solid transparent; transition: .15s;
}
.tab:hover { color: var(--ink); background: var(--panel-2); }
.tab.active { color: var(--accent-ink); background: var(--accent-soft); border-color: rgba(47,107,240,.25); }

/* -------- Toggles ---------------------------------------------------------- */
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13.5px; color: var(--ink-2); }
.toggle input { display: none; }
.toggle .track { width: 40px; height: 22px; border-radius: 999px; background: #d7deea; position: relative; transition: .15s; flex: 0 0 auto; }
.toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: .15s; }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { left: 20px; }
.tech-toggle .track { background: #d7deea; }

/* -------- Layout ----------------------------------------------------------- */
main { max-width: 1180px; margin: 0 auto; padding: 26px 24px 40px; }
.screen { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-head { margin: 0 0 4px; font-size: 23px; font-weight: 700; letter-spacing: -.4px; }
.section-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; max-width: 760px; }
.sub-head { font-size: 16px; font-weight: 700; margin: 22px 0 12px; }

.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.mt { margin-top: 18px; }
.mb { margin-bottom: 14px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
}

/* -------- Botões ----------------------------------------------------------- */
.btn { background: var(--accent); color: #fff; padding: 11px 18px; font-weight: 600; font-size: 14px; border-radius: var(--radius-sm); transition: .12s; }
.btn:hover { filter: brightness(1.05); box-shadow: var(--shadow-sm); }
.btn.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line-2); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn.link { background: transparent; color: var(--accent); padding: 6px 0; font-weight: 600; }
.btn.link:hover { text-decoration: underline; box-shadow: none; }
.btn.back { margin-bottom: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; box-shadow: none; }

/* -------- "O que fazer aqui" (guia) --------------------------------------- */
.guide {
  background: var(--accent-soft); border: 1px solid rgba(47,107,240,.22);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px;
}
.guide-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--accent-ink); margin-bottom: 5px; }
.guide p { margin: 0; font-size: 14px; color: var(--ink-2); }

/* -------- Meus laudos (lista) --------------------------------------------- */
.report-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin-top: 8px; }
.report-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: .15s; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px;
}
.report-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.report-card .rc-title { font-weight: 700; font-size: 15.5px; }
.report-card .rc-tpl { font-size: 12.5px; color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; padding: 3px 10px; display: inline-block; width: fit-content; }
.report-card .rc-meta { font-size: 13px; color: var(--muted); }
.report-card .rc-foot { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.report-card .rc-del { background: transparent; color: var(--muted-2); font-size: 12px; align-self: flex-end; padding: 4px 6px; }
.report-card .rc-del:hover { color: var(--err); }
.empty {
  text-align: center; padding: 50px 24px; color: var(--muted);
  border: 1.5px dashed var(--line-2); border-radius: var(--radius); grid-column: 1 / -1;
  background: var(--panel);
}
.empty .big { font-size: 30px; margin-bottom: 8px; }

/* -------- Catálogo de modelos (Novo laudo) -------------------------------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.tpl-card {
  display: flex; flex-direction: column; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  transition: .15s; box-shadow: var(--shadow-sm);
}
.tpl-card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.tpl-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.tpl-card h3 { margin: 0 0 6px; font-size: 15.5px; }
.tpl-card .desc { color: var(--muted); font-size: 13px; flex: 1; margin: 0 0 14px; }
.tpl-card .block { margin-bottom: 12px; }
.tpl-card .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted-2); margin-bottom: 6px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.tag.sec { background: var(--accent-soft); color: var(--accent-ink); border-color: rgba(47,107,240,.22); }

/* -------- Form ------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); font: inherit; resize: vertical;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 130px; }
.form-narrow { max-width: 540px; }

/* -------- Editor do laudo: topo + stepper --------------------------------- */
.case-top { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.case-title { font-size: 18px; font-weight: 700; }
.case-title .sub { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 8px; }

.stepper { display: flex; gap: 6px; margin: 14px 0 16px; overflow-x: auto; padding-bottom: 4px; }
.step {
  display: flex; align-items: center; gap: 9px; padding: 9px 16px; border-radius: 999px;
  color: var(--muted); font-size: 13.5px; font-weight: 600; background: var(--panel);
  white-space: nowrap; border: 1px solid var(--line); transition: .15s;
}
.step .num {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 700; flex: 0 0 auto;
}
.step:hover { color: var(--ink); }
.step.active { color: var(--accent-ink); background: var(--accent-soft); border-color: rgba(47,107,240,.3); }
.step.active .num { background: var(--accent); color: #fff; }
.step.done .num { background: var(--ok-soft); color: var(--ok); }
.step.done .num::after { content: "✓"; }
.step.done .num span { display: none; }

/* -------- "O QUE FALTA" (checklist) --------------------------------------- */
.checklist { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.checklist .cl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.checklist .cl-title { font-weight: 700; font-size: 14px; }
.checklist .cl-progress { font-size: 12.5px; color: var(--muted); }
.checklist .cl-bar { height: 7px; background: var(--panel-2); border-radius: 999px; overflow: hidden; margin-bottom: 12px; }
.checklist .cl-bar > i { display: block; height: 100%; background: var(--ok); transition: width .3s; }
.checklist .cl-items { display: flex; flex-direction: column; gap: 8px; }
.cl-item { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.cl-item .ic { flex: 0 0 auto; font-size: 15px; line-height: 1.4; }
.cl-item .tx { color: var(--ink-2); }
.cl-item.done .tx { color: var(--muted); }
.cl-item.note { background: var(--warn-soft); border: 1px solid rgba(201,138,0,.25); border-radius: var(--radius-sm); padding: 8px 12px; }
.cl-item .tech { display: block; font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }

/* -------- Materiais -------------------------------------------------------- */
.materials-layout { display: grid; grid-template-columns: 1fr 380px; gap: 22px; align-items: start; }
.material-list { display: flex; flex-direction: column; gap: 12px; }
.material-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; transition: .15s; box-shadow: var(--shadow-sm);
}
.material-row.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.material-ref {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px;
  background: var(--accent-soft); font-weight: 800; font-size: 14px; color: var(--accent-ink); flex: 0 0 auto;
}
.material-meta .name { font-weight: 600; font-size: 14.5px; display: flex; gap: 7px; align-items: center; }
.material-meta .sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-top: 3px; flex-wrap: wrap; }
.material-icon { font-size: 17px; }
.rel-dots { display: inline-flex; gap: 2px; }
.rel-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); display: inline-block; }
.rel-dots i.on { background: var(--warn); }
.side-card { position: sticky; top: 88px; }

/* -------- Comparação (mapa) ----------------------------------------------- */
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; gap: 7px; align-items: center; }
.dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; border: 1px solid var(--line-2); }
.dot.conv { background: var(--ok-soft); border-color: var(--ok); }
.dot.div  { background: var(--err-soft); border-color: var(--err); }
.dot.val  { background: var(--warn-soft); border-color: var(--warn); }
.dot.none { background: var(--panel-2); }

.map-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-sm); }
table.cmap { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 13px; }
table.cmap th, table.cmap td { border: 1px solid var(--line); padding: 0; text-align: center; }
table.cmap thead th { background: var(--panel-2); padding: 11px 12px; font-weight: 700; color: var(--ink-2); }
table.cmap .domain-cell { text-align: left; padding: 11px 14px; background: var(--panel-2); font-weight: 600; white-space: nowrap; color: var(--ink-2); }
.cell-badge { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 46px; font-size: 16px; transition: .12s; }
.cell-badge.clickable { cursor: pointer; }
.cell-badge.clickable:hover { background: rgba(0,0,0,.03); }
.cell-badge.conv { background: var(--ok-soft); }
.cell-badge.div  { background: var(--err-soft); }
.cell-badge.val  { background: var(--warn-soft); }

/* -------- Canvas do laudo -------------------------------------------------- */
.report-layout { display: grid; grid-template-columns: 1fr 330px; gap: 22px; align-items: start; }
.report-doc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 34px; box-shadow: var(--shadow-sm); }
.report-sec { margin-bottom: 26px; }
.report-sec h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.report-sec .opt { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted-2); }
.report-sec p { margin: 0 0 10px; color: var(--ink-2); }
.sentence { border-radius: 4px; padding: 1px 3px; transition: background .12s; }
.anchor {
  display: inline-block; font-size: 11px; font-weight: 700; vertical-align: super;
  color: var(--accent-ink); background: var(--accent-soft); border: 1px solid rgba(47,107,240,.25);
  border-radius: 5px; padding: 0 5px; margin-left: 3px; cursor: pointer; user-select: none;
}
.anchor:hover { background: var(--accent); color: #fff; }

/* destaque de base (overlay) */
body.audit-on .sentence[data-status="anchored"] { background: var(--ok-soft); box-shadow: inset 3px 0 0 var(--ok); }
body.audit-on .sentence[data-status="inference"] { background: var(--infer-soft); box-shadow: inset 3px 0 0 var(--infer); }
body.audit-on .sentence[data-status="unsupported"] { background: var(--err-soft); box-shadow: inset 3px 0 0 var(--err); }

/* -------- Painel lateral (sugestões) -------------------------------------- */
.aside-card { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 16px; }
.aside-h { margin: 0 0 12px; font-size: 14.5px; }
.hint-item { border-left: 3px solid var(--line-2); background: var(--panel-2); border-radius: 7px; padding: 10px 12px; font-size: 13px; margin-bottom: 9px; }
.hint-item:last-child { margin-bottom: 0; }
.hint-item.gap { border-left-color: var(--warn); }
.hint-item.suggest { border-left-color: var(--accent); }
.hint-item.diverg { border-left-color: var(--err); }
.hint-item .h { font-weight: 700; margin-bottom: 2px; }
.hint-item .b { color: var(--muted); font-size: 12.5px; }

.statline { display: flex; gap: 16px; font-size: 13px; flex-wrap: wrap; }
.statline.legend-stack { flex-direction: column; gap: 7px; margin-top: 14px; }
.statline span { display: inline-flex; gap: 6px; align-items: center; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.swatch.ok { background: var(--ok); }
.swatch.infer { background: var(--infer); }
.swatch.err { background: var(--err); }

/* -------- Conferência (tela 4) -------------------------------------------- */
.audit-block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.audit-block h3 { margin: 0 0 12px; font-size: 16px; }
.audit-flag { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.audit-flag:last-child { border-bottom: none; }
.audit-flag .ic { font-size: 17px; flex: 0 0 auto; }
.audit-flag .tx b { display: block; }
.audit-flag .tx .q { color: var(--muted); font-size: 12.5px; }

/* -------- Testes aplicados ------------------------------------------------ */
.filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.field.inline { margin-bottom: 0; min-width: 150px; }
.field.inline.grow { flex: 1; min-width: 180px; }
.test-count { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.test-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: .15s; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 8px; }
.test-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.test-card .tc-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.test-card .tc-name { font-weight: 700; font-size: 14.5px; }
.test-card .tc-acr { font-size: 12px; color: var(--muted); }
.test-card .tc-measures { font-size: 13px; color: var(--muted); }
.test-card .tc-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge.sat-favoravel { background: var(--ok-soft); color: var(--ok); }
.badge.sat-desfavoravel { background: var(--err-soft); color: var(--err); }
.badge.sat-em_analise { background: var(--warn-soft); color: var(--warn); }
.badge.sat-nao_avaliado { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.badge.comp-complete { background: var(--ok-soft); color: var(--ok); }
.badge.comp-partial { background: var(--warn-soft); color: var(--warn); }
.badge.comp-stub { background: var(--err-soft); color: var(--err); }

.missing-note { font-size: 12.5px; color: var(--warn); background: var(--warn-soft); border: 1px solid rgba(201,138,0,.25); border-radius: 7px; padding: 7px 10px; }

/* detalhe do teste (no modal) */
.detail-sec { margin-bottom: 18px; }
.detail-sec h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
table.bands { width: 100%; border-collapse: collapse; font-size: 13px; }
table.bands th, table.bands td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
table.bands th { background: var(--panel-2); font-weight: 700; }
.rule { border-left: 3px solid var(--accent); background: var(--panel-2); border-radius: 7px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.rule .cond { font-weight: 700; }
.rule .mean { color: var(--ink-2); }
.rule .caut { color: var(--warn); font-size: 12.5px; margin-top: 4px; }
.kv { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.kv b { color: var(--muted); font-weight: 600; }

/* -------- Calculadora / interpretação de escore (no modal de teste) ------- */
.calc-box {
  background: var(--accent-soft); border: 1px solid rgba(47,107,240,.22);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 18px;
}
.calc-box.projective { background: var(--panel-2); border-color: var(--line); }
.calc-box h4 { color: var(--accent-ink); }
.calc-box.projective h4 { color: var(--ink-2); }
.calc-hint { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.calc-row { display: flex; gap: 10px; align-items: center; }
.calc-row input { flex: 1; max-width: 180px; }
.calc-row .btn { flex: 0 0 auto; }
.result-box:empty { display: none; }
.result-box { margin-top: 14px; }

.result-head { font-size: 14px; color: var(--ink); margin-bottom: 12px; }
.result-head .matched-bands { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.classif {
  display: inline-block; font-weight: 800; padding: 2px 12px; border-radius: 999px;
  font-size: 14px; letter-spacing: .2px;
}
.classif.in  { background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(31,157,87,.35); }
.classif.out { background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(201,138,0,.35); }

/* linha da tabela de faixas em que o escore caiu */
table.bands tbody tr.hit { background: var(--ok-soft); }
table.bands tbody tr.hit td { font-weight: 700; color: var(--ok); }

.rules-applied { margin-top: 4px; }
.rules-applied .ra-h { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; }
.rule .ru-mark { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.rule.match  { border-left-color: var(--ok); background: var(--ok-soft); }
.rule.match .ru-mark { color: var(--ok); }
.rule.other  { border-left-color: var(--line-2); opacity: .8; }
.rule.other .ru-mark { color: var(--muted); }
.rule.general .ru-mark { color: var(--accent-ink); }
.ru-unit { color: var(--muted); font-weight: 400; font-size: 12px; }

.axes-list { margin: 6px 0 0; padding-left: 22px; font-size: 13.5px; color: var(--ink-2); }
.axes-list li { margin-bottom: 5px; }
.result-head.projective { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }

/* -------- Apoio por seção + rascunho (etapa Laudo) ------------------------ */
.sec-suggest { margin-bottom: 10px; }
.sec-suggest-h { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted-2); margin-bottom: 4px; }

.sec-support {
  border: 1px solid rgba(47,107,240,.22); background: var(--accent-soft);
  border-radius: var(--radius-sm); padding: 0 14px; margin: 10px 0 12px;
}
.sec-support > summary {
  cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--accent-ink);
  padding: 10px 0; list-style: none; user-select: none;
}
.sec-support > summary::-webkit-details-marker { display: none; }
.sec-support > summary::before { content: "▸ "; }
.sec-support[open] > summary::before { content: "▾ "; }
.sec-support[open] { padding-bottom: 12px; }
.support-block { margin-bottom: 12px; }
.support-block:last-child { margin-bottom: 0; }
.support-block .sb-h { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.support-block .sb-sub { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.sb-checklist { margin: 0; padding-left: 20px; font-size: 12.5px; color: var(--ink-2); }
.sb-checklist li { margin-bottom: 4px; }
.sb-phrases { display: flex; flex-direction: column; gap: 6px; }
.phrase-chip {
  text-align: left; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12.5px; color: var(--ink-2);
  line-height: 1.45; transition: .12s;
}
.phrase-chip:hover { border-color: var(--accent); background: #fff; box-shadow: var(--shadow-sm); }
.phrase-chip::before { content: "＋ "; color: var(--accent); font-weight: 700; }
.support-block.cautions .sb-h { color: var(--warn); }
.sb-cautions { margin: 0; padding-left: 20px; font-size: 12.5px; color: #8a6400; }
.sb-cautions li { margin-bottom: 4px; }

.sec-draft { margin-top: 8px; }
.draft-h { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 5px; font-weight: 700; }
.draft-area { min-height: 96px; font-size: 13.5px; line-height: 1.6; }

/* -------- Ajuda ------------------------------------------------------------ */
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.help-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.help-card h3 { margin: 0 0 8px; font-size: 15.5px; display: flex; gap: 8px; align-items: center; }
.help-card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.help-card .tech-line { margin-top: 10px; font-size: 12.5px; color: var(--muted-2); border-top: 1px dashed var(--line-2); padding-top: 8px; }

/* -------- Modal ------------------------------------------------------------ */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 28, 40, .45); display: grid; place-items: center; z-index: 60; padding: 20px; animation: fade .15s ease; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 620px; box-shadow: var(--shadow); max-height: 88vh; overflow: auto; }
.modal h3 { margin: 0 0 4px; font-size: 18px; }
.modal .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.conflict { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; background: var(--panel-2); }
.conflict .top { display: flex; gap: 9px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.conflict .pol-pos { color: var(--ok); font-weight: 700; }
.conflict .pol-neg { color: var(--err); font-weight: 700; }
.conflict .txt { color: var(--muted); font-size: 13px; }
.modal pre { white-space: pre-wrap; font: inherit; color: var(--ink-2); margin: 0; }

/* -------- Pills / banners -------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.muted { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.banner { border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; margin: 14px 0; }
.banner.mock { background: var(--warn-soft); border: 1px solid rgba(201,138,0,.3); color: #8a6400; }
.banner.err { background: var(--err-soft); border: 1px solid rgba(216,59,70,.3); color: #a32a33; }

.foot { color: var(--muted-2); font-size: 12px; text-align: center; margin: 40px 0 8px; }

/* -------- ETAPA: TESTES / RESULTADOS -------------------------------------- */
.results-layout { display: grid; grid-template-columns: 1fr 420px; gap: 22px; align-items: start; }
.score-report-aside { position: sticky; top: 88px; }

/* lista de resultados registrados (coluna esquerda) */
.result-list { display: flex; flex-direction: column; gap: 10px; }
.result-row {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow-sm);
}
.result-main { min-width: 0; }
.result-name { font-weight: 700; font-size: 14px; }
.result-name .res-label { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.result-sub { font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.res-unit { color: var(--muted); font-size: 12px; }
.res-proj { color: var(--muted); font-style: italic; font-size: 12.5px; }
.res-warn { font-size: 11.5px; color: var(--warn); background: var(--warn-soft); border: 1px solid rgba(201,138,0,.25); border-radius: 999px; padding: 2px 8px; }

/* chip de classificação — tom só para destaque visual; texto vem do backend */
.classif-chip { display: inline-block; font-weight: 700; padding: 2px 10px; border-radius: 999px; font-size: 12px; border: 1px solid transparent; }
.classif-chip.low  { background: var(--ok-soft); color: var(--ok); border-color: rgba(31,157,87,.3); }
.classif-chip.mid  { background: var(--warn-soft); color: var(--warn); border-color: rgba(201,138,0,.3); }
.classif-chip.high { background: var(--err-soft); color: var(--err); border-color: rgba(216,59,70,.3); }
.classif-chip.warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(201,138,0,.3); }
.classif-chip.neutral { background: var(--panel-2); color: var(--muted); border-color: var(--line); }

/* card do Score Report (coluna direita) */
.score-report-card { max-height: calc(100vh - 110px); overflow: auto; }
.sr-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.sr-chip { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent-ink); border: 1px solid rgba(47,107,240,.22); }
.sr-chip.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(31,157,87,.3); }
.sr-chip.warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(201,138,0,.3); }
.sr-chip.muted { background: var(--panel-2); color: var(--muted); border-color: var(--line); }

/* tabela do consolidado */
.sr-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 18px; }
table.sr-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.sr-table th, table.sr-table td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
table.sr-table thead th { background: var(--panel-2); font-weight: 700; color: var(--ink-2); white-space: nowrap; }
table.sr-table tbody tr:last-child td { border-bottom: none; }
.sr-table .sr-inst { font-weight: 600; }
.sr-table .sr-inst .res-label { font-weight: 400; color: var(--muted); }
.sr-table .sr-score { font-weight: 700; white-space: nowrap; }
.sr-table .sr-band { color: var(--muted); }
.sr-table .sr-warn-cell { color: var(--warn); font-size: 11.5px; }

/* perfil gráfico (barras em CSS puro) */
.sr-profile { margin-bottom: 18px; }
.sr-profile-h { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 10px; font-weight: 700; }
.sr-prow { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; align-items: center; margin-bottom: 10px; }
.sr-prow-name { font-size: 12.5px; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-prow-bar { min-width: 0; }
.sr-bar-track { height: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.sr-bar-fill { display: block; height: 100%; border-radius: 999px; transition: width .3s; background: var(--accent); }
.sr-bar-fill.low  { background: var(--ok); }
.sr-bar-fill.mid  { background: var(--warn); }
.sr-bar-fill.high { background: var(--err); }
.sr-bar-fill.warn { background: var(--warn); }
.sr-bar-fill.neutral { background: var(--line-2); }
.sr-prow-val { grid-column: 2; font-size: 11.5px; color: var(--muted); margin-top: -4px; }
.sr-prow.projective { grid-template-columns: 110px 1fr; }
.sr-prow-qual { font-size: 12px; color: var(--muted); font-style: italic; }
.sr-profile-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.sr-profile-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sr-profile-legend .seg { width: 14px; height: 8px; border-radius: 3px; display: inline-block; }
.sr-profile-legend .seg.low { background: var(--ok); }
.sr-profile-legend .seg.mid { background: var(--warn); }
.sr-profile-legend .seg.high { background: var(--err); }

/* regras aplicáveis por teste (no consolidado) */
.sr-rules-h { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; font-weight: 700; }
.sr-rule-group { margin-bottom: 12px; }
.sr-rule-inst { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }

/* -------- Perfil multi-índice (registro por índice + consolidado) ---------- */
/* campos de entrada por índice na etapa de Resultados */
.profile-inputs-h { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; font-weight: 700; }
.profile-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pi-field { display: flex; flex-direction: column; gap: 4px; }
.pi-field label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.pi-field .pi-name { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.pi-field .pi-unit { font-weight: 400; color: var(--muted); font-size: 11px; }
.pi-field input { width: 100%; }

/* grupo de perfil de um teste no gráfico consolidado */
.sr-pgroup { margin-bottom: 16px; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; }
.sr-pgroup-h { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sr-pgroup-tag { font-size: 11px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); border: 1px solid rgba(47,107,240,.22); border-radius: 999px; padding: 1px 8px; }
.sr-prow.muted-row .sr-prow-name { color: var(--muted); }
.sr-prow.muted-row .sr-prow-val { font-style: italic; }

/* discrepâncias entre índices */
.sr-disc-sec { margin-bottom: 18px; }
.sr-disc-note { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.sr-disc-group { margin-bottom: 12px; }
.sr-disc-inst { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.sr-disc { border-left: 3px solid var(--warn); background: var(--warn-soft); border-radius: 7px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.sr-disc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.sr-disc-mark { font-weight: 700; color: var(--warn); font-size: 12px; }
.sr-disc-between { font-weight: 700; color: var(--ink-2); font-size: 12px; letter-spacing: .3px; }
.sr-disc .mean { color: var(--ink-2); }
.sr-disc .caut { color: var(--warn); font-size: 12.5px; margin-top: 4px; }

/* termos do modo técnico — escondidos por padrão, revelados quando ligado */
.tech-term { display: none; }
body.tech-on .tech-term { display: inline; }
body.tech-on .tech-block { display: block; }
.tech-block { display: none; }

/* -------- Toast ------------------------------------------------------------ */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 13.5px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s; z-index: 90;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--err); }

/* -------- Responsivo ------------------------------------------------------- */
@media (max-width: 940px) {
  .materials-layout, .report-layout, .results-layout { grid-template-columns: 1fr; }
  .side-card, .aside-card, .score-report-aside { position: static; }
  .score-report-card { max-height: none; }
  .tabs .tab { padding: 7px 11px; font-size: 12.5px; }
  .brand .tag { display: none; }
}
@media (max-width: 620px) {
  main { padding: 18px 14px 32px; }
  .app-header { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .app-header .spacer { display: none; }
}
