/* Observabilidade Eduzz · wireframes navegáveis
   Camada de composição sobre @truffle-hunters/tokens 0.1.0.
   Só papéis semânticos, escala de 4 px, raios e elevações do Figma.
   Nenhum valor de cor literal: tudo vem de var(--th-*). */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--th-background-default);
  color: var(--th-foreground-default);
  -webkit-font-smoothing: antialiased;
}

/* A faixa de revisão fica sempre visível e o painel rola por dentro. */
body.th-corpo-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#raiz {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.th-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
}

.th-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.th-muted {
  color: var(--th-foreground-muted);
}

.th-acento {
  color: var(--th-brand-accent);
}

.th-pular {
  position: absolute;
  left: var(--th-space-4);
  top: calc(var(--th-space-2) * -10);
  z-index: 40;
  background: var(--th-background-surface);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-control);
  padding: var(--th-space-2) var(--th-space-3);
}

.th-pular:focus {
  top: var(--th-space-2);
}

/* ─────────────────────────────  Ícones  ───────────────────────────── */

.th-icone {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--th-size-icon);
  height: var(--th-size-icon);
  color: var(--th-icon-default);
}

.th-icone svg {
  width: 100%;
  height: 100%;
  display: block;
}

.th-icone--18 {
  width: 18px;
  height: 18px;
}
.th-icone--20 {
  width: 20px;
  height: 20px;
}
.th-icone--24 {
  width: var(--th-space-6);
  height: var(--th-space-6);
}
.th-icone--muted {
  color: var(--th-icon-muted);
}
.th-icone--acento {
  color: var(--th-icon-accent);
}

/* ─────────────────────────────  Marca  ───────────────────────────── */

/* Tile da marca do catálogo. Fora de uso no shell desde 25/11: o usuário pediu
   o símbolo sozinho, sem tile nem fundo verde (ver .tv-marca em validacao.css).
   A regra fica como referência do molde `dashboard-desktop`. */
.th-marca-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--th-radius-control);
  background: var(--th-green-nature);
  color: var(--th-paper-white);
}

.th-marca-tile svg {
  width: 16px;
  height: auto;
  display: block;
}

.th-marca-wordmark {
  display: block;
  width: 108px;
  height: auto;
  color: var(--th-foreground-default);
}

/* ─────────────────────  Faixa de revisão do wireframe  ───────────── */

/* A faixa precisa caber junto do painel: tudo aqui quebra linha e nada tem
   largura mínima implícita, senão os seletores empurram a página inteira. */
.th-faixa {
  flex: none;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--th-space-2) var(--th-space-3);
  padding: var(--th-space-2) var(--th-space-5);
  min-width: 0;
  max-width: 100%;
  background: var(--th-background-subtle);
  border-bottom: 1px solid var(--th-border-default);
}

.th-faixa-marca {
  display: flex;
  align-items: center;
  gap: var(--th-space-2);
  min-width: 0;
  color: var(--th-foreground-muted);
}

.th-faixa-grupo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--th-space-1) var(--th-space-2);
  min-width: 0;
  max-width: 100%;
}

.th-faixa-grupo > span {
  color: var(--th-foreground-muted);
}

.th-faixa-espaco {
  flex: 1 1 auto;
  min-width: 0;
}

.th-seletor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--th-space-1);
  padding: 3px;
  min-width: 0;
  max-width: 100%;
  background: var(--th-background-surface);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-md);
}

.th-seletor [data-estado],
.th-seletor [data-papel],
.th-seletor a {
  display: inline-flex;
  align-items: center;
  height: var(--th-space-8);
  padding: 0 var(--th-space-2);
  border-radius: var(--th-radius-control);
  font-family: var(--th-type-ui-caption-family);
  font-size: var(--th-type-ui-caption-size);
  line-height: var(--th-type-ui-caption-line-height);
  color: var(--th-foreground-muted);
  white-space: nowrap;
}

.th-seletor [data-estado]:hover,
.th-seletor [data-papel]:hover,
.th-seletor a:hover {
  background: var(--th-background-hover);
}

.th-seletor [aria-pressed='true'],
.th-seletor a[aria-current='true'] {
  background: var(--th-background-selected);
  color: var(--th-foreground-default);
}

/* ─────────────────────────────  Shell  ───────────────────────────── */

.th-app {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  align-items: start;
  min-height: 100%;
}

/* Filete da sidebar do Figma, desenhado na coluna para correr a altura inteira. */
.th-app::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 60px;
  width: 1px;
  background: var(--th-ground-brown-opacity-30);
}

.th-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--th-space-8);
  width: 60px;
  padding: var(--th-space-4) var(--th-space-4) var(--th-space-2);
  background: var(--th-background-surface);
}

.th-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-4);
}

.th-nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--th-radius-control);
  color: var(--th-navigation-foreground);
}

.th-nav-item:hover {
  background: var(--th-background-hover);
}

/* Seleção pelo papel semântico navigation/active, não pelo primitivo da paleta. */
.th-nav-item[aria-current='page'] {
  background: var(--th-navigation-active);
}

.th-sidebar-rodape {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--th-space-2);
}

