/* Wireframe: tons de cinza de propósito. Sem identidade visual. */
:root {
  --tinta: #1a1a1a;
  --suave: #5c5c5c;
  --linha: #c4c4c4;
  --fundo: #ffffff;
  --cinza: #f2f2f2;
  --cinza2: #e4e4e4;
  --col: 250px;
  --rot: 148px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--tinta);
  background: var(--fundo);
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--tinta); outline-offset: 2px; }

.aviso {
  background: var(--tinta);
  color: #fff;
  padding: 8px 16px;
  font-size: 14px;
  text-align: center;
}

/* Página inicial */
.texto { max-width: 680px; margin: 0 auto; padding: 40px 16px 72px; }
.sobre { color: var(--suave); font-size: 14px; margin: 0 0 8px; }
h1 { font-size: 40px; line-height: 1.1; margin: 0 0 16px; }
.lead { font-size: 21px; line-height: 1.35; margin: 0 0 24px; }
section { margin-top: 44px; }
h2 { font-size: 21px; margin: 0 0 10px; }
.texto li { margin-bottom: 8px; }
.texto ul { padding-left: 20px; }
.botao {
  display: inline-block;
  padding: 11px 18px;
  background: var(--tinta);
  color: #fff;
  border: 2px solid var(--tinta);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.botao.secundario { background: #fff; color: var(--tinta); }
.atalhos { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.atalhos h3 { font-size: 14px; color: var(--suave); margin: 0 0 6px; font-weight: 600; }
.atalhos a { display: block; padding: 7px 0; border-top: 1px solid var(--linha); }
.origens { display: grid; grid-template-columns: max-content 1fr; gap: 8px 12px; margin: 14px 0; align-items: baseline; }
.origens dt, .origens dd { margin: 0; }
.fontes { font-size: 14px; color: var(--suave); }

/* Selos de origem: diferenciados por traço, não só por tom */
.selo {
  display: inline-block;
  padding: 0 5px;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
  border: 1px solid var(--tinta);
}
.selo.fonte { background: var(--tinta); color: #fff; }
.selo.adaptada { background: #fff; color: var(--tinta); }
.selo.hipotese { background: #fff; color: var(--suave); border: 1px dashed var(--suave); }

/* Mapa */
.pagina-mapa { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.topo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 9px 16px;
  border-bottom: 2px solid var(--tinta);
  font-size: 14px;
}
.legenda { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.contagem { margin-left: auto; color: var(--suave); }
.sinal { display: inline-block; width: 1em; text-align: center; font-weight: 700; }
.quadro { flex: 1; overflow: auto; position: relative; }
table { border-collapse: separate; border-spacing: 0; table-layout: fixed; }
th, td {
  width: var(--col);
  min-width: var(--col);
  padding: 9px 10px;
  vertical-align: top;
  text-align: left;
  border-right: 1px solid var(--linha);
  border-bottom: 1px solid var(--linha);
  background: var(--fundo);
}
thead th { position: sticky; z-index: 2; }
thead tr:nth-child(1) th {
  top: 0;
  height: 36px;
  padding-top: 7px;
  padding-bottom: 7px;
  background: var(--tinta);
  color: #fff;
  font-size: 14px;
  border-right-color: #fff;
}
thead tr:nth-child(2) th {
  top: 36px;
  background: var(--cinza2);
  border-bottom: 2px solid var(--tinta);
}
thead tr:nth-child(2) small { display: block; color: var(--suave); font-weight: 400; }
.rotulo {
  position: sticky;
  left: 0;
  z-index: 1;
  width: var(--rot);
  min-width: var(--rot);
  background: var(--cinza);
  font-size: 14px;
  border-right: 2px solid var(--tinta);
}
thead th.rotulo { z-index: 3; }
tr.separador th {
  padding: 4px 10px;
  background: var(--cinza2);
  font-size: 13px;
  border-top: 2px dashed var(--tinta);
  border-bottom: 1px solid var(--linha);
  border-right: 0;
}
tr.separador .faixa { position: sticky; left: 0; display: inline-block; max-width: 92vw; }
tr.separador b { margin-right: 8px; }
tr.separador .nota { color: var(--suave); font-weight: 400; }
td.percurso { background: var(--cinza); font-size: 14px; font-style: italic; }
td.celula { padding: 0; }
td.celula button {
  display: block;
  width: 100%;
  min-height: 92px;
  height: 100%;
  padding: 9px 10px;
  background: none;
  border: 0;
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
td.celula button:hover { background: var(--cinza); }
td.celula button[aria-pressed="true"] { outline: 3px solid var(--tinta); outline-offset: -3px; }
td.vazia { color: var(--suave); font-size: 13px; background: repeating-linear-gradient(135deg, #fff, #fff 7px, #f6f6f6 7px, #f6f6f6 14px); }
tr.etapa-foco, th.foco, td.foco { background-color: var(--cinza); }
th.foco { background: var(--tinta) !important; color: #fff; }

.item { display: grid; grid-template-columns: 1em 1fr; gap: 0 5px; margin-bottom: 7px; }
.item:last-child { margin-bottom: 0; }
.item .selo { margin-top: 3px; justify-self: start; }
.item .corpo { grid-column: 2; }

/* Painel de detalhe */
.painel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  width: min(460px, 100%);
  padding: 20px 20px 32px;
  overflow: auto;
  background: var(--fundo);
  border-left: 2px solid var(--tinta);
  box-shadow: -8px 0 0 rgba(0, 0, 0, .06);
}
.painel[hidden] { display: none; }
.painel .contexto { color: var(--suave); font-size: 14px; margin: 0 40px 4px 0; }
.painel h2 { margin: 0 40px 18px 0; font-size: 24px; line-height: 1.2; }
.painel h3 { font-size: 15px; margin: 22px 0 10px; border-top: 2px solid var(--tinta); padding-top: 8px; }
.painel .item { font-size: 18px; line-height: 1.35; grid-template-columns: 1fr; margin-bottom: 15px; }
.painel .item .corpo { grid-column: 1; }
.painel .ref { display: block; font-size: 13px; color: var(--suave); margin-top: 4px; }
.fechar {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  background: #fff;
  border: 1px solid var(--tinta);
  font-size: 20px;
  cursor: pointer;
}
.acoes { margin-top: 24px; }
.acoes .botao { font-size: 14px; padding: 8px 12px; }
.navegar { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.navegar button { flex: 1; padding: 8px; background: #fff; border: 1px solid var(--tinta); font: inherit; font-size: 14px; cursor: pointer; }
.navegar button:disabled { opacity: .35; cursor: default; }

@media (max-width: 640px) {
  :root { --col: 220px; --rot: 96px; }
  h1 { font-size: 32px; }
  .rotulo { font-size: 13px; padding: 8px 6px; }
  .contagem { margin-left: 0; }
}
