/* ============================================================
   MUDA — Seletor de periódicos (seletor.html)
   Carregado só nesta página, depois do styles.css. Usa as cores,
   fontes e cantos do design system do site; tudo fica dentro de
   .seletor para não interferir nas outras páginas.

   Os oito estratos formam uma rampa do verde mais profundo (A1)
   ao verde quase papel (A8). Texto branco em A1–A3 e tinta em
   A4–A8, ambos com contraste acima de 4,5:1.
   ============================================================ */

.seletor {
  --e1: #0A4526;
  --e2: #0F6B39;
  --e3: #2C7D3B;
  --e4: #5C9A3F;
  --e5: #8DB944;
  --e6: #B4D17F;
  --e7: #D2E3B0;
  --e8: #E7EDD2;
  --none: #D8CFB8;

  --linha: rgba(21, 10, 9, .12);
  --linha-suave: rgba(21, 10, 9, .07);
  --realce: color-mix(in srgb, var(--acento-suave) 24%, var(--papel-3));

  padding: 0 0 64px;
}

/* A tabela precisa de mais largura que o restante do site */
.container-largo {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 22px;
}

.seletor [hidden] { display: none !important; }

/* -------- neutraliza os estilos globais de formulário do site --------
   (o styles.css deixa todo input com 100% de largura e todo label em
   negrito, o que é certo para o formulário de contato, não aqui) */
.seletor label {
  display: inline;
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: inherit;
}
.seletor input[type="checkbox"] {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  accent-color: var(--acento);
}
.seletor input[type="range"] {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  accent-color: var(--acento);
}
.seletor input[type="search"] {
  padding: .6rem .9rem;
  font-size: .95rem;
}
.seletor select {
  width: auto;
  padding: .45rem .7rem;
  border-radius: 10px;
  font-size: .92rem;
}

/* -------- layout: filtros à esquerda, resultados à direita -------- */
.seletor-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 1.6rem;
  align-items: start;
}
.seletor .filtros {
  position: sticky;
  top: calc(72px + 1rem);               /* abaixo do cabeçalho fixo */
  max-height: calc(100vh - 72px - 2rem);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--papel-3);
  border: 1px solid rgba(21, 10, 9, .10);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .3rem 1.4rem 1rem;
}
.seletor .resultados { min-width: 0; }

/* -------- passos de filtro -------- */
.seletor .passo {
  padding: 1.25rem 0 1.35rem;
  border-bottom: 1px solid var(--linha);
}
.seletor .passo:last-child { border-bottom: 0; }
.seletor .passo h2 {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0;
}
.seletor .passo h2 .n {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--acento);
  color: #FFFFFF;
  font-size: .8rem;
  font-weight: 800;
}
.seletor .ajuda {
  margin: .45rem 0 .9rem;
  font-size: .9rem;
  line-height: 1.5;
  color: var(--tinta-suave);
}
.seletor .linha {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.seletor .linha label { flex: 1 1 auto; min-width: 0; font-size: .92rem; line-height: 1.35; }
.seletor .linha .valor { flex: 0 0 auto; }
.seletor .valor {
  min-width: 3ch;
  text-align: right;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  color: var(--acento);
}
.seletor .acoes-mini {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1rem;
  margin-top: .65rem;
  font-size: .88rem;
}
.seletor .acoes-mini button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--acento);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.seletor .acoes-mini span { color: var(--tinta-suave); }
.seletor label.check {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  margin-top: .85rem;
  font-size: .88rem;
  line-height: 1.45;
  color: var(--tinta-suave);
  cursor: pointer;
}
.seletor label.check input { margin-top: .2rem; }

