/* ---------- Cabecalho de tela ---------- */
.cabecalho { display: flex; align-items: flex-end; gap: var(--e3); flex-wrap: wrap; margin-bottom: var(--e4); }
.cabecalho .titulo { flex: 1; min-width: 200px; }
.cabecalho .titulo p { margin: var(--e1) 0 0; color: var(--texto-fraco); font-size: var(--t-sm); }

/* ---------- Botoes ---------- */
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e2);
  min-height: var(--toque); padding: 0 var(--e4);
  border: 1px solid var(--borda-forte); border-radius: var(--r);
  background: var(--superficie); color: var(--texto);
  font-size: var(--t-base); font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.botao:hover { background: var(--bege-200); }
.botao[disabled] { opacity: 0.45; cursor: not-allowed; }
.botao-primario { background: var(--acento); border-color: var(--acento); color: var(--bege-100); }
.botao-primario:hover { background: var(--acento-hover); }
.botao-fantasma { border-color: transparent; background: transparent; color: var(--texto-medio); }
.botao-fantasma:hover { background: var(--bege-200); }
.botao-perigo { color: var(--erro); border-color: color-mix(in srgb, var(--erro) 35%, var(--borda)); }
.botao-perigo:hover { background: var(--erro-fundo); }
.botao-pq { min-height: 34px; padding: 0 var(--e3); font-size: var(--t-sm); }
.botao-largo { width: 100%; }
.botoes { display: flex; flex-wrap: wrap; gap: var(--e2); }

/* ---------- Cartoes ---------- */
.cartao {
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--r-lg);
  padding: var(--e4);
  box-shadow: var(--sombra-1);
}
.cartao + .cartao { margin-top: var(--e3); }
.cartao-chapa { box-shadow: none; background: var(--superficie-2); }

/* ---------- Selos ---------- */
.selo {
  display: inline-flex; align-items: center; gap: var(--e1);
  padding: 2px var(--e2); border-radius: var(--r-cheio);
  background: var(--superficie-3); color: var(--texto-medio);
  font-size: var(--t-xs); font-weight: 500; white-space: nowrap;
}
.selo-ok { background: var(--ok-fundo); color: var(--ok); }
.selo-alerta { background: var(--alerta-fundo); color: var(--alerta); }
.selo-erro { background: var(--erro-fundo); color: var(--erro); }
.selo-info { background: var(--info-fundo); color: var(--info); }
.selo-contorno { background: transparent; border: 1px solid var(--borda-forte); }

/* ---------- Pontuacao ---------- */
.nota { font-family: var(--fonte-titulo); font-size: var(--t-lg); line-height: 1; }
.nota-alta { color: var(--ok); }
.nota-media { color: var(--alerta); }
.nota-baixa { color: var(--texto-fraco); }

/* ---------- Formularios ---------- */
.campo { display: block; margin-bottom: var(--e3); }
.campo > span { display: block; font-size: var(--t-sm); color: var(--texto-medio); margin-bottom: var(--e1); }
.campo > span .dica { color: var(--texto-fraco); font-weight: 400; }
.campo input, .campo select, .campo textarea {
  width: 100%; min-height: var(--toque); padding: var(--e2) var(--e3);
  background: var(--superficie); border: 1px solid var(--borda-forte); border-radius: var(--r);
}
.campo textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.campo input[type=checkbox] { width: auto; min-height: auto; }
.linha-campos { display: grid; gap: var(--e3); grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .linha-campos.duas { grid-template-columns: 1fr 1fr; }
  .linha-campos.tres { grid-template-columns: repeat(3, 1fr); }
}
.marcar { display: flex; align-items: center; gap: var(--e2); min-height: var(--toque); font-size: var(--t-base); }
.marcar input { flex: 0 0 auto; }

/* ---------- Filtros ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: var(--e2); margin-bottom: var(--e4); }
.filtros select, .filtros input {
  min-height: 38px; padding: 0 var(--e3);
  border: 1px solid var(--borda-forte); border-radius: var(--r-cheio);
  background: var(--superficie); font-size: var(--t-sm);
}
.filtros input[type=search] { min-width: 180px; flex: 1; }

/* ---------- Tabela ---------- */
.rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabela { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.tabela th {
  text-align: left; font-weight: 600; color: var(--texto-fraco); font-size: var(--t-xs);
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: var(--e2) var(--e3); border-bottom: 1px solid var(--borda-forte); white-space: nowrap;
}
.tabela td { padding: var(--e3); border-bottom: 1px solid var(--borda); vertical-align: top; }
.tabela tbody tr:hover { background: var(--superficie-2); }
.tabela .principal { font-weight: 600; font-size: var(--t-base); }
.tabela .clicavel { cursor: pointer; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: var(--e3); overflow-x: auto; padding-bottom: var(--e3); }
.kanban-coluna { flex: 0 0 258px; background: var(--superficie-2); border: 1px solid var(--borda); border-radius: var(--r-lg); padding: var(--e3); }
.kanban-coluna h3 {
  font-family: var(--fonte); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--texto-fraco); display: flex; justify-content: space-between; margin-bottom: var(--e3);
}
.kanban-item { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--r); padding: var(--e3); margin-bottom: var(--e2); cursor: pointer; }
.kanban-item:hover { border-color: var(--borda-forte); }
.kanban-item .nome { font-weight: 600; }
.kanban-item .meta { color: var(--texto-fraco); font-size: var(--t-xs); margin-top: 2px; }

