:root {
  --bg: #EAF3FC;
  --papel: #FBFDFF;
  --teal: #1E9BAA;
  --teal-escuro: #137583;
  --teal-claro: #D3EEF1;
  --ouro: #C68F3F;
  --ouro-claro: #F5EAD9;
  --text-hi: #14303A;
  --text-mid: #43606B;
  --text-low: #6F8893;
  --linha: #CFDFEA;
  --erro: #B8403A;
  --erro-claro: #F8E3E1;
  --raio: 12px;
  --raio-g: 20px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-hi);
  font: 400 15px/1.55 Inter, system-ui, sans-serif;
}
h1, h2, h3 { font-family: 'Baloo 2', Inter, sans-serif; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: 2rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: var(--teal-escuro); }
:focus-visible { outline: 3px solid var(--ouro); outline-offset: 2px; border-radius: 4px; }
.fraco { color: var(--text-low); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Topo do painel ---------- */
.topo {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--linha);
  background: var(--bg);
}
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-hi); }
.marca strong { font-family: 'Baloo 2', sans-serif; font-size: 1.1rem; letter-spacing: .02em; display: block; line-height: 1; }
.marca small { color: var(--text-low); font-size: .78rem; }
.topo nav { display: flex; align-items: center; gap: 18px; font-weight: 500; }
.topo nav a { color: var(--text-mid); text-decoration: none; }
.topo nav a:hover { color: var(--teal-escuro); }
.quem { color: var(--text-low); font-size: .9rem; }
.conteudo { max-width: 1180px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 64px; }

