/* =========================================================
   PrediGO! — tema visual
   Fontes: Geist (textos) e Sora (títulos e logo)
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Sora:wght@600;700;800&display=swap");

:root {
  /* Cores principais */
  --fundo: #EEF1F6;
  --marinho: #0F2A5C;
  --menu: #0A1A3A;
  --menu-ativo: #13305F;
  --destaque: #3DDBB0;
  --branco: #FFFFFF;

  /* Textos e bordas */
  --texto: #0F172A;
  --texto-suave: #5B6478;
  --texto-claro: #8A93A6;
  --borda: #E2E7EF;

  /* Situações */
  --em-dia-fundo: #E6F7F1;
  --em-dia-texto: #047857;
  --vence-fundo: #FEF3E2;
  --vence-texto: #B45309;
  --vencido-fundo: #FDECEC;
  --vencido-texto: #B91C1C;
  --info-fundo: #E8EDF6;
  --info-texto: #0F2A5C;

  /* Formas */
  --raio: 16px;
  --raio-pequeno: 10px;
  --sombra: 0 1px 2px rgba(15, 42, 92, 0.05), 0 8px 24px rgba(15, 42, 92, 0.07);

  /* Fontes */
  --fonte-texto: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fonte-titulo: "Sora", "Geist", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--fonte-texto);
  font-size: 15px;
  line-height: 1.5;
  background: var(--fundo);
  color: var(--texto);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .titulo-fonte {
  font-family: var(--fonte-titulo);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

a {
  color: var(--marinho);
}

svg {
  flex-shrink: 0;
}

/* O atributo hidden sempre esconde, mesmo em elementos com display próprio */
[hidden] {
  display: none !important;
}

/* Esconde a página até confirmar que há usuário logado */
.verificando body {
  visibility: hidden;
}

/* ---------- Estrutura: menu lateral + conteúdo ---------- */

.app {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

.menu {
  background: var(--menu);
  color: #C9D3E6;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 0 12px;
}

/* Menu lateral: logo com a frase, em cerca de 235px (a imagem já traz "Seu condomínio sempre em dia") */
.menu .logo {
  padding: 0;
  margin-bottom: 8px;
}

.menu .logo-imagem {
  width: 235px;
  max-width: 100%;
  height: auto;
}

/* Logo em imagem: altura definida, largura automática */
.logo-imagem {
  display: block;
  height: 40px;
  width: auto;
  max-width: 100%;
}

.menu-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
}

.menu-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--raio-pequeno);
  color: #C9D3E6;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.menu-links a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--branco);
}

.menu-links a.ativo {
  background: var(--menu-ativo);
  color: var(--branco);
  box-shadow: inset 3px 0 0 var(--destaque);
}

.menu-links svg {
  width: 20px;
  height: 20px;
  opacity: 0.9;
}

.contador {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #E5484D;
  color: var(--branco);
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.contador[hidden] {
  display: none;
}

.menu-rodape {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Assinatura VeschIA */

.assinatura {
  display: flex;
  align-items: center;
  justify-content: center;
}

.assinatura img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 8px;
}

.usuario {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.usuario small {
  color: var(--texto-claro);
  font-size: 0.75rem;
}

.usuario span {
  color: var(--branco);
  font-weight: 500;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usuario .usuario-organizacao {
  color: var(--branco);
  font-size: 14px;
  font-weight: 600;
}

.usuario .usuario-papel {
  color: #8FA3C7;
  font-size: 12px;
  font-weight: 400;
}

.usuario.com-organizacao #email-usuario {
  color: #8FA3C7;
  font-size: 13px;
  font-weight: 400;
}

.conteudo {
  padding: 28px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topo h1 {
  font-size: 1.5rem;
  color: var(--marinho);
}

/* ---------- Botões ---------- */

.botao {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--raio-pequeno);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.botao:hover {
  transform: translateY(-1px);
}

.botao:focus-visible,
.menu-links a:focus-visible {
  outline: 3px solid var(--destaque);
  outline-offset: 2px;
}

.botao:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.botao svg {
  width: 18px;
  height: 18px;
}

.botao-destaque {
  background: var(--destaque);
  color: var(--menu);
}

.botao-destaque:hover {
  box-shadow: 0 6px 18px rgba(61, 219, 176, 0.35);
}

.botao-claro {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--branco);
}

.botao-claro:hover {
  background: rgba(255, 255, 255, 0.16);
}

.botao-primario {
  background: var(--marinho);
  color: var(--branco);
}

.botao-primario:hover {
  box-shadow: 0 6px 18px rgba(15, 42, 92, 0.25);
}

.botao-contorno {
  background: var(--branco);
  border-color: var(--borda);
  color: var(--marinho);
}

.botao-contorno:hover {
  border-color: var(--marinho);
}

.botao-pequeno {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.875rem;
}

.botao-sair {
  width: 100%;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.18);
  color: #C9D3E6;
}

.botao-sair:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--branco);
}