.th-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--th-space-8);
  height: var(--th-space-8);
  border-radius: var(--th-radius-pill);
  background: var(--th-navigation-active);
  color: var(--th-navigation-foreground);
  font-family: var(--th-type-ui-caption-family);
  font-size: var(--th-type-ui-caption-size);
  flex: none;
}

.th-main {
  min-width: 0;
}

.th-header {
  display: flex;
  align-items: center;
  gap: var(--th-space-4);
  min-height: 80px;
  padding: var(--th-space-5) var(--th-space-6);
  border-bottom: 1px solid var(--th-border-default);
  background: var(--th-background-surface);
}

.th-header-titulo {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-1);
  min-width: 0;
}

.th-header-acoes {
  display: flex;
  align-items: center;
  gap: var(--th-space-3);
  margin-left: auto;
}

.th-menu-botao {
  display: none;
}

.th-trilha {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--th-space-10px);
  color: var(--th-foreground-muted);
}

.th-trilha [aria-current] {
  color: var(--th-foreground-default);
}

.th-conteudo {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-5);
  max-width: 1380px;
  padding: 28px;
}

/* ───────────────────────  Linha de título da página  ─────────────── */

.th-pagina-topo {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--th-space-4);
}

.th-pagina-titulo {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-2);
  min-width: 0;
  flex: 1 1 320px;
}

.th-pagina-acoes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--th-space-2);
  margin-left: auto;
}

.th-atualizacao {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--th-space-2);
  color: var(--th-foreground-muted);
}

.th-ponto {
  color: var(--th-border-selected);
}

/* ─────────────────────────────  Botões  ──────────────────────────── */

.th-botao {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--th-space-6px);
  height: var(--th-size-control);
  padding: 0 var(--th-space-3);
  border-radius: var(--th-radius-control);
  font-family: var(--th-type-action-family);
  font-size: var(--th-type-action-size);
  line-height: var(--th-type-action-line-height);
  white-space: nowrap;
}

.th-botao--primario {
  background: var(--th-action-primary);
  color: var(--th-action-primary-foreground);
}

.th-botao--primario .th-icone {
  color: var(--th-action-primary-foreground);
}

.th-botao--secundario {
  background: var(--th-background-surface);
  color: var(--th-foreground-muted);
  border: 1px solid var(--th-border-default);
}

.th-botao--fantasma {
  background: transparent;
  color: var(--th-foreground-muted);
}

.th-botao--destrutivo {
  background: var(--th-status-error);
  color: var(--th-paper-white);
}

.th-botao:hover {
  opacity: 0.88;
}

.th-botao[disabled],
.th-botao[aria-disabled='true'] {
  opacity: 0.4;
  cursor: not-allowed;
}

.th-botao--pequeno {
  height: var(--th-size-control-sm);
}

.th-botao--icone {
  width: var(--th-size-control-sm);
  height: var(--th-size-control-sm);
  padding: 0;
  background: var(--th-background-surface);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-control);
  color: var(--th-icon-default);
}

.th-botao--icone-40 {
  width: var(--th-size-control);
  height: var(--th-size-control);
}

.th-botao--ativo {
  background: var(--th-background-selected);
  border-color: var(--th-border-selected);
  color: var(--th-foreground-default);
}

.th-grupo-botoes {
  display: flex;
  gap: var(--th-space-1);
}

/* ─────────────────────────────  Campos  ──────────────────────────── */

.th-campo-bloco {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-6px);
}

.th-campo-rotulo {
  font-family: var(--th-type-ui-field-label-family);
  font-size: var(--th-type-ui-field-label-size);
  line-height: var(--th-type-ui-field-label-line-height);
  color: var(--th-foreground-muted);
}

.th-campo,
.th-selecao {
  height: var(--th-size-control);
  padding: 0 var(--th-space-3);
  width: 100%;
  background: var(--th-background-surface);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-control);
  color: var(--th-foreground-default);
  font-family: var(--th-type-action-family);
  font-size: var(--th-type-action-size);
}

.th-campo::placeholder {
  color: var(--th-foreground-placeholder);
}

.th-campo[aria-invalid='true'] {
  border-color: var(--th-status-error);
}

.th-campo[disabled],
.th-selecao[disabled] {
  background: var(--th-background-hover);
  opacity: 0.4;
}

.th-campo-erro {
  display: flex;
  align-items: center;
  gap: var(--th-space-1);
  font-family: var(--th-type-ui-field-label-family);
  font-size: var(--th-type-ui-field-label-size);
  color: var(--th-status-error);
}

.th-selecao {
  appearance: none;
  padding-right: var(--th-space-8);
  background-image: linear-gradient(var(--th-background-surface), var(--th-background-surface));
}

.th-selecao-envelope {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.th-selecao-envelope .th-icone {
  position: absolute;
  right: var(--th-space-3);
  pointer-events: none;
  color: var(--th-icon-muted);
}

.th-busca {
  display: flex;
  align-items: center;
  gap: var(--th-space-2);
  height: var(--th-size-control);
  padding: 0 var(--th-space-3);
  background: var(--th-background-surface);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-control);
  min-width: 0;
}

