/* ============================================================
   Vem Nascer de Novo — painel administrativo
   ============================================================ */

body.adm {
  background: var(--papel-2);
  color: var(--tinta);
}

.adm-moldura {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100dvh;
}

/* ---------- Lateral ---------- */
.adm-lateral {
  background: var(--noite);
  color: var(--branco-quente);
  padding: 1.6rem 1.4rem;
  display: none;
}
.adm-lateral .marca { color: var(--branco-quente); }
.adm-lateral .marca-texto { font-size: 1.02rem; }
.adm-lateral .marca-texto em { font-size: 0.82rem; color: var(--dourado); }

.adm-menu {
  margin-top: 2rem;
  display: grid;
  gap: 0.25rem;
}
.adm-menu a {
  padding: 0.62rem 0.9rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.97rem;
  color: rgba(246, 241, 231, 0.75);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.adm-menu a:hover { background: var(--noite-3); color: #fff; }
.adm-menu a.atual {
  background: rgba(217, 164, 65, 0.16);
  color: var(--dourado);
}

.adm-lateral-base {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--linha-noite);
  display: grid;
  gap: 0.2rem;
}
.adm-lateral-base a {
  color: rgba(246, 241, 231, 0.55);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.35rem 0.9rem;
}
.adm-lateral-base a:hover { color: var(--dourado); }

/* ---------- Topo + conteúdo ---------- */
.adm-topo {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 3vw, 2rem);
  background: #fff;
  border-bottom: 1px solid var(--linha);
  position: sticky;
  top: 0;
  z-index: 40;
}
.adm-topo-titulo {
  margin: 0;
  font-family: var(--fonte-display);
  font-weight: 500;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}
.adm-topo-usuario {
  margin-left: auto;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--tinta-suave);
}

.adm-conteudo {
  padding: clamp(1.2rem, 3vw, 2rem);
  max-width: 1160px;
}

.adm-pe {
  padding: 1.4rem clamp(1rem, 3vw, 2rem);
  font-size: 0.82rem;
  color: var(--tinta-suave);
}
.adm-pe p { margin: 0; }

/* Botão do menu (mobile) */
.adm-botao-menu {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px; height: 42px;
  padding: 10px 10px;
  background: none;
  border: 1.5px solid var(--linha);
  border-radius: 10px;
  cursor: pointer;
}
.adm-botao-menu span { display: block; height: 2px; background: var(--tinta); border-radius: 2px; }

.adm-cortina {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(14, 27, 44, 0.5);
  border: 0;
  cursor: pointer;
}

/* Lateral como gaveta no mobile */
@media (max-width: 899px) {
  .adm-lateral.aberta {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 150;
    width: min(290px, 82vw);
    overflow-y: auto;
    box-shadow: 18px 0 50px rgba(0, 0, 0, 0.35);
  }
}

/* ---------- Medidores do dashboard ---------- */
.adm-medidores {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.6rem;
}
.medidor {
  background: #fff;
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  padding: 1.2rem 1.3rem;
}
.medidor-valor {
  display: block;
  font-family: var(--fonte-display);
  font-weight: 500;
  font-size: 2.1rem;
  line-height: 1;
  color: var(--noite);
}
.medidor-rotulo {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--tinta-suave);
}

/* ---------- Caixas ---------- */
.adm-caixa {
  background: #fff;
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.4rem;
}
.adm-caixa h2 {
  margin: 0 0 1rem;
  font-family: var(--fonte-display);
  font-weight: 500;
  font-size: 1.25rem;
}
.adm-caixa-cabeca {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.adm-caixa-cabeca h2 { margin: 0; }
.adm-caixa-link {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--tinta);
  text-decoration-color: var(--dourado);
  text-underline-offset: 4px;
}

.adm-painel-duplo {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
}

/* Listas simples */
.adm-lista-simples { list-style: none; margin: 0; padding: 0; }
.adm-lista-simples li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px dashed var(--linha);
  font-size: 0.96rem;
}
.adm-lista-simples li:last-child { border-bottom: 0; }
.adm-lista-rolavel { max-height: 320px; overflow: auto; }
.adm-alerta-num { color: var(--vermelho); }

.adm-lista-posts { list-style: none; margin: 0; padding: 0; }
.adm-lista-posts li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px dashed var(--linha);
}
.adm-lista-posts li:last-child { border-bottom: 0; }
.adm-lista-posts a {
  font-weight: 700;
  text-decoration: none;
  color: var(--tinta);
}
.adm-lista-posts a:hover { text-decoration: underline; text-decoration-color: var(--dourado); }

