/* estilo.css — aparência da aplicação Fiscal de Obras (mobile-first). */

:root {
  --laranja: #e8590c;
  --amarelo: #f5b301;
  --azul: #1c7ed6;
  --vermelho: #d33;
  --fundo: #f4f6f8;
  --texto: #1f2937;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--texto);
  background: var(--fundo);
  height: 100%;
}

.escondida { display: none !important; }

/* ---------- Ecrã de login ---------- */
#ecra-login {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1c3d5a, #2b6cb0);
}
.caixa-login {
  background: #fff; padding: 32px 28px; border-radius: 14px;
  width: 90%; max-width: 360px; text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.caixa-login h2 { margin: 0 0 4px; color: #1c3d5a; }
.caixa-login .sub { color: #666; font-size: 14px; margin: 0 0 18px; }
.caixa-login input {
  width: 100%; padding: 14px; font-size: 22px; text-align: center;
  letter-spacing: 8px; border: 2px solid #ddd; border-radius: 10px;
  margin-bottom: 14px;
}
.caixa-login button {
  width: 100%; padding: 14px; font-size: 16px; font-weight: 600;
  background: #1c7ed6; color: #fff; border: none; border-radius: 10px; cursor: pointer;
}
.msg-login { margin-top: 12px; font-size: 14px; color: #b30000; min-height: 18px; }

/* ---------- Barra de topo ---------- */
#barra-topo {
  background: #1c3d5a; color: #fff; padding: 10px 14px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  position: sticky; top: 0; z-index: 1000;
}
#barra-topo .titulo { font-weight: 700; font-size: 17px; }
#barra-topo .subtitulo { font-weight: 400; font-size: 12px; color: #cbd5e0; }
.abas { display: flex; gap: 6px; }
.aba {
  background: transparent; color: #cbd5e0; border: 1px solid #4a6a8a;
  padding: 7px 14px; border-radius: 8px; font-size: 14px; cursor: pointer;
}
.aba.ativa { background: #fff; color: #1c3d5a; font-weight: 600; border-color: #fff; }
.contadores { font-size: 12px; color: #cbd5e0; margin-left: auto; }
.contadores .vermelho { color: #ff9b9b; }
.sel-fiscal { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.sel-fiscal select { padding: 5px; border-radius: 6px; border: 1px solid #ddd; font-size: 13px; }

/* ---------- Conteúdo ---------- */
#conteudo { padding: 12px; }

.barra-acoes {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px;
}
.barra-acoes input[type=text] {
  flex: 1; min-width: 160px; padding: 10px; font-size: 15px;
  border: 1px solid #ccc; border-radius: 8px;
}

/* Filtros tipo Excel */
.barra-filtros {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
  background: #fff; padding: 8px; border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.barra-filtros select {
  flex: 1; min-width: 120px; padding: 8px; font-size: 14px;
  border: 1px solid #ccc; border-radius: 8px; background: #fff;
}

.botao {
  padding: 9px 14px; font-size: 14px; border-radius: 8px;
  border: 1px solid #ccc; background: #fff; cursor: pointer;
}
.botao.destaque { background: #1c7ed6; color: #fff; border-color: #1c7ed6; font-weight: 600; }
.n-selecionados { color: #1c7ed6; font-weight: 600; font-size: 14px; }

/* ---------- Tabela ---------- */
.tabela-container { overflow-x: auto; background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 8px; background: #eef2f6;
  position: sticky; top: 0; cursor: pointer; white-space: nowrap; font-size: 12px;
  color: #4a5568; border-bottom: 2px solid #dbe2ea;
}
tbody td { padding: 8px; border-bottom: 1px solid #eef2f6; vertical-align: top; }
tbody tr.selecionada { background: #e8f1fd; }
tbody tr.atrasada { border-left: 3px solid var(--vermelho); }
tbody tr:hover { background: #f7fafc; }
.col-sel { width: 30px; text-align: center; }
.badge-nivel {
  display: inline-block; min-width: 18px; text-align: center;
  padding: 1px 5px; border-radius: 8px; font-size: 11px; font-weight: 700; color: #fff;
}
.nivel-0 { background: #b30000; }
.nivel-1 { background: #e8590c; }
.nivel-2 { background: #d97706; }
.nivel-3 { background: #f5b301; }
.nivel-4 { background: #1c7ed6; }
.nivel-5 { background: #5f3dc4; }
.nivel-6 { background: #495057; }
.nivel-50 { background: #adb5bd; }
.tarefas-extra { font-size: 11px; color: #888; margin-top: 2px; }
.tt { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; margin-right: 3px; white-space: nowrap; }
.dias-neg { color: #b30000; font-weight: 700; }
.dias-ok { color: #1c7ed6; }
.dias-none { color: #bbb; }

/* ---------- Mapa ---------- */
#vista-mapa { position: relative; }
#mapa { height: calc(100vh - 150px); min-height: 400px; border-radius: 10px; }
#legenda {
  position: absolute; right: 10px; top: 10px; z-index: 500;
  background: rgba(255,255,255,.95); padding: 10px 12px; border-radius: 8px;
  font-size: 12px; box-shadow: 0 1px 6px rgba(0,0,0,.2);
}
.bolinha { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; }
.rotulo-dias {
  font-size: 10px; font-weight: 700; text-align: center; line-height: 16px;
  border-radius: 8px; background: rgba(255,255,255,.9); box-shadow: 0 0 2px rgba(0,0,0,.3);
}
.rotulo-dias.neg { color: #b30000; }
.rotulo-dias.ok { color: #1c7ed6; }

/* Cluster */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
  background-color: rgba(28, 61, 90, 0.75);
}
.marker-cluster div {
  background-color: rgba(28, 61, 90, 0.9); color: #fff;
  font-weight: 700;
}

/* ---------- Relatórios ---------- */
.rel-aviso {
  background: #fff8e6; border: 1px solid #f5b301; color: #92400e;
  padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 10px;
}
.opc-word { font-size: 13px; display: inline-flex; gap: 5px; align-items: center; }
.sel-relatorio { padding: 5px; border-radius: 6px; border: 1px solid #ccc; font-size: 13px; }
.btn-recolha { background: #5f3dc4; color: #fff; border-color: #5f3dc4; }

/* ---------- Painel de detalhes ---------- */
#painel-detalhes {
  position: fixed; right: 0; top: 0; bottom: 0; width: 94%; max-width: 560px;
  background: #fff; z-index: 2000; box-shadow: -4px 0 20px rgba(0,0,0,.2);
  overflow-y: auto; padding: 18px;
}
#detalhes-fecho { float: right; cursor: pointer; font-size: 22px; color: #888; }
#detalhes-conteudo h3 { margin-top: 0; color: #1c3d5a; }
.linha { padding: 5px 0; font-size: 14px; border-bottom: 1px solid #f1f5f9; }
.botao-selecao { margin-top: 12px; padding: 10px; width: 100%; border-radius: 8px; border: 1px solid #ccc; cursor: pointer; }
.botao-selecao.sim { background: #e8f1fd; border-color: #1c7ed6; color: #1c7ed6; }

/* ---------- Recolha de campo ---------- */
.rec-campo { margin-bottom: 16px; }
.rec-campo label { display: block; font-size: 14px; margin-bottom: 4px; color: #1c3d5a; }
.btn-voz { background: #5f3dc4; color: #fff; border-color: #5f3dc4; margin-bottom: 6px; }
.rec-acoes-topo { margin: 12px 0; }
.rec-aviso-ok {
  background: #e8f8ee; border: 1px solid #2f9e63; color: #14532d;
  padding: 12px; border-radius: 10px; margin-bottom: 14px; font-size: 14px;
}
.capa-obra {
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px;
}
.capa-img {
  width: 100%; max-height: 240px; object-fit: cover; border-radius: 8px;
  border: 3px solid #1c7ed6;
}
.rec-pergunta { padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.rec-pergunta-texto { font-size: 14px; margin-bottom: 4px; }
.rec-escopo-texto, .rec-pergunta textarea, .rec-pergunta input[type=text], .rec-pergunta input[type=date] {
  width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px;
}
#rec-notas {
  width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 8px;
  font-size: 15px; min-height: 280px; resize: vertical;
}
#rec-transcricoes { font-size: 13px; }
.nota { font-size: 12px; padding: 6px 8px; border-radius: 6px; margin-top: 4px; }

/* ---------- Feed de mensagens ---------- */
#feed {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; z-index: 3000; display: none; max-width: 90%;
}
#feed.mostrar { display: block; }

/* ---------- Telemóvel ---------- */
@media (max-width: 640px) {
  #barra-topo .titulo { width: 100%; }
  .abas { width: 100%; }
  .aba { flex: 1; text-align: center; }
  .contadores { margin-left: 0; width: 100%; }
  #mapa { height: calc(100vh - 220px); }
  table { font-size: 12px; }
}