/* ---------- Cartões e formulários ---------- */
.painel-card {
  background: var(--papel);
  border: 1px solid var(--linha);
  border-radius: var(--raio-g);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.campo { margin-bottom: 16px; }
.campo label { display: block; font-weight: 600; margin-bottom: 6px; }
.campo .obr { font-weight: 500; font-size: .8rem; color: var(--ouro); margin-left: 4px; }
.ajuda { color: var(--text-low); font-size: .88rem; margin: -2px 0 8px; }
input[type=text], input[type=email], input[type=password], input[type=number], input:not([type]), select, textarea {
  width: 100%;
  font: inherit; color: var(--text-hi);
  background: #fff;
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  padding: 10px 12px;
}
textarea { resize: vertical; min-height: 44px; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-claro); }
input[type=color] { width: 64px; height: 40px; padding: 2px; border: 1px solid var(--linha); border-radius: 10px; background: #fff; }
.opcoes { display: flex; flex-wrap: wrap; gap: 8px; }
.opcao { display: inline-flex; align-items: center; gap: 8px; font-weight: 400 !important; background: #fff; border: 1px solid var(--linha); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.opcao:has(input:checked) { border-color: var(--teal); background: var(--teal-claro); }
.com-erro input, .com-erro textarea, .com-erro select { border-color: var(--erro); }
.erro-campo { color: var(--erro); font-size: .88rem; margin: 6px 0 0; }
.armadilha { position: absolute; left: -9999px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 .95rem/1 Inter, sans-serif;
  padding: 12px 18px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
}
.btn-primario { background: var(--teal); color: #fff; }
.btn-primario:hover { background: var(--teal-escuro); }
.btn-secundario { background: #fff; color: var(--teal-escuro); border-color: var(--teal); }
.btn-secundario:hover { background: var(--teal-claro); }
.btn-fantasma { background: transparent; color: var(--text-mid); padding-left: 0; padding-right: 0; text-decoration: underline; text-underline-offset: 3px; }
.acoes-form { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.acao-discreta { margin-top: 10px; }

.aviso { border-radius: var(--raio); padding: 12px 16px; margin-bottom: 18px; border: 1px solid; }
.aviso p { margin-bottom: 8px; }
.aviso-ok { background: var(--teal-claro); border-color: #A6DAE0; color: var(--teal-escuro); }
.aviso-erro { background: var(--erro-claro); border-color: #EDBDB9; color: #7E2A26; }
.aviso-sistema { background: var(--ouro-claro); border-color: #E8D2B0; color: #6B4A1B; display: flex; align-items: center; gap: 10px; }
.girando { width: 16px; height: 16px; flex: none; border: 2px solid #E0C49A; border-top-color: var(--ouro); border-radius: 50%; animation: gira .9s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

.selo { display: inline-block; font-size: .82rem; font-weight: 600; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.selo-equipe { background: var(--ouro); color: #fff; }
.selo-cliente { background: #fff; color: var(--text-mid); border: 1px solid var(--linha); }
.selo-sistema { background: var(--teal-claro); color: var(--teal-escuro); }

/* ---------- Lista de projetos ---------- */
.cabeca-pagina { margin-bottom: 22px; }
.grade-lista { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.lista-projetos { list-style: none; margin: 0; padding: 0; border: 1px solid var(--linha); border-radius: var(--raio-g); background: var(--papel); overflow: hidden; }
.lista-projetos li + li { border-top: 1px solid var(--linha); }
.lista-projetos a { display: grid; grid-template-columns: 8px 1fr auto auto; align-items: center; gap: 16px; padding: 16px 20px; color: inherit; text-decoration: none; }
.lista-projetos a:hover { background: #fff; }
.lista-projetos .cor { width: 8px; height: 36px; border-radius: 4px; }
.lista-projetos .nome strong { display: block; }
.lista-projetos .nome small { color: var(--text-low); }
.lista-projetos .etapa { font-family: 'Baloo 2', sans-serif; font-weight: 700; color: var(--text-mid); }
.vazio { border: 1.5px dashed var(--linha); border-radius: var(--raio-g); padding: 40px; text-align: center; color: var(--text-mid); }

/* ---------- Projeto ---------- */
.cabeca-projeto { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.cabeca-projeto h1 { margin-bottom: 2px; position: relative; padding-left: 18px; }
.cabeca-projeto h1::before { content: ''; position: absolute; left: 0; top: .18em; bottom: .22em; width: 6px; border-radius: 3px; background: var(--cor-cliente); }
.voltar { font-size: .9rem; text-decoration: none; color: var(--text-low); display: inline-block; margin-bottom: 8px; }
.voltar::before { content: '‹ '; color: var(--teal); font-weight: 700; }

/* Trilha de etapas: lida como um cronograma de obra */
.trilha {
  list-style: none; margin: 0 0 26px; padding: 0;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
  counter-reset: etapa;
}
.trilha li { counter-increment: etapa; }
.trilha li::before {
  content: ''; display: block; height: 10px; border-radius: 3px;
  background: repeating-linear-gradient(135deg, #D8E6F1 0 6px, #CDDDEA 6px 12px);
}
.trilha li.feita::before { background: var(--teal); }
.trilha li.atual::before { background: repeating-linear-gradient(135deg, var(--ouro) 0 6px, #D9A860 6px 12px); }
.trilha span { display: block; margin-top: 8px; font-size: .82rem; color: var(--text-low); }
.trilha span::before { content: counter(etapa) '. '; }
.trilha .feita span { color: var(--text-mid); }
.trilha .atual span { color: var(--text-hi); font-weight: 600; }

.grade-projeto { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.etapa-card header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.etapa-card.futura { background: transparent; border-style: dashed; }
.link-envio { background: var(--bg); border-radius: var(--raio); padding: 14px; }
.link-envio code { display: block; font-size: .82rem; color: var(--text-mid); word-break: break-all; margin-bottom: 10px; }
.link-envio .botoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
details summary { cursor: pointer; font-weight: 600; color: var(--teal-escuro); padding: 4px 0; }
.respostas { margin: 12px 0 0; }
.respostas dt { font-weight: 600; margin-top: 14px; }
.respostas dd { margin: 4px 0 0; color: var(--text-mid); max-width: 70ch; }

.editor-roteiro .bloco-edit { border: none; padding: 0; margin: 22px 0 0; }
.titulo-bloco { font-family: 'Baloo 2', sans-serif !important; font-size: 1.1rem !important; font-weight: 700; border-color: transparent !important; background: transparent !important; padding-left: 0 !important; }
.titulo-bloco:focus { border-color: var(--teal) !important; background: #fff !important; padding-left: 12px !important; }
.pergunta-edit { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 14px 0; border-top: 1px solid var(--linha); }
.pergunta-edit .num { font-family: 'Baloo 2', sans-serif; font-weight: 800; color: var(--teal); font-size: 1.1rem; }
.pergunta-edit textarea { margin-bottom: 6px; }
.pergunta-edit input { font-size: .9rem; }
.pergunta-edit.nova .num { color: var(--text-low); }
.objetivo { font-size: .84rem; color: var(--text-low); margin: 6px 0 4px; }
.remover { font-size: .84rem; color: var(--text-low); display: inline-flex; gap: 6px; align-items: center; }
.regerar { margin-top: 18px; border-top: 1px solid var(--linha); padding-top: 12px; }

.lista-arquivos, .lista-simples { list-style: none; margin: 0; padding: 0; }
.lista-arquivos li, .lista-simples li { padding: 8px 0; border-top: 1px solid var(--linha); }
.lista-arquivos li:first-child, .lista-simples li:first-child { border-top: 0; }
.lista-arquivos .fraco { display: block; font-size: .82rem; }
.historico { list-style: none; margin: 0; padding: 0; font-size: .9rem; color: var(--text-mid); }
.historico li { padding: 8px 0 8px 14px; border-left: 2px solid var(--linha); }
.historico time { display: block; font-size: .78rem; color: var(--text-low); }
.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.caixa-login { max-width: 400px; margin: 40px auto; background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio-g); padding: 28px; }

/* ---------- Páginas do cliente ---------- */
.publico { background: var(--bg); }
.topo-publico { max-width: 760px; margin: 0 auto; padding: 24px 20px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.marca-publica { display: flex; align-items: center; gap: 8px; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 1.25rem; color: var(--text-hi); }
.para { color: var(--text-low); font-size: .9rem; }
.folha { max-width: 760px; margin: 0 auto; padding: 28px 20px 40px; }
.intro h1 { font-size: clamp(2rem, 5vw, 2.6rem); }
.intro p { font-size: 1.05rem; color: var(--text-mid); max-width: 62ch; }
.intro .nota { font-size: .92rem; color: var(--text-low); }
.form-publico .secao {
  background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio-g);
  padding: 8px 24px 10px; margin: 0 0 18px;
}
.form-publico legend {
  font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 1.2rem;
  background: var(--teal); color: #fff; padding: 4px 16px; border-radius: 999px;
}
.form-publico .secao > .campo:first-of-type { margin-top: 14px; }
.form-publico .num { color: var(--teal); font-family: 'Baloo 2', sans-serif; font-weight: 800; }
.bloco-msg { background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio-g); padding: 36px; margin-top: 30px; }
.bloco-msg p { color: var(--text-mid); font-size: 1.05rem; max-width: 58ch; }
.rodape-publico { text-align: center; color: var(--text-low); font-size: .85rem; padding: 0 20px 40px; }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  .grade-lista, .grade-projeto, .grade-2 { grid-template-columns: 1fr; }
  .trilha { grid-template-columns: repeat(4, 1fr); row-gap: 14px; }
}
@media (max-width: 560px) {
  h1 { font-size: 1.6rem; }
  .lista-projetos a { grid-template-columns: 8px 1fr; }
  .lista-projetos .etapa, .lista-projetos .selo { grid-column: 2; justify-self: start; }
  .cabeca-projeto { flex-direction: column; align-items: flex-start; }
  .form-publico .secao { padding: 8px 16px 10px; }
  .acoes-form { flex-direction: column-reverse; }
  .acoes-form .btn { width: 100%; }
  .topo nav .quem { display: none; }
}
@media (prefers-reduced-motion: reduce) { .girando { animation: none; } }