.ponto-status {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: 1px;
}
.ponto-status.verde { background: var(--verde-ok); }
.ponto-status.cinza { background: #c2c6cc; }

.adm-meta { font-size: 0.84rem; color: var(--tinta-suave); }
.adm-ok { color: var(--verde-ok); font-weight: 700; font-size: 0.88rem; }
.adm-falha { color: var(--vermelho); font-weight: 700; font-size: 0.88rem; }
.adm-fila { color: #8a6d1f; font-weight: 700; font-size: 0.88rem; }
.adm-linha-apagada { opacity: 0.5; }

/* ---------- Barra de ações / busca ---------- */
.adm-barra-acoes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}
.adm-busca { display: flex; gap: 0.5rem; flex: 1; max-width: 420px; }

/* ---------- Tabelas ---------- */
.adm-tabela-wrap, .adm-tabela { width: 100%; }
.adm-tabela {
  border-collapse: collapse;
  font-size: 0.95rem;
}
.adm-tabela th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--tinta-suave);
  padding: 0.55rem 0.7rem;
  border-bottom: 2px solid var(--linha);
}
.adm-tabela td {
  padding: 0.75rem 0.7rem;
  border-bottom: 1px solid var(--linha);
  vertical-align: top;
}
.adm-tabela tr:last-child td { border-bottom: 0; }
.adm-tabela a { color: var(--tinta); font-weight: 700; text-decoration: none; }
.adm-tabela a:hover { text-decoration: underline; text-decoration-color: var(--dourado); }
.adm-cel-titulo .adm-etiqueta {
  margin-left: 0.5rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--dourado-suave);
  color: #7c5a12;
  font-size: 0.72rem;
  font-weight: 700;
}
.adm-vazio { text-align: center; color: var(--tinta-suave); font-style: italic; padding: 2rem 0; }
.adm-col-acoes { text-align: right; }
.adm-acoes {
  text-align: right;
  white-space: nowrap;
}
.adm-acoes .adm-form-linha { display: inline-block; margin-left: 0.6rem; }
.adm-acao {
  background: none;
  border: 0;
  padding: 0.2rem 0.1rem;
  font-family: var(--fonte-corpo);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--tinta);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--linha);
  text-underline-offset: 4px;
}
.adm-acao:hover { text-decoration-color: var(--dourado); }
.adm-acao-perigo { color: var(--vermelho); }
.adm-acao-perigo:hover { text-decoration-color: var(--vermelho); }

/* ---------- Formulários ---------- */
.adm-form-linhas { display: grid; gap: 0.35rem; max-width: 720px; }
.adm-form-linhas label {
  margin-top: 0.65rem;
  font-size: 0.88rem;
  font-weight: 700;
}
.adm-form-linhas .botao, .adm-form-linhas .caixa-check { margin-top: 1rem; }

.adm-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.6rem;
  max-width: 1080px;
}
.adm-form-coluna { display: grid; gap: 0.35rem; align-content: start; }
.adm-form-coluna label { margin-top: 0.65rem; font-size: 0.88rem; font-weight: 700; }
.adm-form-lado {
  background: #fff;
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  padding: 1.3rem;
}
.campo-alto { min-height: 320px; line-height: 1.6; }

/* ---------- Toolbar do editor ---------- */
.campo-com-toolbar textarea {
  border-radius: 0 0 12px 12px;
}
.campo-com-toolbar .campo-alto { min-height: 340px; }

.adm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.55rem;
  padding: 0.4rem 0.5rem;
  background: var(--papel-2);
  border: 1.5px solid var(--linha);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
}
.adm-toolbar button {
  padding: 0.38rem 0.72rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  font-family: var(--fonte-corpo);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--tinta);
  cursor: pointer;
}
.adm-toolbar button:hover {
  background: #fff;
  border-color: var(--linha);
}
.adm-toolbar .sep {
  width: 1px;
  height: 20px;
  background: var(--linha);
  margin: 0 0.35rem;
}
.adm-toolbar #botaoPreview {
  margin-left: auto;
  color: var(--musgo, #5f7355);
}
.dica-form {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--tinta-suave);
}