.th-busca input {
  border: none;
  outline: none;
  background: none;
  min-width: 0;
  flex: 1 1 auto;
  font-family: var(--th-type-ui-body-family);
  font-size: var(--th-type-ui-body-size);
  color: var(--th-foreground-default);
}

.th-caixa-rotulo {
  display: flex;
  align-items: flex-start;
  gap: var(--th-space-2);
  min-height: 44px;
  padding: var(--th-space-1) 0;
  cursor: pointer;
}

.th-caixa-rotulo input {
  margin: 0;
  width: var(--th-size-icon);
  height: var(--th-size-icon);
  margin-top: 3px;
  accent-color: var(--th-action-primary);
  flex: none;
}

/* ─────────────────────────────  Badges  ──────────────────────────── */

.th-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--th-space-1);
  height: var(--th-space-6);
  padding: 0 var(--th-space-2);
  border-radius: var(--th-radius-pill);
  font-family: var(--th-type-ui-caption-family);
  font-size: var(--th-type-ui-caption-size);
  line-height: 1;
  white-space: nowrap;
  background: var(--th-background-subtle);
  color: var(--th-foreground-default);
}

.th-badge--contorno {
  background: var(--th-background-surface);
  border: 1px solid var(--th-border-default);
}

.th-badge--sucesso {
  background: var(--th-status-success-surface);
  color: var(--th-status-success);
}

.th-badge--aviso {
  background: var(--th-status-warning-surface);
  color: var(--th-status-warning);
}

.th-badge--erro {
  background: var(--th-status-error-surface);
  color: var(--th-status-error);
}

.th-badge--info {
  background: var(--th-status-info-surface);
  color: var(--th-status-info);
}

.th-badge--escuro {
  background: var(--th-action-primary);
  color: var(--th-action-primary-foreground);
}

.th-badge .th-icone {
  width: 12px;
  height: 12px;
  color: currentColor;
}

/* ─────────────────────────────  Alerta  ──────────────────────────── */

.th-alerta {
  display: flex;
  align-items: flex-start;
  gap: var(--th-space-3);
  padding: var(--th-space-4);
  border-radius: var(--th-radius-md);
  background: var(--th-background-subtle);
}

.th-alerta .th-icone {
  margin-top: 1px;
}

.th-alerta-corpo {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-1);
  min-width: 0;
  flex: 1 1 auto;
}

.th-alerta-titulo {
  font-family: var(--th-type-ui-label-family);
  font-size: var(--th-type-ui-label-size);
  font-weight: var(--th-type-ui-label-weight);
  line-height: var(--th-type-ui-label-line-height);
}

.th-alerta-texto {
  font-family: var(--th-type-ui-caption-family);
  font-size: var(--th-type-ui-caption-size);
  line-height: var(--th-type-ui-caption-line-height);
  color: var(--th-foreground-muted);
}

.th-alerta--info {
  background: var(--th-status-info-surface);
}
.th-alerta--info .th-alerta-titulo,
.th-alerta--info .th-icone {
  color: var(--th-status-info);
}
.th-alerta--aviso {
  background: var(--th-status-warning-surface);
}
.th-alerta--aviso .th-alerta-titulo,
.th-alerta--aviso .th-icone {
  color: var(--th-status-warning);
}
.th-alerta--erro {
  background: var(--th-status-error-surface);
}
.th-alerta--erro .th-alerta-titulo,
.th-alerta--erro .th-icone {
  color: var(--th-status-error);
}
.th-alerta--sucesso {
  background: var(--th-status-success-surface);
}
.th-alerta--sucesso .th-alerta-titulo,
.th-alerta--sucesso .th-icone {
  color: var(--th-status-success);
}

/* ─────────────────────────────  Cartões  ─────────────────────────── */

.th-cartao {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-5);
  padding: var(--th-space-6);
  background: var(--th-background-surface);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-card);
  min-width: 0;
}

.th-cartao--compacto {
  gap: var(--th-space-3);
  padding: var(--th-space-5);
}

.th-cartao--destaque {
  border-color: var(--th-navigation-foreground);
}

.th-cartao-cabecalho {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--th-space-3);
}

.th-cartao-titulos {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-6px);
  min-width: 0;
  flex: 1 1 240px;
}

.th-cartao-titulo {
  font-family: var(--th-type-ui-title-family);
  font-size: var(--th-type-ui-title-size);
  font-weight: var(--th-type-ui-title-weight);
  line-height: var(--th-type-ui-title-line-height);
}

.th-cartao-significado {
  font-family: var(--th-type-ui-body-family);
  font-size: var(--th-type-ui-body-size);
  line-height: var(--th-type-ui-body-line-height);
  color: var(--th-foreground-muted);
}

.th-cartao-acoes {
  display: flex;
  align-items: center;
  gap: var(--th-space-2);
  margin-left: auto;
}

.th-cartao-rodape {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--th-space-3);
  padding-top: var(--th-space-3);
  border-top: 1px solid var(--th-border-default);
}

.th-leitura {
  font-family: var(--th-type-ui-body-family);
  font-size: var(--th-type-ui-body-size);
  line-height: var(--th-type-ui-body-line-height);
  color: var(--th-foreground-muted);
}

.th-separador {
  height: 1px;
  background: var(--th-border-default);
  border: none;
  margin: 0;
}