/* ---------- Cartões ---------- */

.cartao {
  background: var(--branco);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  padding: 20px;
}

.cartao-cabecalho {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.cartao-cabecalho h2 {
  font-size: 1.05rem;
  color: var(--marinho);
}

.cartao-cabecalho a {
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.cartao-cabecalho a:hover {
  text-decoration: underline;
}

/* ---------- Etiquetas de situação (pílulas) ---------- */

.pilula {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.pilula::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.pilula.em-dia  { background: var(--em-dia-fundo);  color: var(--em-dia-texto); }
.pilula.vence   { background: var(--vence-fundo);   color: var(--vence-texto); }
.pilula.vencido { background: var(--vencido-fundo); color: var(--vencido-texto); }

/* ---------- Tabelas ---------- */

.tabela-rolagem {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -20px;
  padding: 0 20px;
}

.tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.tabela th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--texto-claro);
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--borda);
  white-space: nowrap;
}

.tabela td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--borda);
  vertical-align: middle;
}

.tabela .sem-quebra {
  white-space: nowrap;
}

.tabela tr:last-child td {
  border-bottom: none;
}

.tabela th:first-child,
.tabela td:first-child {
  padding-left: 0;
}

.tabela th:last-child,
.tabela td:last-child {
  padding-right: 0;
  text-align: right;
}

.principal {
  font-weight: 600;
  color: var(--texto);
}

.secundario {
  display: block;
  color: var(--texto-suave);
  font-size: 0.82rem;
}

.texto-vencido {
  color: var(--vencido-texto);
  font-weight: 600;
}

/* ---------- Títulos de página e busca ---------- */

.topo-texto {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topo-texto p {
  color: var(--texto-suave);
}

.busca {
  position: relative;
  max-width: 420px;
}

.busca svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--texto-claro);
  pointer-events: none;
}

.busca input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--borda);
  border-radius: var(--raio-pequeno);
  background: var(--branco);
  font: inherit;
  color: var(--texto);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.busca input::placeholder {
  color: var(--texto-claro);
}

.busca input:focus {
  outline: none;
  border-color: var(--marinho);
  box-shadow: 0 0 0 3px rgba(15, 42, 92, 0.12);
}

/* ---------- Filtros em botões agrupados ---------- */

.filtros {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--branco);
  border: 1px solid var(--borda);
  border-radius: 12px;
  align-self: flex-start;
}

.filtro {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--texto-suave);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.filtro:hover {
  background: var(--fundo);
  color: var(--texto);
}

.filtro:focus-visible {
  outline: 3px solid var(--destaque);
  outline-offset: 1px;
}

.filtro.ativo {
  background: var(--marinho);
  color: var(--branco);
}

.quantidade {
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--fundo);
  color: var(--texto-suave);
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filtro.ativo .quantidade {
  background: rgba(255, 255, 255, 0.16);
  color: var(--branco);
}

