/* Marca: laranja e preto. O texto sobre laranja é preto (contraste 6,8:1); branco sobre este laranja ficaria em 3,1:1. */
:root {
  --laranja: #f26a1b;
  --laranja-escuro: #c2410c;
  --preto: #111111;
  --grafite: #1f1f1f;
  --texto: #1a1a1a;
  --texto-suave: #5b5b5b;
  --fundo: #f5f4f2;
  --borda: #dcdad6;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--texto); background: var(--fundo); }
a { color: var(--laranja-escuro); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--laranja); outline-offset: 2px; }

header.topo { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .625rem 1.5rem;
  background: var(--preto); color: #fff; border-bottom: 3px solid var(--laranja); }
a.marca { display: inline-flex; align-items: center; gap: .625rem; color: #fff; text-decoration: none; font-size: 1.25rem; letter-spacing: .01em; }
a.marca img { display: block; }
a.marca .laranja { color: var(--laranja); font-weight: 700; }
a.marca .porta { font-weight: 700; }
a.marca .ai { margin-left: .125rem; padding: .0625rem .4rem; border-radius: .25rem; background: var(--laranja); color: var(--preto); font-size: .8125rem; font-weight: 800; }
a.marca small { display: block; color: #bdbdbd; font-size: .6875rem; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; }
header.topo form { display: flex; align-items: center; gap: .75rem; }
header.topo .usuario { color: #e5e5e5; font-size: .875rem; }

main { max-width: 56rem; margin: 2rem auto; padding: 0 1.5rem; }
nav[aria-label="Menu principal"] { display: flex; flex-wrap: wrap; gap: .75rem; max-width: 56rem; margin: 1rem auto; padding: 0 1.5rem; }
nav[aria-label="Menu principal"] a { display: inline-block; padding: .5rem .875rem; border: 1px solid var(--borda); border-radius: .375rem; background: white; font-weight: 600; }
h1 { font-size: 1.625rem; margin: 0 0 1rem; }
h2 { font-size: 1.125rem; margin: 0 0 .75rem; }

.cartao { background: #fff; border: 1px solid var(--borda); border-radius: .5rem; padding: 1rem 1.25rem; margin-bottom: 1rem; }
ul.lista { list-style: none; padding: 0; margin: 0; }
ul.lista li { padding: .625rem 0; border-bottom: 1px solid var(--borda); }
ul.lista li:last-child { border-bottom: 0; }
ul.lista a { font-weight: 600; }
.vazio { color: var(--texto-suave); }
.erro { color: #b91c1c; font-weight: 600; }

form.linha { display: flex; gap: .75rem; align-items: end; flex-wrap: wrap; }
label { display: grid; gap: .25rem; font-size: .875rem; font-weight: 600; }
input[type=text], input[type=email] { padding: .5625rem .75rem; border: 1px solid #b9b6b0; border-radius: .375rem; font: inherit; min-width: 16rem; background: #fff; }
button, a.botao { padding: .5625rem 1.125rem; border: 0; border-radius: .375rem; background: var(--laranja); color: var(--preto); font: inherit; font-weight: 700; cursor: pointer; }
a.botao { display: inline-block; text-decoration: none; }
select, textarea { padding: .5625rem .75rem; border: 1px solid #b9b6b0; border-radius: .375rem; font: inherit; background: #fff; color: var(--texto); }
.editor textarea { display: block; width: 100%; resize: vertical; margin-bottom: 1.25rem; }
.editor label { margin-top: .75rem; }
.editor .opcao { display: flex; align-items: center; gap: .5rem; }
textarea:focus-visible, select:focus-visible { outline: 3px solid var(--laranja); outline-offset: 2px; }
button:hover, a.botao:hover { background: #ff7d33; }
button.secundario { background: transparent; color: #fff; border: 1px solid #6b6b6b; font-weight: 600; }
button.secundario:hover { border-color: var(--laranja); background: transparent; }

.aviso { background: #fff4ec; border: 1px solid var(--laranja); border-left-width: 5px; padding: .625rem .875rem; border-radius: .375rem; font-size: .875rem; }
.aviso-dev { background: #fff4ec; border: 1px solid var(--laranja); border-left-width: 5px; padding: .625rem .875rem; border-radius: .375rem; font-size: .875rem; }

/* Entrada: bloco preto com acento laranja, no centro da página. */
.login { max-width: 30rem; margin: 3rem auto; background: var(--preto); color: #fff; border-radius: .75rem; padding: 2rem; border-top: 5px solid var(--laranja); }
.login h1 { color: #fff; margin-bottom: .25rem; }
.login .lema { color: #bdbdbd; margin: 0 0 1.5rem; }
.login form { display: grid; gap: 1rem; }
.login label { color: #e5e5e5; }
.login input[type=text], .login input[type=email] { width: 100%; min-width: 0; border-color: #4a4a4a; background: var(--grafite); color: #fff; }
.login button { width: 100%; padding: .75rem; }
.login .aviso-dev { background: var(--grafite); border-color: #4a4a4a; border-left-color: var(--laranja); color: #e5e5e5; margin-bottom: 1.25rem; }
.login .erro { color: #ffb4a2; }

.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* Painel do projeto */
.etapa { margin-bottom: 2rem; }
.etapa-titulo { display: inline-block; padding: .125rem .75rem; background: var(--preto); color: #fff; border-left: 5px solid var(--laranja); border-radius: .25rem; font-size: 1rem; letter-spacing: .03em; }
.tipo h3 { margin: 0; font-size: 1.0625rem; }
.tipo-cabecalho { display: flex; align-items: center; gap: .625rem; margin-bottom: .25rem; }
.depende { margin: 0 0 .5rem; color: var(--texto-suave); font-size: .875rem; }
.selo { padding: .0625rem .5rem; border-radius: 999px; background: #e5e5e5; color: var(--texto-suave); font-size: .75rem; font-weight: 700; }

/* Conteúdo de versão: texto longo, de origem não confiável. Quebra em vez de estourar a largura. */
pre.conteudo { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font: inherit; }
blockquote.comentario { margin: .375rem 0 0; padding-left: .75rem; border-left: 3px solid var(--borda); color: var(--texto-suave); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Sugerir Canvas com IA */
[hidden] { display: none !important; }
.ia h2, .editor h2 { margin-top: 0; }
.aviso-ia { padding: .6rem .8rem; border-left: 4px solid #c2410c; background: #fff7ed; }
.aviso-forte { border-color: #c2410c; }
.sugestao { border-top: 1px solid #d6d3d1; padding-top: .75rem; margin-top: .75rem; }
.sugestao .itens { margin: .25rem 0 .5rem; padding-left: 1.1rem; }
.sugestao .decisao { display: flex; gap: 1rem; flex-wrap: wrap; border: 0; padding: 0; }
.selo-tipo { display: inline-block; font-size: .75rem; font-weight: 600; padding: 0 .4rem; border-radius: 3px; background: #e7e5e4; }
.selo-tipo[data-tipo="DITO"] { background: #dcfce7; }
.selo-tipo[data-tipo="INFERIDO"] { background: #fef9c3; }
.selo-tipo[data-tipo="A_CONFIRMAR"] { background: #fee2e2; }
.contradicao { margin: .5rem 0; }

/* Insumos: texto de documento exibido como veio, sem estourar a largura da tela. */
.texto-insumo { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font: inherit; }

/* Estimativa e consumo do preenchimento assistido: tabelas densas, rolam na horizontal em telas estreitas. */
.estimativa, [data-secao="medicao"] { overflow-x: auto; }
.custo-resumo { margin: 0 0 .5rem; }
.detalhes-consumo { margin-top: .5rem; }
.detalhes-consumo > summary { cursor: pointer; font-weight: 600; }
.detalhes-consumo > summary:focus-visible { outline: 3px solid var(--laranja); outline-offset: 2px; }
.detalhes-consumo[open] > summary { margin-bottom: .5rem; }
table.tabela { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.tabela th, table.tabela td { text-align: left; padding: .375rem .625rem; border-bottom: 1px solid var(--borda); vertical-align: top; }
table.tabela tbody th { font-weight: 600; white-space: nowrap; }
table.tabela tfoot th, table.tabela tfoot td { font-weight: 600; border-bottom: 0; }

/* Painel por etapa (ADR 0013): prontidão, pendências e marcos. O estado nunca depende só de cor: há sempre o texto. */
.etapa-titulo .selo { margin-left: .5rem; vertical-align: middle; }
.selo[data-pronta="true"], .selo[data-estado="ATINGIDO"] { background: #dcfce7; color: #14532d; }
.selo[data-pronta="false"], .selo[data-estado="PENDENTE"] { background: #fef9c3; color: #713f12; }
.selo[data-estado="RECUSADO"] { background: #fee2e2; color: #7f1d1d; }
/* Estado de uma conexão externa. "Configurada" é registrada, não testada: fica neutra, só "conectada" é verde. */
.selo[data-estado="conectada"] { background: #dcfce7; color: #14532d; }
.selo[data-estado="configurada"] { background: #dbeafe; color: #1e3a8a; }
.selo[data-estado="erro"] { background: #fee2e2; color: #7f1d1d; }
.conexao h3 { margin: 0 0 .25rem; font-size: 1rem; }
.conexao { min-width: 0; overflow-wrap: anywhere; }
.conexao form.linha > label { min-width: 0; max-width: 100%; }
.conexao input[type=text], .conexao select { min-width: 0; width: 100%; max-width: 100%; }
.conexao button.secundario { color: var(--texto); }
.situacao { margin: .5rem 0 1rem; }
.situacao p { margin: .25rem 0; }
.pendencias { margin: .25rem 0; padding-left: 1.25rem; list-style: disc; }
.cartao.marco { border-left: 5px solid var(--laranja); }
.marco .historico { margin: .5rem 0; }
.marco form + form { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--borda); }

/* Estrutura da aplicação: navegação persistente e conteúdo com contexto do projeto. */
html { scroll-padding-top: 5rem; }
.pular-conteudo { position: fixed; top: -5rem; left: 1rem; z-index: 100; padding: .75rem; background: white; }
.pular-conteudo:focus { top: .5rem; }
.barra-lateral { position: fixed; inset: 0 auto 0 0; width: 256px; background: #151515; color: #f5f5f5; padding: 1.5rem 1rem 1rem; display: flex; flex-direction: column; z-index: 30; overflow-y: auto; }
.barra-lateral .marca { font-size: 1.5rem; padding: 0 .5rem 1rem; }
.barra-lateral nav[aria-label="Menu principal"] { display: block; max-width: none; margin: 0; padding: 0; }
.barra-lateral nav[aria-label="Menu principal"] a { display: flex; align-items: center; gap: .75rem; color: #d8d8d8; background: transparent; border: 0; border-left: 3px solid transparent; border-radius: .375rem; padding: .65rem .625rem; margin: .15rem 0; font-size: .875rem; font-weight: 450; text-decoration: none; }
.barra-lateral nav[aria-label="Menu principal"] a:hover { background: #282828; color: white; }
.barra-lateral nav[aria-label="Menu principal"] a[aria-current="page"] { background: #4c2916; border-left-color: var(--laranja); color: #fff3e8; }
.icone { width: 20px; height: 20px; flex: 0 0 20px; }
.menu-grupo { text-transform: uppercase; font-size: .6875rem; letter-spacing: .09em; color: #b6b6b6; margin: 1.5rem .75rem .5rem; }
.contexto-menu { border-block: 1px solid #444; margin: 1.25rem .5rem; padding: 1rem 0; }
.contexto-menu > span { display: block; font-size: .6875rem; color: #aaa; padding-left: .5rem; }
.barra-lateral nav .contexto-menu a { font-size: .8125rem; padding: .4rem; border: 1px solid #555; margin: .25rem 0 .75rem; overflow-wrap: anywhere; }
.rodape-lateral { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: auto; padding: 1rem .5rem 0; border-top: 1px solid #444; }
.conta-menu { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .75rem; color: #d5d5d5; }
.rodape-lateral form { width: 100%; }
.rodape-lateral button { width: 100%; font-size: .8125rem; padding: .4rem; }
.avatar { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: #e5e3df; color: #333; font-size: .875rem; font-weight: 700; }
.rodape-lateral .avatar { background: var(--laranja); color: #111; }
.area-trabalho { margin-left: 256px; min-width: 0; }
.topo-trabalho { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 72px; padding: 1rem 2rem; background: #faf9f7; border-bottom: 1px solid var(--borda); }
.caminho-topo { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .8125rem; color: var(--texto-suave); }
.caminho-topo a { color: inherit; text-decoration: none; }
.caminho-topo a:hover { text-decoration: underline; }
.com-lateral main { max-width: 1440px; margin: 0 auto; padding: 1.75rem 2rem 3rem; min-width: 0; }
.com-lateral h1 { font-size: clamp(1.5rem, 2.1vw, 2rem); letter-spacing: -.025em; margin-bottom: .375rem; }
.com-lateral .cartao { border-radius: .625rem; padding: 1.25rem; }
.abrir-menu { display: none; }
.sobretitulo { color: var(--laranja-escuro); font-size: .6875rem; letter-spacing: .09em; text-transform: uppercase; font-weight: 750; margin: 0 0 .375rem; }
.titulo-pagina { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.75rem; }
.titulo-pagina .botao { white-space: nowrap; font-size: .875rem; }
.indicadores { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.indicador { display: flex; align-items: center; gap: 1rem; }
.indicador .icone { width: 30px; height: 30px; flex-basis: 30px; color: #666; }
.indicador strong { display: block; font-size: 1.875rem; line-height: 1.15; }
.indicador span { font-size: .8125rem; color: var(--texto-suave); }
.trilho-etapas { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); list-style: none; padding: .75rem 0; margin: 0; gap: .5rem; }
.trilho-etapas li { text-align: center; position: relative; min-width: 0; }
.trilho-etapas li::before { content: ''; position: absolute; top: 16px; height: 2px; background: var(--borda); width: calc(100% + .5rem); left: 50%; }
.trilho-etapas li:last-child::before { display: none; }
.trilho-etapas a { position: relative; color: var(--texto); text-decoration: none; display: grid; justify-items: center; gap: .625rem; font-size: .8125rem; }
.ponto-etapa { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #c7c5c1; background: white; font-size: .8125rem; }
.trilho-etapas .ponto-etapa .icone { width: 16px; height: 16px; flex-basis: 16px; }
.concluida .ponto-etapa { border-color: var(--laranja); background: var(--laranja); color: #111; }
/* Em andamento: anel laranja com miolo (o estado também está no texto do selo, nunca só na cor). */
.em-andamento .ponto-etapa { border-color: var(--laranja); box-shadow: inset 0 0 0 5px #fff, inset 0 0 0 11px var(--laranja); }
.trilho-etapas li.concluida::before { background: var(--laranja); }
.trilho-etapas .em-andamento .selo { background: #ffedd5; color: #9a3412; }
.trilho-etapas .selo { display: inline-block; margin-top: .5rem; font-weight: 450; }
.trilho-etapas .concluida .selo, .selo[data-situacao="Aprovado"] { background: #dcfce7; color: #14532d; }
.selo[data-situacao="Rascunho"] { background: #ffedd5; color: #9a3412; }
.visao-colunas { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1rem; }
.visao-colunas > *, .indicadores > * { min-width: 0; }
.tabela-responsiva { overflow-x: auto; }
.tabela td a { text-decoration: none; font-weight: 550; }
.resumo-marcos li { display: flex; align-items: center; gap: .5rem; font-size: .8125rem; }
.resumo-marcos a { color: var(--texto); text-decoration: none; flex: 1; }
.resumo-conexoes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.resumo-conexoes > div { border-right: 1px solid var(--borda); display: grid; grid-template-columns: auto 1fr; gap: .375rem .75rem; font-size: .8125rem; padding-right: .75rem; }
.resumo-conexoes > div:last-child { border: 0; }
.resumo-conexoes .icone { grid-row: span 3; color: var(--texto-suave); }
.resumo-conexoes .selo { justify-self: start; }
.configurar-conexoes { border-top: 1px solid var(--borda); padding-top: .875rem; }
.configurar-conexoes summary { cursor: pointer; color: var(--laranja-escuro); font-weight: 600; font-size: .875rem; }
.configurar-conexoes[open] summary { margin-bottom: 1rem; }
.com-lateral main > .editor { max-width: 900px; }
.com-lateral main input[type=text], .com-lateral main input[type=email], .com-lateral main select, .com-lateral main textarea { max-width: 100%; }
.com-lateral main label { min-width: 0; }
.com-lateral main textarea { width: 100%; }
@media (max-width: 1150px) {
  .visao-colunas { grid-template-columns: 1fr; }
  .indicadores { gap: .625rem; }
  .indicador { gap: .5rem; }
  .indicador .icone { display: none; }
}
@media (max-width: 900px) {
  .barra-lateral { display: none; top: 68px; width: min(300px, 90vw); }
  .menu-aberto .barra-lateral { display: flex; box-shadow: 12px 0 30px #0003; }
  .area-trabalho { margin-left: 0; }
  .topo-trabalho { position: sticky; top: 0; z-index: 40; padding: .75rem 1rem; min-height: 68px; }
  .abrir-menu { display: inline-flex; gap: .5rem; align-items: center; font-size: .8125rem; padding: .5rem .75rem; flex-shrink: 0; }
  .caminho-topo { font-size: .75rem; gap: .25rem; }
  .topo-trabalho > .avatar { display: none; }
  .com-lateral main { padding: 1.25rem 1rem 2rem; }
  .titulo-pagina { align-items: start; flex-wrap: wrap; }
  .indicadores { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trilho-etapas { display: flex; flex-direction: column; gap: 1rem; }
  .trilho-etapas li { display: flex; align-items: center; justify-content: space-between; text-align: left; gap: .5rem; }
  .trilho-etapas a { display: flex; gap: .75rem; }
  .trilho-etapas li::before { display: none; }
  .trilho-etapas .selo { margin: 0; }
  .resumo-conexoes { grid-template-columns: 1fr; }
  .resumo-conexoes > div { border-right: 0; border-bottom: 1px solid var(--borda); padding: .5rem 0; }
  .com-lateral main input[type=text], .com-lateral main input[type=email] { min-width: 0; width: 100%; }
  .com-lateral main form.linha > label { width: 100%; }
  .com-lateral main .tipo-cabecalho { flex-wrap: wrap; }
}

/* Acabamento da visão geral */
.botao.com-icone { display: inline-flex; align-items: center; gap: .5rem; }
.botao.com-icone .icone { width: 18px; height: 18px; flex-basis: 18px; }
.selo-menu { margin-left: auto; min-width: 22px; padding: 0 .4rem; border-radius: 999px; background: var(--laranja); color: var(--preto); font-size: .75rem; font-weight: 800; text-align: center; }
.rodape-lateral { flex-wrap: nowrap; }
.rodape-lateral form { width: auto; }
.rodape-lateral button.sair { display: inline-flex; align-items: center; gap: .375rem; width: auto; padding: .25rem .375rem; background: transparent; color: #d5d5d5; font-weight: 500; }
.rodape-lateral button.sair:hover { color: #fff; background: transparent; }
.rodape-lateral button.sair .icone { width: 16px; height: 16px; flex-basis: 16px; }
.celula-artefato { display: flex; align-items: center; gap: .625rem; }
.celula-artefato .icone { width: 18px; height: 18px; flex-basis: 18px; color: var(--texto-suave); }
.celula-artefato a { color: var(--texto); }
.selo[data-situacao="Ajuste solicitado"] { background: #dbeafe; color: #1e3a8a; }
.botao-claro { display: inline-block; margin-top: .5rem; padding: .4rem 1rem; border: 1px solid var(--borda); border-radius: .375rem; background: #f3f2ef; color: var(--texto); font-size: .8125rem; font-weight: 600; text-decoration: none; }
.botao-claro:hover { border-color: var(--laranja); }
.resumo-conexoes > div { grid-template-columns: 40px 1fr; align-items: center; }
.resumo-conexoes .marca-ferramenta { grid-row: span 4; width: 36px; height: 36px; color: var(--texto-suave); }
.resumo-conexoes strong { font-size: .9375rem; }
.categoria-conexao { color: var(--texto-suave); }
.rodape-integracoes { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--borda); padding: .75rem 0; }
.rodape-integracoes .depende { margin: 0; }
.link-configurar { font-weight: 600; font-size: .875rem; }
.configurar-conexoes { border-top: 0; padding-top: 0; }
.configurar-conexoes > summary { display: none; }
.configurar-conexoes[open] > summary { display: none; }
.rodape-lateral .conta-menu { overflow: hidden; }
.rodape-lateral .usuario { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Seletores de contexto (cliente e projeto) e conta no rodapé da lateral. */
.seletor-contexto { display: grid; gap: .625rem; margin: 1.25rem .25rem; padding: 1rem .5rem; border-block: 1px solid #444; }
.seletor-contexto label { gap: .25rem; color: #c9c9c9; font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.seletor-contexto select { width: 100%; max-width: 100%; padding: .45rem .5rem; background: #232323; color: #f5f5f5; border: 1px solid #5a5a5a; font-size: .8125rem; text-transform: none; letter-spacing: 0; font-weight: 450; }
.seletor-contexto select:focus-visible { outline: 3px solid var(--laranja); outline-offset: 2px; }
.seletor-contexto button { justify-self: start; padding: .3rem .75rem; font-size: .75rem; color: #f0f0f0; border-color: #777; }
.js .so-sem-js { display: none; }
.perfis-conta { display: block; margin-top: .125rem; color: #b6b6b6; font-size: .6875rem; overflow-wrap: anywhere; }
.rodape-lateral .usuario { font-weight: 600; color: #f0f0f0; }

/* Formulário de novo artefato e ações de página. */
.formulario-novo { display: grid; gap: 1rem; max-width: 40rem; }
.formulario-novo select, .formulario-novo input[type=text] { width: 100%; min-width: 0; }
.acoes-formulario { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: 0; }
.acoes-formulario .botao-claro { margin-top: 0; }
.com-lateral main .titulo-pagina + .erro { margin-top: 0; }
.cartao .tabela-responsiva + .botao-claro { margin-top: .75rem; }
.resumo-conexoes .depende { grid-column: 2; margin: 0; }
.etapa .situacao + p { margin-top: .5rem; }
.rodape-lateral .usuario { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.25; }