/* ──────────────  Linhas, grades e numeração de seção  ────────────── */

.th-linha-2-1 {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--th-space-5);
  align-items: start;
}

.th-linha-1-1 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--th-space-5);
  align-items: start;
}

.th-grade-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--th-space-4);
}

.th-secao {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-3);
}

.th-secao-rotulo {
  display: flex;
  align-items: baseline;
  gap: var(--th-space-2);
  font-family: var(--th-type-section-family);
  font-size: var(--th-type-section-size);
  line-height: var(--th-type-section-line-height);
  color: var(--th-foreground-muted);
  text-transform: uppercase;
}

.th-secao-numero {
  color: var(--th-brand-accent);
}

/* ─────────────────────  Medida (KPI com procedência)  ───────────── */

.th-kpi {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-1);
  padding: var(--th-space-4);
  background: var(--th-background-surface);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-card);
  min-width: 0;
}

.th-kpi-rotulo {
  display: flex;
  align-items: center;
  gap: var(--th-space-2);
  font-family: var(--th-type-ui-body-family);
  font-size: var(--th-type-ui-body-size);
  color: var(--th-foreground-muted);
}

.th-kpi-valor {
  font-family: var(--th-type-ui-value-family);
  font-size: var(--th-type-ui-value-size);
  font-weight: var(--th-type-ui-value-weight);
  line-height: var(--th-type-ui-value-line-height);
  letter-spacing: var(--th-type-ui-value-letter-spacing);
}

.th-kpi-variacao {
  font-family: var(--th-type-ui-caption-family);
  font-size: var(--th-type-ui-caption-size);
  line-height: var(--th-type-ui-caption-line-height);
  color: var(--th-foreground-muted);
}

.th-proc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--th-space-1) var(--th-space-2);
  margin-top: var(--th-space-2);
  padding-top: var(--th-space-2);
  border-top: 1px solid var(--th-border-default);
  font-family: var(--th-type-meta-family);
  font-size: var(--th-type-meta-size);
  line-height: var(--th-type-meta-line-height);
  color: var(--th-foreground-muted);
}

.th-proc--solta {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.th-meta {
  font-family: var(--th-type-meta-family);
  font-size: var(--th-type-meta-size);
  line-height: var(--th-type-meta-line-height);
  color: var(--th-foreground-muted);
}

/* Valor que não existe: textura + palavra, nunca zero e nunca só cor. */
.th-sem-valor {
  display: flex;
  align-items: center;
  gap: var(--th-space-2);
  min-height: var(--th-space-8);
}

.th-hachura {
  width: 28px;
  height: 14px;
  flex: none;
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-sm);
  background-image: repeating-linear-gradient(
    135deg,
    var(--th-border-selected) 0 1px,
    transparent 1px 5px
  );
}

.th-sem-valor-texto {
  font-family: var(--th-type-ui-title-family);
  font-size: var(--th-type-ui-title-size);
  font-weight: var(--th-type-ui-title-weight);
  color: var(--th-foreground-muted);
}

/* ─────────────────────────────  Cobertura  ───────────────────────── */

.th-cobertura {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-6px);
}

.th-cobertura-trilho {
  display: flex;
  height: var(--th-space-2);
  border-radius: var(--th-radius-pill);
  overflow: hidden;
  background-image: repeating-linear-gradient(
    135deg,
    var(--th-border-selected) 0 1px,
    transparent 1px 5px
  );
  border: 1px solid var(--th-border-default);
}

.th-cobertura-parte {
  background: var(--th-chart-2);
}

.th-cobertura-legenda {
  display: flex;
  flex-wrap: wrap;
  gap: var(--th-space-1) var(--th-space-3);
  font-family: var(--th-type-ui-caption-family);
  font-size: var(--th-type-ui-caption-size);
  color: var(--th-foreground-muted);
}

/* ────────────────────────  StatTile e KeyValue  ──────────────────── */

.th-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--th-space-3);
}

.th-stat {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-6px);
  padding: var(--th-space-4);
  border-radius: var(--th-radius-md);
  background: var(--th-background-subtle);
}

.th-stat-rotulo {
  font-family: var(--th-type-ui-caption-family);
  font-size: var(--th-type-ui-caption-size);
  line-height: var(--th-type-ui-caption-line-height);
  color: var(--th-foreground-muted);
  text-transform: uppercase;
}

.th-stat-valor {
  font-family: var(--th-type-ui-label-family);
  font-size: var(--th-type-ui-label-size);
  font-weight: var(--th-type-ui-label-weight);
}

.th-chaves {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-2);
}

.th-chave {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--th-space-3);
  font-family: var(--th-type-action-family);
  font-size: var(--th-type-action-size);
  line-height: 1.4;
}

.th-chave dt {
  color: var(--th-foreground-muted);
}

.th-chave dd {
  margin: 0;
  text-align: right;
}

/* ─────────────────────  Sinal operacional e lista  ───────────────── */

.th-sinal {
  display: flex;
  align-items: flex-start;
  gap: var(--th-space-3);
  width: 100%;
  padding: var(--th-space-3);
  text-align: left;
  background: var(--th-background-subtle);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-control);
}