/* ---------- Campos de formulário ---------- */

.campo-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.campo-form label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--texto);
}

.campo-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--borda);
  border-radius: var(--raio-pequeno);
  background: var(--branco);
  font: inherit;
  color: var(--texto);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.campo-form input:focus {
  outline: none;
  border-color: var(--marinho);
  box-shadow: 0 0 0 3px rgba(15, 42, 92, 0.12);
}

.botao-largo {
  width: 100%;
  min-height: 48px;
}

/* ---------- Link de voltar ---------- */

.link-voltar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  align-self: flex-start;
  color: var(--texto-suave);
  font-weight: 600;
  text-decoration: none;
}

.link-voltar:hover {
  color: var(--marinho);
}

.link-voltar svg {
  width: 18px;
  height: 18px;
}

/* ---------- Grade de rótulo e valor ---------- */

.dados-grade {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
}

.dados-grade div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dados-grade .inteiro {
  grid-column: 1 / -1;
}

.dados-grade dt {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--texto-claro);
}

.dados-grade dd {
  color: var(--texto);
  font-weight: 500;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.dados-grade dd.nao-informado {
  color: var(--texto-claro);
  font-weight: 400;
}

/* ---------- Linha do tempo ---------- */

.linha-tempo {
  list-style: none;
  position: relative;
}

.linha-tempo li {
  position: relative;
  padding: 0 0 20px 28px;
}

.linha-tempo li:last-child {
  padding-bottom: 0;
}

.linha-tempo li::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 18px;
  bottom: -2px;
  width: 2px;
  background: var(--borda);
}

.linha-tempo li:last-child::before {
  display: none;
}

.marcador {
  position: absolute;
  left: 0;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 3px solid var(--branco);
  box-shadow: 0 0 0 2px var(--em-dia-texto);
  background: var(--em-dia-texto);
}

.marcador.anomalia {
  box-shadow: 0 0 0 2px var(--vencido-texto);
  background: var(--vencido-texto);
}

.evento p {
  color: var(--texto-suave);
  font-size: 0.85rem;
  margin: 2px 0 8px;
}

.evento time {
  white-space: nowrap;
}

@media (max-width: 520px) {
  .dados-grade {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Formulários em blocos ---------- */

.bloco-form + .bloco-form {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--borda);
}

.bloco-form h2 {
  font-size: 1.05rem;
  color: var(--marinho);
  margin-bottom: 16px;
}

.grade-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}

.grade-form .inteiro {
  grid-column: 1 / -1;
}

.campo-form select,
.campo-form textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--borda);
  border-radius: var(--raio-pequeno);
  background: var(--branco);
  font: inherit;
  color: var(--texto);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.campo-form select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235B6478' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
  cursor: pointer;
}

.campo-form select:disabled {
  background-color: var(--fundo);
  color: var(--texto-claro);
  cursor: not-allowed;
}

.campo-form textarea {
  min-height: 110px;
  padding: 12px 14px;
  resize: vertical;
}

.campo-form select:focus,
.campo-form textarea:focus {
  outline: none;
  border-color: var(--marinho);
  box-shadow: 0 0 0 3px rgba(15, 42, 92, 0.12);
}

.campo-form input::placeholder,
.campo-form textarea::placeholder {
  color: var(--texto-claro);
}

.obrigatorio {
  color: var(--vencido-texto);
  font-weight: 500;
  margin-left: 2px;
}

.opcional {
  color: var(--texto-claro);
  font-weight: 400;
}

.acoes-form {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.botao-primario:disabled:hover {
  box-shadow: none;
}

/* ---------- Faixas de mensagem ---------- */

.faixa {
  display: none;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--raio-pequeno);
  border-left: 4px solid currentColor;
  font-weight: 600;
}

.faixa.visivel {
  display: flex;
}

