/* INSJCM - Emissão Documental */
:root {
  --azul: #1e3a8a;
  --azul-claro: #3b82f6;
  --cinza-claro: #f3f4f6;
  --cinza-medio: #d1d5db;
  --cinza-escuro: #4b5563;
  --texto: #111827;
  --branco: #ffffff;
  --vermelho: #b91c1c;
  --verde: #15803d;
  --amarelo: #ca8a04;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--cinza-claro);
  color: var(--texto);
  margin: 0;
  line-height: 1.5;
}

.centered {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.topbar {
  background: var(--azul);
  color: var(--branco);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.topbar .brand { font-size: 1.1rem; }
.topbar .link-logout {
  color: var(--branco);
  text-decoration: none;
  opacity: 0.9;
  font-size: 0.9rem;
}
.topbar .link-logout:hover { opacity: 1; text-decoration: underline; }

.container {
  max-width: 760px;
  margin: 24px auto;
  padding: 0 16px;
}

.card {
  background: var(--branco);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card h1, .card h2 {
  margin-top: 0;
  color: var(--azul);
}

.login {
  max-width: 420px;
  text-align: center;
}
.login h1 { font-size: 2rem; margin-bottom: 4px; }
.login .subtitle {
  color: var(--cinza-escuro);
  margin-top: 0;
  margin-bottom: 32px;
}

.campo {
  margin-bottom: 16px;
}
.campo label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.92rem;
}
.campo input[type=text],
.campo input[type=file],
.campo select,
.campo textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--cinza-medio);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
}
.campo input:focus,
.campo select:focus,
.campo textarea:focus {
  outline: none;
  border-color: var(--azul-claro);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.ajuda {
  display: block;
  color: var(--cinza-escuro);
  font-size: 0.85rem;
  margin-top: 4px;
}
.ajuda code {
  background: var(--cinza-claro);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

.aviso-confirmacao {
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 6px;
  padding: 12px;
}
.aviso-confirmacao p { margin: 0 0 8px 0; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 6px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--azul); color: var(--branco); }
.btn-primary:hover:not(:disabled) { background: #1e40af; }
.btn-secondary { background: var(--verde); color: var(--branco); }
.btn-google {
  background: var(--branco);
  color: var(--texto);
  border: 1px solid var(--cinza-medio);
  width: 100%;
  padding: 12px;
}
.btn-google:hover { background: var(--cinza-claro); }

.erro {
  background: #fee2e2;
  color: var(--vermelho);
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.resultado {
  border-left: 4px solid var(--verde);
}
.resultado code {
  background: var(--cinza-claro);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85em;
  word-break: break-all;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table th, table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--cinza-medio);
}
table th {
  background: var(--cinza-claro);
  font-weight: 600;
}
.estado-activo { color: var(--verde); font-weight: 600; }
.estado-revogado { color: var(--vermelho); font-weight: 600; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .container { padding: 0 10px; }
  .card { padding: 16px; }
  table th, table td { padding: 6px; font-size: 0.85rem; }
}