.th-sinal:hover {
  background: var(--th-background-hover);
}

.th-sinal-corpo {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-1);
  min-width: 0;
  flex: 1 1 auto;
}

.th-sinal-titulo {
  font-family: var(--th-type-ui-label-family);
  font-size: var(--th-type-ui-label-size);
  font-weight: var(--th-type-ui-label-weight);
}

.th-sinal-contexto {
  font-family: var(--th-type-ui-caption-family);
  font-size: var(--th-type-ui-caption-size);
  line-height: var(--th-type-ui-caption-line-height);
  color: var(--th-foreground-muted);
}

.th-item {
  display: flex;
  align-items: center;
  gap: var(--th-space-3);
  width: 100%;
  min-height: 64px;
  padding: var(--th-space-3);
  text-align: left;
  background: var(--th-background-surface);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-control);
}

.th-item:hover {
  background: var(--th-background-hover);
}

.th-item[aria-current='true'],
.th-item[data-state='selected'] {
  background: var(--th-background-selected);
  border-color: var(--th-border-selected);
}

.th-item-corpo {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-1);
  min-width: 0;
  flex: 1 1 auto;
}

.th-item-titulo {
  font-family: var(--th-type-label-family);
  font-size: var(--th-type-label-size);
  font-weight: var(--th-type-label-weight);
}

.th-item-sub {
  font-family: var(--th-type-ui-caption-family);
  font-size: var(--th-type-ui-caption-size);
  line-height: var(--th-type-ui-caption-line-height);
  color: var(--th-foreground-muted);
}

.th-pilha {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-2);
}

.th-pilha--3 {
  gap: var(--th-space-3);
}

.th-linha-flex {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--th-space-2);
}

/* ─────────────────────────────  Abas  ────────────────────────────── */

.th-abas {
  display: flex;
  gap: var(--th-space-1);
  padding: var(--th-space-1);
  background: var(--th-background-subtle);
  border-radius: var(--th-radius-md);
  overflow-x: auto;
  position: relative;
}

.th-aba {
  display: inline-flex;
  align-items: center;
  height: var(--th-space-8);
  padding: 0 var(--th-space-3);
  border-radius: var(--th-radius-control);
  font-family: var(--th-type-action-family);
  font-size: var(--th-type-action-size);
  color: var(--th-foreground-muted);
  white-space: nowrap;
}

.th-aba[aria-current='page'] {
  background: var(--th-background-surface);
  color: var(--th-foreground-default);
}

/* Tabela dentro de um card não ganha segunda caixa: filete e cabeçalho bastam. */
.th-cartao .th-tabela-caixa,
.th-painel .th-tabela-caixa {
  border: none;
  border-radius: 0;
}

.th-cartao .th-tabela-barra,
.th-painel .th-tabela-barra {
  padding-left: 0;
  padding-right: 0;
}

/* ─────────────────────────────  Tabela  ──────────────────────────── */

.th-tabela-caixa {
  background: var(--th-background-surface);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-card);
  overflow: hidden;
  min-width: 0;
}

.th-tabela-barra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--th-space-3);
  min-height: 64px;
  padding: var(--th-space-4);
}

.th-tabela-barra .th-cartao-titulo {
  flex: 1 1 200px;
}

.th-rolagem {
  position: relative;
  overflow-x: auto;
}

.th-tabela th,
.th-tabela td {
  text-align: left;
  padding: var(--th-space-3) var(--th-space-4);
  vertical-align: top;
}

.th-tabela thead th {
  background: var(--th-background-subtle);
  font-family: var(--th-type-ui-label-family);
  font-size: var(--th-type-ui-label-size);
  font-weight: var(--th-type-ui-label-weight);
  color: var(--th-foreground-muted);
  white-space: nowrap;
}

.th-tabela tbody tr {
  border-top: 1px solid var(--th-border-default);
}

.th-tabela tbody tr:hover {
  background: var(--th-background-hover);
}

.th-tabela tbody tr[aria-current='true'] {
  background: var(--th-background-selected);
}

.th-tabela td {
  font-family: var(--th-type-ui-body-family);
  font-size: var(--th-type-ui-body-size);
  line-height: var(--th-type-ui-body-line-height);
  color: var(--th-foreground-muted);
}

.th-tabela td.th-col-principal {
  color: var(--th-foreground-default);
}

.th-tabela .th-numero {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.th-tabela-rodape {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--th-space-3);
  padding: var(--th-space-3) var(--th-space-4);
  border-top: 1px solid var(--th-border-default);
  color: var(--th-foreground-muted);
}

.th-paginacao {
  display: flex;
  align-items: center;
  gap: var(--th-space-6px);
  margin-left: auto;
}

.th-paginacao a,
.th-paginacao span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: var(--th-space-8);
  padding: 0 var(--th-space-2);
  border-radius: var(--th-radius-control);
  font-family: var(--th-type-action-family);
  font-size: var(--th-type-action-size);
  color: var(--th-foreground-muted);
}

.th-paginacao [aria-current='page'] {
  background: var(--th-background-hover);
  border: 1px solid var(--th-border-default);
  color: var(--th-foreground-default);
}