/* ---------- Indicadores ---------- */
.indicadores { display: grid; gap: var(--e3); grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .indicadores { grid-template-columns: repeat(4, 1fr); } }
.indicador { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--r-lg); padding: var(--e4); }
.indicador .rotulo { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--texto-fraco); }
.indicador .valor { font-family: var(--fonte-titulo); font-size: var(--t-2xl); line-height: 1.1; margin-top: var(--e1); }
.indicador .apoio { font-size: var(--t-xs); color: var(--texto-fraco); }

/* ---------- Barra de progresso ---------- */
.progresso { margin: var(--e2) 0; }
.progresso .trilha { height: 8px; background: var(--superficie-3); border-radius: var(--r-cheio); overflow: hidden; }
.progresso .preenchido { height: 100%; background: var(--marrom-700); border-radius: var(--r-cheio); transition: width 0.3s; }
.progresso .legenda { display: flex; justify-content: space-between; font-size: var(--t-xs); color: var(--texto-fraco); margin-bottom: var(--e1); }

/* ---------- Modal ---------- */
.modal-fundo {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(28, 25, 23, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 640px) { .modal-fundo { align-items: center; padding: var(--e4); } }
.modal {
  background: var(--fundo); width: 100%; max-width: 580px; max-height: 92vh; overflow: auto;
  border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--sombra-3);
  padding: var(--e4); padding-bottom: max(var(--e4), env(safe-area-inset-bottom));
}
@media (min-width: 640px) { .modal { border-radius: var(--r-lg); } }
.modal-cabecalho { display: flex; align-items: center; gap: var(--e3); margin-bottom: var(--e4); }
.modal-cabecalho h2 { flex: 1; }

/* ---------- Avisos ---------- */
.avisos {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 80;
  display: flex; flex-direction: column; gap: var(--e2);
  width: calc(100% - 32px); max-width: 420px;
}
@media (min-width: 900px) { .avisos { bottom: var(--e4); left: auto; right: var(--e4); transform: none; } }
.aviso { background: var(--preto); color: var(--bege-100); padding: var(--e3) var(--e4); border-radius: var(--r); box-shadow: var(--sombra-2); font-size: var(--t-sm); }
.aviso-ok { background: var(--ok); }
.aviso-erro { background: var(--erro); }

/* ---------- Faixas de estado ---------- */
.faixa { display: flex; gap: var(--e3); align-items: flex-start; padding: var(--e3) var(--e4); border-radius: var(--r); font-size: var(--t-sm); margin-bottom: var(--e4); }
.faixa-info { background: var(--info-fundo); color: var(--info); }
.faixa-alerta { background: var(--alerta-fundo); color: var(--alerta); }
.faixa-erro { background: var(--erro-fundo); color: var(--erro); }
.faixa strong { display: block; }

/* ---------- Vazio ---------- */
.vazio { text-align: center; padding: var(--e6) var(--e4); color: var(--texto-fraco); }
.vazio h2 { color: var(--texto); margin-bottom: var(--e2); }
.vazio .passos { text-align: left; max-width: 470px; margin: var(--e5) auto 0; }
.vazio .passos li { margin-bottom: var(--e3); color: var(--texto-medio); }

/* ---------- Abas ---------- */
.abas { display: flex; gap: var(--e1); border-bottom: 1px solid var(--borda); margin-bottom: var(--e4); overflow-x: auto; }
.abas button {
  min-height: 42px; padding: 0 var(--e3); border: none; background: none; cursor: pointer;
  color: var(--texto-fraco); font-size: var(--t-sm); border-bottom: 2px solid transparent; white-space: nowrap;
}
.abas button[aria-selected=true] { color: var(--acento); border-bottom-color: var(--acento); font-weight: 600; }

/* ---------- Linha do tempo ---------- */
.tempo { list-style: none; margin: 0; padding: 0; }
.tempo li { position: relative; padding: 0 0 var(--e4) var(--e5); border-left: 1px solid var(--borda); }
.tempo li:last-child { border-left-color: transparent; padding-bottom: 0; }
.tempo li::before { content: ""; position: absolute; left: -5px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--marrom-500); }
.tempo .quando { font-size: var(--t-xs); color: var(--texto-fraco); }
.tempo .texto { white-space: pre-wrap; margin-top: var(--e1); }