/* passo 1: árvore de campos e subáreas */
.seletor .arvore {
  margin-top: .7rem;
  max-height: 320px;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--papel);
  border: 1px solid var(--linha);
  border-radius: 12px;
}
.seletor .campo { border-bottom: 1px solid var(--linha-suave); }
.seletor .campo:last-child { border-bottom: 0; }
.seletor .campo summary {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: center;
  padding: .45rem .7rem;
  list-style: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .88rem;
  line-height: 1.3;
}
.seletor .campo summary::-webkit-details-marker { display: none; }
.seletor .campo summary::before {
  content: "";
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-left: 6px solid var(--tinta-suave);
  transform-origin: 3px 4px;
  transition: transform .15s ease;
}
.seletor .campo[open] summary::before { transform: rotate(90deg); }
.seletor .campo summary label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font: inherit;
}
.seletor .sub {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: center;
  padding: .28rem .7rem .28rem 2.1rem;
  font-size: .9rem;
  line-height: 1.35;
  cursor: pointer;
}
.seletor .sub:hover,
.seletor .campo summary:hover { background: var(--papel-2); }
.seletor .cont {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  color: var(--tinta-suave);
}

/* passo 2: coluna de estratos, o elemento central da página */
.seletor .coluna {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: .3rem;
}
.seletor .estrato {
  --c: var(--e1);
  --t: #FFFFFF;
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) 3.4rem;
  gap: .6rem;
  align-items: center;
  min-height: 38px;
  padding: 0 .8rem;
  border: 0;
  border-radius: 4px;
  background: var(--c);
  color: var(--t);
  box-shadow: inset 0 0 0 1px rgba(21, 10, 9, .06);
  text-align: left;
  font-family: var(--font-body);
  cursor: pointer;
  transition: filter .15s ease;
}
.seletor .estrato:first-child { border-radius: 12px 12px 4px 4px; }
.seletor .estrato:nth-last-child(2) { border-radius: 4px 4px 12px 12px; }
.seletor .estrato .rot {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
}
.seletor .estrato .faixa {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.seletor .estrato .faixa small {
  font-size: .76rem;
  opacity: .9;
  white-space: nowrap;
}
.seletor .estrato .barra {
  height: 5px;
  width: var(--w, 0%);
  min-width: 2px;
  border-radius: 3px;
  background: currentColor;
  opacity: .45;
  transition: width .2s ease;
}
.seletor .estrato .q {
  text-align: right;
  font-weight: 600;
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
}
.seletor .estrato[aria-pressed="false"] {
  background: transparent;
  color: var(--tinta-suave);
  box-shadow: inset 0 0 0 1px var(--linha), inset 6px 0 0 var(--c);
}
.seletor .estrato.sem {
  margin-top: .5rem;
  border-radius: 12px;
}
.seletor .estrato:hover { filter: brightness(1.05); }
.seletor .estrato:focus-visible,
.seletor .acoes-mini button:focus-visible,
.seletor .nome:focus-visible {
  outline: 3px solid var(--acento-vivo);
  outline-offset: 2px;
}
.seletor .dica {
  margin: 0 0 .7rem;
  font-size: .86rem;
  color: var(--tinta-suave);
}

/* -------- resultados -------- */
.seletor .cabecalho {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.seletor .total {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.15;
}
.seletor .total small {
  display: block;
  max-width: 70ch;
  margin-top: .3rem;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: .95rem;
  line-height: 1.45;
  color: var(--tinta-suave);
}
.seletor .barra-acoes {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  align-items: center;
}
.seletor .barra-acoes input[type="search"] { width: min(320px, 70vw); }
.seletor .btn-sm {
  padding: .62rem 1.25rem;
  font-size: .92rem;
}
.seletor .btn:disabled {
  opacity: .45;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.seletor .tabela {
  overflow-x: auto;
  background: var(--papel-3);
  border: 1px solid rgba(21, 10, 9, .10);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.seletor table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: .95rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
.seletor th {
  padding: 0;
  text-align: left;
  vertical-align: bottom;
  line-height: 1.25;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .84rem;
  color: var(--tinta-suave);
  background: var(--papel-3);
  border-bottom: 1px solid var(--linha);
}
.seletor th button {
  all: unset;
  display: block;
  padding: .85rem .6rem;
  cursor: pointer;
}
.seletor th button:hover { color: var(--acento); }
.seletor th button:focus-visible {
  outline: 3px solid var(--acento-vivo);
  outline-offset: -3px;
}
.seletor #cabGrupo th { border-bottom: 0; }
.seletor th.grupo {
  padding: .7rem .75rem 0;
  text-align: center;
}
.seletor th.grupo span {
  display: block;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--linha);
}
.seletor th[aria-sort] button { color: var(--acento); }
.seletor th[aria-sort] button::after { content: "\00a0▾"; font-size: .8em; }
.seletor th[aria-sort="ascending"] button::after { content: "\00a0▴"; }
.seletor th[data-k="ader"] { min-width: 5.4rem; }
.seletor th.num,
.seletor td.num { text-align: right; }
.seletor td {
  padding: .7rem .6rem;
  vertical-align: top;
  border-bottom: 1px solid var(--linha-suave);
}
.seletor td:first-child { min-width: 220px; padding-left: 1rem; }
.seletor td:nth-child(2) { min-width: 150px; }
.seletor th:first-child button { padding-left: 1rem; }
.seletor tr.rev { cursor: pointer; }
.seletor tr.rev:hover td { background: var(--realce); }
.seletor .nome {
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--tinta);
  cursor: pointer;
}
.seletor .nome:hover { color: var(--acento); }
.seletor .ed {
  display: block;
  margin-top: .1rem;
  font-size: .85rem;
  color: var(--tinta-suave);
}
.seletor .chip {
  display: inline-block;
  min-width: 2.7em;
  padding: .08rem .45rem;
  border-radius: 6px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .86rem;
  background: var(--c);
  color: var(--t);
}
.seletor .chip.estim {
  background: transparent;
  color: var(--tinta);
  outline: 2px dashed color-mix(in srgb, var(--c) 75%, var(--tinta));
  outline-offset: -2px;
}
.seletor .chip.vazio {
  background: transparent;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--tinta-suave);
}
.seletor .custo { min-width: 8.5rem; }
.seletor .custo.bom {
  font-weight: 600;
  color: var(--acento);
}
.seletor .mudo { color: var(--tinta-suave); }
.seletor tr.detalhe td {
  min-width: 0;
  padding: 1rem 1.2rem 1.3rem;
  background: var(--papel);
}
.seletor .det {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .9rem 2rem;
  font-size: .92rem;
  line-height: 1.5;
}
.seletor .det h3 {
  margin: 0 0 .3rem;
  font-size: .86rem;
  font-weight: 700;
  color: var(--acento);
}
.seletor .det ul { margin: 0; padding-left: 1.1rem; }
.seletor .vazio-msg {
  padding: 2.6rem 1.4rem;
  text-align: center;
  color: var(--tinta-suave);
}
.seletor .mais {
  display: flex;
  justify-content: center;
  margin-top: 1.2rem;
}

/* -------- carregamento -------- */
.seletor .carregando,
.seletor .falha {
  max-width: 560px;
  margin: 1rem auto;
  padding: 2.4rem 1.4rem;
  text-align: center;
  color: var(--tinta-suave);
}

/* -------- nota sobre as fontes -------- */
.seletor-fontes {
  max-width: 82ch;
  margin-top: 2.6rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--linha);
  font-size: .9rem;
  line-height: 1.55;
  color: var(--tinta-suave);
}
.seletor-fontes h2 {
  margin: 0 0 .5rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0;
}
.seletor-fontes p { margin: 0 0 .6rem; }

/* -------- telas menores: filtros acima dos resultados -------- */
@media (max-width: 960px) {
  .seletor-layout { grid-template-columns: 1fr; }
  .seletor .filtros {
    position: static;
    max-height: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .seletor * { transition: none !important; }
}