.th-celula-acao {
  display: inline-flex;
  align-items: center;
  gap: var(--th-space-1);
  color: var(--th-foreground-default);
}

/* ─────────────────────────────  Gráficos  ───────────────────────── */

.th-grafico {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.th-grade {
  stroke: var(--th-chart-grid);
  stroke-width: 1;
}

.th-serie-1-linha {
  fill: none;
  stroke: var(--th-chart-1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.th-serie-2-linha {
  fill: none;
  stroke: var(--th-chart-2);
  stroke-width: 2;
  stroke-dasharray: 4 4;
  stroke-linejoin: round;
}

.th-serie-area {
  fill: var(--th-chart-area);
}

.th-barra-1 {
  fill: var(--th-chart-1);
}
.th-barra-2 {
  fill: var(--th-chart-2);
}
.th-barra-3 {
  fill: var(--th-chart-3);
}
.th-barra-4 {
  fill: var(--th-chart-4);
}
.th-barra-5 {
  fill: var(--th-chart-5);
}
.th-barra-vazia {
  fill: var(--th-background-subtle);
  stroke: var(--th-border-default);
}

.th-eixo {
  font-family: var(--th-type-ui-caption-family);
  font-size: var(--th-type-ui-caption-size);
  fill: var(--th-foreground-muted);
}

.th-legenda {
  display: flex;
  flex-wrap: wrap;
  gap: var(--th-space-2) var(--th-space-4);
}

.th-legenda-item {
  display: inline-flex;
  align-items: center;
  gap: var(--th-space-2);
  font-family: var(--th-type-ui-caption-family);
  font-size: var(--th-type-ui-caption-size);
  color: var(--th-foreground-muted);
}

.th-marcador {
  width: 7px;
  height: 7px;
  border-radius: var(--th-radius-pill);
  flex: none;
}

.th-marcador--1 {
  background: var(--th-chart-1);
}
.th-marcador--2 {
  background: var(--th-chart-2);
}
.th-marcador--3 {
  background: var(--th-chart-3);
}
.th-marcador--4 {
  background: var(--th-chart-4);
}
.th-marcador--5 {
  background: var(--th-chart-5);
}
.th-marcador--vazio {
  background-image: repeating-linear-gradient(
    135deg,
    var(--th-border-selected) 0 1px,
    transparent 1px 4px
  );
  border: 1px solid var(--th-border-default);
}

/* Barras horizontais com rótulo e valor, em filetes. */
.th-barras {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-3);
}

.th-barra-linha {
  display: grid;
  grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--th-space-3);
}

.th-barra-rotulo {
  font-family: var(--th-type-ui-body-family);
  font-size: var(--th-type-ui-body-size);
  color: var(--th-foreground-default);
}

.th-barra-trilho {
  height: var(--th-space-2);
  border-radius: var(--th-radius-pill);
  background: var(--th-background-subtle);
  overflow: hidden;
}

/* Sem medição: a mesma hachura da peça de valor ausente, nunca uma barra de 0. */
.th-barra-trilho--sem {
  background-image: repeating-linear-gradient(
    135deg,
    var(--th-border-selected) 0 1px,
    transparent 1px 5px
  );
  border: 1px solid var(--th-border-default);
}

/* Correção de 25/11: o span é vazio e a largura vem do dado — sem `display:
   block` ele fica inline e a barra não pinta (trilho cheio, valor invisível). */
.th-barra-valor {
  display: block;
  height: 100%;
  background: var(--th-chart-1);
}

.th-barra-valor--comparacao {
  background: var(--th-chart-2);
}

.th-barra-valor--neutra {
  background: var(--th-chart-3);
}

.th-barra-numero {
  font-family: var(--th-type-ui-label-family);
  font-size: var(--th-type-ui-label-size);
  font-weight: var(--th-type-ui-label-weight);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ───────────────────────  Etapas da jornada  ─────────────────────── */

.th-etapas {
  display: flex;
  flex-direction: column;
}

.th-etapa {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(0, 220px) auto;
  align-items: center;
  gap: var(--th-space-3);
  padding: var(--th-space-3) 0;
  border-top: 1px solid var(--th-border-default);
}

.th-etapa:first-child {
  border-top: none;
}

.th-etapa-ordem {
  font-family: var(--th-type-meta-family);
  font-size: var(--th-type-meta-size);
  color: var(--th-brand-accent);
}

.th-etapa-nome {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.th-etapa-valor {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-1);
  align-items: flex-end;
  text-align: right;
}

.th-etapa-numero {
  font-family: var(--th-type-ui-label-family);
  font-size: var(--th-type-ui-label-size);
  font-weight: var(--th-type-ui-label-weight);
  font-variant-numeric: tabular-nums;
}

.th-etapa-medida {
  width: 100%;
}

/* ─────────────────────  Vazio, carregando e erro  ───────────────── */

.th-vazio {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--th-space-3);
  padding: var(--th-space-6);
  background: var(--th-background-surface);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-card);
}

.th-vazio-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--th-size-control);
  height: var(--th-size-control);
  border-radius: var(--th-radius-md);
  background: var(--th-background-subtle);
}

.th-esqueleto {
  background: var(--th-background-subtle);
  border-radius: var(--th-radius-control);
  animation: th-pulso 1.6s ease-in-out infinite;
}

