:root {
  --roxo-principal: #6a1b9a;
  --roxo-escuro: #4a148c;
  --roxo-claro: #9c4dcc;
  --roxo-suave: #ede7f6;
  --branco: #ffffff;
  --cinza-suave: #f5f5f5;
  --texto-escuro: #2c1840;
  --verde: #2e7d32;
  --vermelho: #c62828;
  --cinza-medio: #999;
  --sombra: 0 2px 8px rgba(74, 20, 140, 0.15);
}

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

body {
  font-family: 'Segoe UI', Tahoma, Verdana, sans-serif;
  background: var(--roxo-suave);
  color: var(--texto-escuro);
  min-height: 100vh;
  line-height: 1.5;
}

.banner-topo {
  width: 100%;
  aspect-ratio: 1158 / 288;
  background-color: var(--roxo-escuro);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: var(--sombra);
}

.banner-preview {
  width: 100%;
  height: 160px;
  border-radius: 8px;
  background-color: var(--cinza-suave);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  border: 1px dashed #ccc;
  margin-bottom: 0.75rem;
}

@media (max-width: 600px) {
  .banner-topo { aspect-ratio: 1158 / 288; height: auto; }
}

header {
  background: linear-gradient(135deg, var(--roxo-escuro) 0%, var(--roxo-principal) 70%, #7e2bb3 100%);
  color: var(--branco);
  padding: 1.4rem 2rem;
  box-shadow: var(--sombra);
  position: relative;
  overflow: hidden;
}

header::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(255,255,255,0.08), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.cabecalho-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.branding {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.logo svg,
.logo img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 14px;
}

.logo img {
  object-fit: cover;
  background: var(--branco);
}

.titulo-area h1 {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.1;
}

.subtitulo {
  font-size: 0.92rem;
  opacity: 0.9;
  margin-top: 0.25rem;
  font-weight: 400;
}

.area-admin {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.badge-admin {
  background: var(--branco);
  color: var(--roxo-escuro);
  padding: 0.25rem 0.7rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-branco {
  background: var(--branco);
  color: var(--roxo-principal);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-branco:hover {
  background: var(--roxo-suave);
}

.abas {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  background: var(--branco);
  border-bottom: 2px solid var(--roxo-claro);
  padding: 0 2rem;
  box-shadow: var(--sombra);
}

.info-abas {
  display: contents;
}

.aba-link {
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  color: var(--texto-escuro);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.aba-link:hover {
  background: var(--roxo-suave);
}

.aba-link.desativado {
  color: var(--cinza-medio);
  cursor: default;
}

.aba-link.desativado:hover {
  background: none;
}

.aba {
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  color: var(--texto-escuro);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.aba:hover {
  background: var(--roxo-suave);
}

.aba.ativa {
  color: var(--roxo-principal);
  border-bottom-color: var(--roxo-principal);
  font-weight: 600;
}

main {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.conteudo-aba {
  display: none;
}

.conteudo-aba.ativa {
  display: block;
}

.cabecalho-secao {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.cabecalho-secao h2 {
  color: var(--roxo-principal);
  font-size: 1.3rem;
}

.grade-segundas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.card-segunda {
  background: var(--branco);
  border-radius: 10px;
  padding: 1.2rem;
  box-shadow: var(--sombra);
  border-left: 4px solid var(--roxo-claro);
  transition: transform 0.15s, box-shadow 0.15s;
}

.card-segunda:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(74, 20, 140, 0.25);
}

.card-segunda.com-escala {
  border-left-color: var(--roxo-principal);
}

.data-segunda {
  font-size: 1rem;
  font-weight: 600;
  color: var(--roxo-principal);
  margin-bottom: 0.8rem;
  text-transform: capitalize;
}

.bloco-grupo {
  margin-bottom: 0.8rem;
}

.bloco-grupo .titulo-grupo {
  font-size: 0.78rem;
  color: var(--roxo-escuro);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
}

.lista-fixos {
  font-size: 0.85rem;
  color: var(--texto-escuro);
  line-height: 1.4;
}

.chips-escalados {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chip-escalado {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--roxo-suave);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  gap: 0.5rem;
}

.chip-escalado.confirmado {
  background: #e8f5e9;
}

.chip-escalado.nao_confirmado {
  background: #ffebee;
}

.nome-escalado-texto {
  font-size: 0.92rem;
  color: var(--texto-escuro);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.indicador-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cinza-medio);
  display: inline-block;
}

.indicador-status.confirmado {
  background: var(--verde);
}

.indicador-status.nao_confirmado {
  background: var(--vermelho);
}

.botoes-confirmacao {
  display: flex;
  gap: 0.25rem;
}

.btn-confirm {
  border: 1px solid #ddd;
  background: var(--branco);
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-confirm:hover {
  transform: scale(1.1);
}

.btn-confirm.ativo-ok {
  background: var(--verde);
  color: var(--branco);
  border-color: var(--verde);
}

.btn-confirm.ativo-nao {
  background: var(--vermelho);
  color: var(--branco);
  border-color: var(--vermelho);
}

.sem-escala {
  font-style: italic;
  color: #888;
  font-size: 0.88rem;
}

.acoes-card {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid #eee;
}

.btn-primario, .btn-secundario, .btn-perigo {
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.15s;
  font-weight: 500;
}

.btn-primario {
  background: var(--roxo-principal);
  color: var(--branco);
}

.btn-primario:hover {
  background: var(--roxo-escuro);
}

.btn-secundario {
  background: var(--branco);
  color: var(--roxo-principal);
  border: 1px solid var(--roxo-principal);
}

.btn-secundario:hover {
  background: var(--roxo-suave);
}

.btn-perigo {
  background: var(--branco);
  color: #b71c1c;
  border: 1px solid #b71c1c;
}

.btn-perigo:hover {
  background: #ffebee;
}

.btn-primario:disabled,
.btn-secundario:disabled,
.btn-perigo:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primario:disabled:hover { background: var(--roxo-principal); }
.btn-secundario:disabled:hover { background: var(--branco); }
.btn-perigo:disabled:hover { background: var(--branco); }

.grupos-pessoas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 720px) {
  .grupos-pessoas {
    grid-template-columns: 1fr;
  }
}

.card-grupo {
  background: var(--branco);
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: var(--sombra);
}

.card-grupo h2 {
  color: var(--roxo-principal);
  margin-bottom: 0.3rem;
  font-size: 1.15rem;
}

.descricao {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 1rem;
}

.lista-pessoas {
  list-style: none;
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.lista-pessoas li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.8rem;
  background: var(--cinza-suave);
  border-radius: 6px;
  margin-bottom: 0.3rem;
  font-size: 0.92rem;
}

.pessoa-acoes {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-pessoa {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-pessoa-editar {
  background: var(--roxo-suave);
  color: var(--roxo-escuro);
  border-color: var(--roxo-suave);
}

.btn-pessoa-editar:hover {
  background: var(--roxo-claro);
  color: var(--branco);
}

.btn-pessoa-excluir {
  background: #ffebee;
  color: #b71c1c;
  border-color: #ffcdd2;
}

.btn-pessoa-excluir:hover {
  background: var(--vermelho);
  color: var(--branco);
}

.adicionar {
  display: flex;
  gap: 0.5rem;
}

.adicionar input {
  flex: 1;
  padding: 0.5rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
}

.adicionar input:focus {
  outline: none;
  border-color: var(--roxo-principal);
}

.escondido {
  display: none !important;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-conteudo {
  background: var(--branco);
  border-radius: 10px;
  padding: 1.8rem;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-pequeno {
  max-width: 400px;
}

.modal-conteudo h3 {
  color: var(--roxo-principal);
  margin-bottom: 0.3rem;
}

.modal-conteudo h4 {
  color: var(--roxo-escuro);
  margin: 1.2rem 0 0.5rem;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.contador {
  font-size: 0.82rem;
  color: var(--cinza-medio);
  font-weight: 400;
}

.modal-data {
  color: #666;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  text-transform: capitalize;
}

#input-senha {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  margin: 0.6rem 0 0.3rem;
}

#input-senha:focus {
  outline: none;
  border-color: var(--roxo-principal);
}

.grupo-selecao {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.5rem;
  background: var(--cinza-suave);
  border-radius: 6px;
}

.grupo-selecao label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  background: var(--branco);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.88rem;
  user-select: none;
}

.grupo-selecao label:hover {
  background: var(--roxo-suave);
}

.grupo-selecao input[type="checkbox"] {
  accent-color: var(--roxo-principal);
}

.modal-acoes {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.aviso-erro {
  color: var(--vermelho);
  font-size: 0.85rem;
  min-height: 1.1rem;
  margin-top: 0.4rem;
}

.badge-whatsapp {
  background: #25d366;
  color: var(--branco);
  padding: 0.25rem 0.7rem;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

.adicionar.duplo {
  flex-wrap: wrap;
}

.adicionar.duplo input {
  flex: 1 1 40%;
  min-width: 130px;
}

.lista-pessoas .info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.lista-pessoas .telefone {
  font-size: 0.78rem;
  color: #888;
}

.lista-pessoas .sem-telefone {
  color: var(--vermelho);
  font-style: italic;
}

.card-config {
  background: var(--branco);
  border-radius: 10px;
  padding: 1.8rem;
  box-shadow: var(--sombra);
  max-width: 600px;
}

.card-config h2 {
  color: var(--roxo-principal);
  margin-bottom: 0.4rem;
  font-size: 1.2rem;
}

.card-perigo {
  border-left: 4px solid var(--vermelho);
  background: #fff8f8;
}

.card-perigo h2 {
  color: var(--vermelho);
}

.btn-perigo {
  background: var(--vermelho);
  color: var(--branco);
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.15s;
}

.btn-perigo:hover {
  background: #8e1a1a;
}

/* ===== Relatórios ===== */
.grade-metricas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.metrica {
  background: var(--roxo-suave);
  border-left: 4px solid var(--roxo-principal);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.metrica strong {
  font-size: 1.8rem;
  color: var(--roxo-principal);
  line-height: 1;
}

.metrica span {
  font-size: 0.82rem;
  color: var(--texto-escuro);
  opacity: 0.85;
}

.metrica.verde { border-left-color: var(--verde); background: #e8f5e9; }
.metrica.verde strong { color: var(--verde); }
.metrica.vermelho { border-left-color: var(--vermelho); background: #ffebee; }
.metrica.vermelho strong { color: var(--vermelho); }
.metrica.amarelo { border-left-color: #f9a825; background: #fff8e1; }
.metrica.amarelo strong { color: #f57f17; }

.tabela-rolavel {
  overflow-x: auto;
  margin-top: 0.5rem;
}

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

.tabela-rel th {
  background: var(--roxo-principal);
  color: var(--branco);
  padding: 0.6rem 0.7rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
}

.tabela-rel td {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

.tabela-rel tr:nth-child(even) td { background: #fafafa; }

.tabela-rel .cinza { color: var(--cinza-medio); }

.tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 0.3rem;
  white-space: nowrap;
}

.tag.verde { background: #c8e6c9; color: #1b5e20; }
.tag.vermelho { background: #ffcdd2; color: #b71c1c; }
.tag.amarelo { background: #fff9c4; color: #795548; }

.verde-texto { color: var(--verde); font-weight: 600; }
.vermelho-texto { color: var(--vermelho); font-weight: 600; }
.amarelo-texto { color: #b07d00; font-weight: 600; }

.cabecalho-impressao {
  padding: 1rem 2rem;
  border-bottom: 2px solid var(--roxo-principal);
}

.apenas-imprimir { display: none; }

@media print {
  body { background: white; }
  .nao-imprimir { display: none !important; }
  .apenas-imprimir { display: block; }
  main { margin: 0.5rem auto; }
  .card-config { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
  .tabela-rel { font-size: 0.78rem; }
  .tabela-rel th { background: #ddd !important; color: black !important; }
}

.portaria {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.portaria:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0.5rem;
}

.portaria h3 {
  color: var(--roxo-principal);
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.portaria-endereco {
  color: var(--texto-escuro);
  margin-bottom: 0.6rem;
}

.mini-mapa {
  width: 100%;
  height: 260px;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--sombra);
  display: block;
}

.paragrafo-info {
  color: var(--texto-escuro);
  margin-top: 0.6rem;
  line-height: 1.65;
  font-size: 1rem;
}

.recomendacao {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  background: var(--roxo-suave);
  border-radius: 8px;
  margin-top: 0.6rem;
  line-height: 1.55;
}

.recomendacao p {
  margin: 0;
  color: var(--texto-escuro);
}

.recomendacao-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--roxo-principal);
  color: var(--branco);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.recomendacao.destaque {
  background: #fff4e6;
  border-left: 4px solid #e67e22;
}

.recomendacao.destaque .recomendacao-num {
  background: #e67e22;
}

.destaque-card {
  border-left: 4px solid var(--verde);
}

.lista-info {
  list-style: none;
  margin-top: 0.6rem;
  padding: 0;
}

.lista-info li {
  padding: 0.55rem 0.9rem;
  background: var(--roxo-suave);
  border-radius: 8px;
  margin-bottom: 0.4rem;
  color: var(--texto-escuro);
}

.lista-info li strong {
  color: var(--roxo-principal);
  margin-right: 0.3rem;
}

.campo {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.9rem 0;
}

.campo > span {
  font-size: 0.85rem;
  color: var(--texto-escuro);
  font-weight: 500;
}

.campo input {
  padding: 0.6rem 0.9rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
}

.campo input:focus {
  outline: none;
  border-color: var(--roxo-principal);
}

.campo-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.9rem 0;
  cursor: pointer;
  user-select: none;
}

.campo-toggle input[type="checkbox"] {
  accent-color: var(--roxo-principal);
  width: 1.1rem;
  height: 1.1rem;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--roxo-principal);
  color: var(--branco);
  padding: 0.9rem 1.4rem;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  z-index: 200;
  font-size: 0.95rem;
  max-width: 90%;
  text-align: center;
  animation: toast-in 0.25s ease-out;
}

.toast.sucesso {
  background: var(--verde);
}

.toast.erro {
  background: var(--vermelho);
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