/* Pré-visualização */
.adm-preview {
  display: none;
  border: 1.5px solid var(--linha);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: #fff;
  padding: 1.4rem 1.6rem;
  min-height: 340px;
}
.campo-com-toolbar.modo-preview textarea { display: none; }
.campo-com-toolbar.modo-preview .adm-preview { display: block; }
.adm-preview p:first-child { margin-top: 0; }
.adm-preview blockquote { margin-block: 1.2em; }
.adm-capa-preview {
  border-radius: 10px;
  max-height: 160px;
  object-fit: cover;
  margin-top: 0.4rem;
  border: 1px solid var(--linha);
}
.adm-form-anexo {
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  border-top: 1px dashed var(--linha);
  display: grid;
  gap: 0.5rem;
  max-width: 480px;
}
.adm-form-anexo label { font-weight: 700; font-size: 0.9rem; }
.adm-form-anexo .botao { margin-top: 0.6rem; justify-self: start; }
.adm-form-anexo input[type="file"] { max-width: 100%; }
.adm-caixa-anexos { max-width: 1080px; }

.adm-linha-botoes { display: flex; gap: 0.6rem; margin-top: 1rem; }

/* ---------- Detalhes (banners) ---------- */
.adm-detalhe {
  border: 1px solid var(--linha);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.8rem;
  background: #fff;
}
.adm-detalhe summary {
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style-position: inside;
}
.adm-detalhe[open] summary { margin-bottom: 1rem; }
.adm-detalhe form.adm-form-linhas { max-width: 640px; }
.adm-detalhe > form:last-child { margin-top: 0.8rem; }

/* ---------- Abas ---------- */
.adm-abas {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.aba {
  padding: 0.55rem 1.2rem;
  border: 1.5px solid var(--linha);
  border-radius: 999px;
  background: #fff;
  font-family: var(--fonte-corpo);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--tinta-suave);
  cursor: pointer;
}
.aba.atual {
  background: var(--noite);
  border-color: var(--noite);
  color: var(--branco-quente);
}
.aba-painel { display: none; }
.aba-painel.atual { display: block; }

/* ---------- Login do painel ---------- */
.adm-login-body { background: var(--noite); }
.adm-login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.6rem;
}
.adm-login {
  width: min(430px, 100%);
  background: #fff;
  border-radius: var(--raio-grande);
  padding: 2.4rem 2.2rem;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.55);
}
.adm-login h1 {
  margin: 0 0 0.3rem;
  font-family: var(--fonte-display);
  font-weight: 500;
  font-size: 1.55rem;
  letter-spacing: -0.01em;
}
.adm-login-sub { margin: 0 0 1.5rem; color: var(--tinta-suave); font-size: 0.95rem; }
.adm-login-sol { margin-bottom: 1rem; color: var(--noite); }
.adm-login-pe {
  margin: 1.4rem 0 0;
  font-size: 0.8rem;
  color: var(--tinta-suave);
  text-align: center;
}

/* Modal de re-autenticação */
.adm-modal-fundo {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(14, 27, 44, 0.55);
  display: grid;
  place-items: center;
  padding: 1.2rem;
}
.adm-modal {
  width: min(400px, 100%);
  background: #fff;
  border-radius: var(--raio);
  padding: 1.6rem;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.4);
}
.adm-modal h3 {
  margin: 0 0 0.4rem;
  font-family: var(--fonte-display);
  font-weight: 500;
  font-size: 1.15rem;
}
.adm-modal p { margin: 0 0 1rem; font-size: 0.92rem; color: var(--tinta-suave); }
.adm-modal-botoes {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.1rem;
}

/* ---------- Desktop: sidebar fixa ---------- */
@media (min-width: 900px) {
  .adm-moldura { grid-template-columns: 250px 1fr; }
  .adm-lateral {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100dvh;
  }
  .adm-botao-menu { display: none; }
}

@media (min-width: 760px) {
  .adm-medidores { grid-template-columns: repeat(4, 1fr); }
  .adm-painel-duplo { grid-template-columns: 1fr 1fr; }
  .adm-form-grid { grid-template-columns: 1.6fr 1fr; }
}

/* Tabelas no mobile: empilha com rótulos */
@media (max-width: 759px) {
  .adm-tabela thead { display: none; }
  .adm-tabela tr {
    display: block;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--linha);
  }
  .adm-tabela td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border: 0;
    padding: 0.3rem 0;
  }
  .adm-tabela td::before {
    content: attr(data-rotulo);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--tinta-suave);
  }
  .adm-acoes { flex-wrap: wrap; }
  .adm-acoes::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