.th-esqueleto--area {
  border-radius: var(--th-radius-md);
}

@keyframes th-pulso {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

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

/* ─────────────────────  Diálogo, painel e aviso  ────────────────── */

dialog.th-dialogo {
  width: 352px;
  max-width: calc(100vw - var(--th-space-8));
  padding: var(--th-space-6);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-card);
  background: var(--th-background-surface);
  color: var(--th-foreground-default);
  box-shadow: var(--th-shadow-overlay);
}

dialog.th-dialogo--larga {
  width: 520px;
}

dialog.th-dialogo::backdrop {
  background: var(--th-green-nature-opacity-60);
}

.th-dialogo-corpo {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-5);
}

.th-dialogo-cabecalho {
  display: flex;
  align-items: flex-start;
  gap: var(--th-space-3);
}

.th-dialogo-cabecalho .th-cartao-titulo {
  flex: 1 1 auto;
}

/* Estado do formulário dentro do diálogo: linha de status e o controle de
   revisão, que troca o estado pelo endereço sem sair do diálogo. */
.th-status {
  display: flex;
  align-items: center;
  gap: var(--th-space-2);
  font-family: var(--th-type-ui-caption-family);
  font-size: var(--th-type-ui-caption-size);
  line-height: var(--th-type-ui-caption-line-height);
  color: var(--th-foreground-muted);
}

.th-dialogo-revisao {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--th-space-2);
  padding-top: var(--th-space-3);
  border-top: 1px solid var(--th-border-default);
}

.th-dialogo-rodape {
  display: flex;
  flex-wrap: wrap;
  gap: var(--th-space-3);
}

.th-dialogo-rodape .th-botao {
  flex: 1 1 0;
}

dialog.th-painel {
  position: fixed;
  inset: 0 0 0 auto;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: var(--th-space-6);
  border: none;
  border-left: 1px solid var(--th-border-default);
  border-radius: 0;
  background: var(--th-background-surface);
  color: var(--th-foreground-default);
  box-shadow: var(--th-shadow-overlay);
  overflow-y: auto;
}

dialog.th-painel::backdrop {
  background: var(--th-green-nature-opacity-60);
}

dialog.th-menu {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: var(--th-space-4);
  border: none;
  border-right: 1px solid var(--th-border-default);
  border-radius: 0;
  background: var(--th-background-surface);
  color: var(--th-foreground-default);
  box-shadow: var(--th-shadow-overlay);
}

dialog.th-menu::backdrop {
  background: var(--th-green-nature-opacity-60);
}

.th-menu-lista {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-1);
  margin-top: var(--th-space-5);
}

.th-menu-lista a {
  display: flex;
  align-items: center;
  gap: var(--th-space-10px);
  min-height: 44px;
  padding: 0 var(--th-space-2);
  border-radius: var(--th-radius-control);
  font-family: var(--th-type-label-family);
  font-size: var(--th-type-label-size);
  font-weight: var(--th-type-label-weight);
  color: var(--th-navigation-foreground);
}

.th-menu-lista a[aria-current='page'] {
  background: var(--th-navigation-active);
}

.th-aviso {
  position: fixed;
  right: var(--th-space-5);
  bottom: var(--th-space-5);
  z-index: 50;
  display: flex;
  align-items: flex-start;
  gap: var(--th-space-3);
  max-width: 360px;
  padding: var(--th-space-4);
  background: var(--th-background-surface);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-card);
  box-shadow: var(--th-shadow-raised);
}

/* ─────────────────────────────  Acesso  ─────────────────────────── */

.th-acesso {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: var(--th-space-12) var(--th-space-5);
  overflow: hidden;
}

.th-acesso-fundo {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.th-acesso-fundo svg {
  position: absolute;
  left: 50%;
  bottom: -62%;
  width: 1061px;
  transform: translateX(-50%);
  color: var(--th-foreground-default);
}

.th-acesso-tiles {
  position: absolute;
  display: flex;
  gap: var(--th-space-5);
  left: 50%;
  bottom: var(--th-space-12);
  transform: translateX(-50%);
}

.th-acesso-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: var(--th-radius-md);
  background: var(--th-brand-accent);
  color: var(--th-paper-white);
}

.th-acesso-tile svg {
  width: var(--th-space-6);
  height: auto;
}

.th-acesso-cartao {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--th-space-8);
  width: 453px;
  max-width: 100%;
  padding: var(--th-space-10) var(--th-space-16);
  background: var(--th-background-surface);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-card);
}

.th-acesso-cabecalho {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--th-space-10px);
  text-align: center;
}

.th-acesso-campos {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-6);
  width: 100%;
}

.th-acesso-cartao .th-botao {
  width: 100%;
}

.th-acesso-rodape {
  font-family: var(--th-type-ui-field-label-family);
  font-size: var(--th-type-ui-field-label-size);
  color: var(--th-foreground-muted);
  text-align: center;
}

.th-divisor-ou {
  display: flex;
  align-items: center;
  gap: var(--th-space-3);
  width: 100%;
  color: var(--th-foreground-muted);
}

.th-divisor-ou::before,
.th-divisor-ou::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--th-border-default);
}