.faixa svg {
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.faixa span {
  flex: 1;
}

.faixa a {
  color: inherit;
}

.faixa button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -4px -4px -4px 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.faixa button:hover {
  background: rgba(0, 0, 0, 0.06);
}

.faixa button svg {
  width: 16px;
  height: 16px;
  margin: 0;
}

.faixa.sucesso { background: var(--em-dia-fundo);  color: var(--em-dia-texto); }
.faixa.erro    { background: var(--vencido-fundo); color: var(--vencido-texto); }
.faixa.aviso   { background: var(--vence-fundo);   color: var(--vence-texto); }

@media (max-width: 640px) {
  .grade-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .acoes-form .botao {
    flex: 1;
  }
}

/* ---------- Página simples (sem menu lateral) ---------- */

.barra-topo {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--marinho);
  color: var(--branco);
}

.barra-topo-conteudo {
  max-width: 560px;
  margin: 0 auto;
  min-height: 60px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.barra-topo .logo {
  padding: 0;
}

.barra-topo .logo-imagem {
  height: 34px;
}

.barra-topo-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--raio-pequeno);
  color: var(--branco);
  font-weight: 600;
  text-decoration: none;
}

.barra-topo-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.barra-topo-link svg {
  width: 18px;
  height: 18px;
}

.coluna-estreita {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Escolha em dois botões grandes ---------- */

.escolha {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.escolha input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.escolha label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 8px;
  border: 1.5px solid var(--borda);
  border-radius: var(--raio-pequeno);
  background: var(--branco);
  color: var(--texto);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.escolha label svg {
  width: 20px;
  height: 20px;
}

/* Em telas estreitas, só o texto, para "Com problema" caber numa linha */
@media (max-width: 400px) {
  .escolha label svg {
    display: none;
  }
}

.escolha label:hover {
  border-color: var(--texto-claro);
}

.escolha input:focus-visible + label {
  outline: 3px solid var(--destaque);
  outline-offset: 2px;
}

.escolha input.conforme:checked + label {
  background: var(--em-dia-texto);
  border-color: var(--em-dia-texto);
  color: var(--branco);
}

.escolha input.problema:checked + label {
  background: var(--vencido-texto);
  border-color: var(--vencido-texto);
  color: var(--branco);
}

.botao-grande {
  width: 100%;
  min-height: 56px;
  font-size: 1.05rem;
}

/* ---------- Avisos ---------- */

.faixa-erro {
  background: var(--vencido-fundo);
  color: var(--vencido-texto);
  border-left: 4px solid var(--vencido-texto);
  border-radius: var(--raio-pequeno);
  padding: 14px 18px;
  font-weight: 600;
}

.vazio {
  color: var(--texto-suave);
  text-align: center;
  padding: 24px 8px;
}

/* ---------- Celular: menu em cima ---------- */

@media (max-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }

  .menu {
    position: static;
    height: auto;
    padding: 16px;
    gap: 12px;
  }

  .logo {
    padding: 0;
  }

  .menu-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .menu-links a {
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.04);
    padding: 0 10px;
    gap: 8px;
  }

  .menu-links a.ativo {
    box-shadow: inset 0 -3px 0 var(--destaque);
  }

  .menu-rodape {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 0;
  }

  .botao-sair {
    width: auto;
  }

  .conteudo {
    padding: 20px 16px 40px;
  }

  .filtros {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-self: stretch;
  }

  .filtro {
    padding: 6px 8px;
    gap: 6px;
    font-size: 0.9rem;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
  }
}

/* ---------- Interface por papel (papel.js) ---------- */

/* Só do admin: escondido (sem sumir do lugar) até o papel ser conhecido, e removido para zelador e síndico */
html:not(.papel-admin):not(.papel-restrito) [data-so-admin] {
  visibility: hidden;
}

html.papel-restrito [data-so-admin] {
  display: none !important;
}

/* Só de zelador e síndico */
html:not(.papel-restrito) [data-so-restrito] {
  display: none !important;
}