/* ─────────────────────────────  Atlas  ──────────────────────────── */

.th-atlas {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--th-space-12) var(--th-space-6) var(--th-space-16);
  display: flex;
  flex-direction: column;
  gap: var(--th-space-10);
}

.th-atlas-topo {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-5);
}

.th-atlas-grade {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--th-space-5);
}

.th-atlas-tela {
  display: flex;
  flex-direction: column;
  gap: var(--th-space-2);
  padding: var(--th-space-3) 0;
  border-top: 1px solid var(--th-border-default);
}

.th-atlas-tela:first-child {
  border-top: none;
  padding-top: 0;
}

.th-atlas-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--th-space-1) var(--th-space-2);
}

.th-atlas-link {
  display: inline-flex;
  align-items: center;
  gap: var(--th-space-1);
  min-height: var(--th-space-6);
  padding: 0 var(--th-space-2);
  border: 1px solid var(--th-border-default);
  border-radius: var(--th-radius-pill);
  font-family: var(--th-type-meta-family);
  font-size: var(--th-type-meta-size);
  color: var(--th-foreground-muted);
}

.th-atlas-link:hover {
  background: var(--th-background-hover);
  color: var(--th-foreground-default);
}

.th-atlas-link--principal {
  border-color: var(--th-border-selected);
  color: var(--th-foreground-default);
}

/* ─────────────────────────────  Responsivo  ─────────────────────── */

@media (max-width: 1180px) {
  .th-linha-2-1 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1024px) {
  .th-app {
    grid-template-columns: minmax(0, 1fr);
  }

  .th-sidebar,
  .th-app::before {
    display: none;
  }

  .th-menu-botao {
    display: inline-flex;
  }

  .th-conteudo {
    padding: var(--th-space-5);
  }

  .th-header {
    padding: var(--th-space-4) var(--th-space-5);
  }
}

@media (max-width: 760px) {
  .th-faixa {
    padding: var(--th-space-2) var(--th-space-4);
  }

  /* Alvo de toque de 44 px nos controles de revisão e nos ícones de fechar. */
  .th-seletor [data-estado],
  .th-seletor [data-papel],
  .th-seletor a {
    min-height: 44px;
    padding: 0 var(--th-space-3);
  }

  .th-botao--icone,
  .th-botao--icone-40,
  .th-aviso .th-botao--icone {
    width: 44px;
    height: 44px;
  }

  .th-botao--pequeno {
    height: 44px;
  }

  .th-pagina-acoes {
    margin-left: 0;
    width: 100%;
  }

  .th-pagina-acoes .th-botao,
  .th-pagina-acoes .th-selecao-envelope {
    flex: 1 1 140px;
  }

  .th-etapa {
    grid-template-columns: 32px minmax(0, 1fr);
    grid-template-areas:
      'ordem nome'
      '. valor'
      '. medida';
  }

  .th-etapa-ordem {
    grid-area: ordem;
  }
  .th-etapa-nome {
    grid-area: nome;
  }
  .th-etapa-valor {
    grid-area: valor;
    align-items: flex-start;
    text-align: left;
  }
  .th-etapa-medida {
    grid-area: medida;
  }

  dialog.th-painel {
    width: 100vw;
    border-left: none;
  }

  .th-acesso-cartao {
    padding: var(--th-space-8) var(--th-space-6);
    gap: var(--th-space-6);
  }

  .th-acesso-fundo svg {
    width: 760px;
  }
}

@media (max-width: 640px) {
  .th-conteudo {
    padding: var(--th-space-4);
  }

  /* Com todos os seletores empilhados, a faixa pode ficar alta: ela rola por
     dentro em vez de comer a tela. Nada é escondido. */
  .th-faixa {
    position: relative;
    max-height: 40vh;
    overflow-y: auto;
  }

  /* Tabela larga vira lista: cada célula leva o nome da coluna. */
  .th-tabela thead {
    display: none;
  }

  .th-tabela,
  .th-tabela tbody,
  .th-tabela tr,
  .th-tabela td {
    display: block;
    width: auto;
  }

  .th-tabela tbody tr {
    padding: var(--th-space-3) var(--th-space-4);
  }

  .th-tabela td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--th-space-3);
    padding: 3px 0;
    text-align: right;
  }

  .th-tabela td::before {
    content: attr(data-rotulo);
    font-family: var(--th-type-ui-caption-family);
    font-size: var(--th-type-ui-caption-size);
    color: var(--th-foreground-muted);
    text-align: left;
    flex: 0 0 auto;
  }

  .th-tabela td.th-col-principal {
    font-family: var(--th-type-label-family);
    font-size: var(--th-type-label-size);
    font-weight: var(--th-type-label-weight);
    padding-bottom: var(--th-space-2);
  }

  .th-barra-linha {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'rotulo numero'
      'trilho trilho';
    gap: var(--th-space-2);
  }

  .th-barra-rotulo {
    grid-area: rotulo;
  }
  .th-barra-numero {
    grid-area: numero;
  }
  .th-barra-trilho {
    grid-area: trilho;
  }

  .th-aviso {
    right: var(--th-space-4);
    left: var(--th-space-4);
    max-width: none;
  }
}
