:root {
  --sigpac-bg: #f5f9ff;
  --sigpac-primary: #0b5ed7;
  --sigpac-dark: #001f4f;
  --sigpac-text: #1f2f46;
  --sigpac-muted: #56657a;
  --sigpac-border: #dbe3ee;
  --sigpac-white: #ffffff;
}

html,
body {
  height: 100%;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background: var(--sigpac-bg);
  color: var(--sigpac-text);
}

.template-base {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* HEADER */

.sigpac-header {
  background: var(--sigpac-white);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
}

.sigpac-header .container-lg,
.sigpac-main .container-lg,
.sigpac-footer .container-lg {
  max-width: 1180px;
  margin: 0 auto;
}

.sigpac-header .header-top {
  min-height: 38px;
  padding: 4px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sigpac-header .header-logo img {
  max-height: 28px;
  width: auto;
}

.sigpac-header .header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: nowrap;
}

.sigpac-header .header-actions .br-item {
  padding: 0;
  font-size: 13px;
  white-space: nowrap;
}

.sigpac-header .br-button.circle.small {
  width: 30px;
  height: 30px;
  min-width: 30px;
}

.sigpac-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0 14px;
}

.sigpac-brand img {
  width: 145px;
  max-width: 34vw;
  height: auto;
}

.sigpac-system-name {
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  font-weight: 500;
  color: var(--sigpac-text);
  line-height: 1.2;
}

/* MAIN */

.sigpac-main {
  background: var(--sigpac-bg);
  padding: 18px 0;
  flex: 1;
  display: flex;
  align-items: center;
}

.sigpac-card {
  width: 100%;
  max-width: 900px;
  min-height: 460px;
  background: var(--sigpac-white);
  border: 1px solid var(--sigpac-border);
  border-radius: 22px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  gap: 22px;
  margin: 0 auto;
  padding: 24px 28px;
}

.sigpac-card-brand {
  padding: 8px 22px 8px 4px;
  text-align: center;
  border-right: 1px solid var(--sigpac-border);
}

.sigpac-card-icon {
  font-size: 40px;
  color: var(--sigpac-primary);
  display: block;
  margin-bottom: 12px;
}

.sigpac-card-brand h1 {
  margin: 0;
  font-size: clamp(36px, 3.8vw, 46px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: 5px;
  color: var(--sigpac-dark);
}

.sigpac-card-brand h2 {
  margin: 12px 0 0;
  font-size: clamp(18px, 1.8vw, 22px);
  line-height: 1.22;
  font-weight: 500;
  color: var(--sigpac-dark);
}

.sigpac-divider {
  width: 56px;
  height: 4px;
  background: var(--sigpac-primary);
  border-radius: 999px;
  display: block;
  margin: 16px auto;
}

.sigpac-card-brand p {
  max-width: 450px;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.45;
  color: var(--sigpac-muted);
}

.sigpac-info {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--sigpac-border);
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  color: var(--sigpac-dark);
  font-weight: 600;
  font-size: 13px;
}

.sigpac-info span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sigpac-info i {
  color: var(--sigpac-primary);
}

/* LOGIN */

.sigpac-login-card {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  padding: 24px;
  background: var(--sigpac-white);
  border: 1px solid var(--sigpac-border);
  border-radius: 20px;
  text-align: center;
}

.sigpac-login-icon {
  font-size: 38px;
  color: var(--sigpac-primary);
  display: block;
}

.sigpac-login-card h2 {
  margin: 16px 0 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--sigpac-dark);
}

.sigpac-login-card p {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--sigpac-muted);
}

.sigpac-button,
.sigpac-button-outline {
  width: 100%;
  min-height: 52px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

/* Centraliza o texto dos botões da home */
.sigpac-card .br-button.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.sigpac-button {
  background: var(--sigpac-primary);
  color: var(--sigpac-white);
  margin-bottom: 10px;
}

.sigpac-button-outline {
  background: var(--sigpac-white);
  color: var(--sigpac-primary);
  border: 2px solid var(--sigpac-primary);
}

.sigpac-button:hover,
.sigpac-button-outline:hover {
  text-decoration: none;
}

.sigpac-button:hover {
  color: var(--sigpac-white);
}

.sigpac-button-outline:hover {
  background: #eef5ff;
  color: var(--sigpac-primary);
}

.sigpac-button div,
.sigpac-button-outline div {
  flex: 1;
  text-align: center;
}

.sigpac-button small,
.sigpac-button-outline small {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  font-weight: 500;
  opacity: .9;
}

/* FOOTER */

.sigpac-footer {
  background: var(--sigpac-white);
  border-top: 1px solid var(--sigpac-border);
}

.sigpac-footer-content {
  width: 100%;
  padding: 24px 20px;
}

.sigpac-footer-logos {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 32px;
}

.sigpac-footer-logos a {
  width: 160px;
  height: 78px;
  flex: 0 0 160px;

  display: flex;
  align-items: center;
  justify-content: center;

  line-height: 0;
  text-decoration: none;
}

.sigpac-footer-logos img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 58px;
  object-fit: contain;
}

/* Ajustes ópticos individuais das marcas */
.sigpac-footer-logos a:nth-child(1) img {
  max-width: 150px;
  max-height: 48px;
}

.sigpac-footer-logos a:nth-child(2) img {
  max-width: 150px;
  max-height: 54px;
}

.sigpac-footer-logos a:nth-child(3) img {
  max-width: 150px;
  max-height: 58px;
}

.sigpac-footer-logos a:nth-child(4) img {
  max-width: 145px;
  max-height: 62px;
}

.sigpac-footer .br-divider {
  width: min(100%, 1100px);
  margin-left: auto !important;
  margin-right: auto !important;
  display: block;
}

.sigpac-footer-text {
  padding: 0 20px 22px;
  text-align: center;
}

.sigpac-footer-text strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--sigpac-dark);
}

.sigpac-footer-text p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--sigpac-muted);
}

/* ALTO CONTRASTE */

body.contrast,
body.high-contrast,
html.contrast body,
body[data-contrast="true"] {
  background: #000 !important;
  color: #fff !important;
}

body.contrast .sigpac-main,
body.high-contrast .sigpac-main,
html.contrast body .sigpac-main,
body[data-contrast="true"] .sigpac-main {
  background: #000 !important;
}

body.contrast .sigpac-card,
body.contrast .sigpac-login-card,
body.contrast .sigpac-header,
body.contrast .sigpac-footer,
body.high-contrast .sigpac-card,
body.high-contrast .sigpac-login-card,
body.high-contrast .sigpac-header,
body.high-contrast .sigpac-footer,
html.contrast body .sigpac-card,
html.contrast body .sigpac-login-card,
html.contrast body .sigpac-header,
html.contrast body .sigpac-footer,
body[data-contrast="true"] .sigpac-card,
body[data-contrast="true"] .sigpac-login-card,
body[data-contrast="true"] .sigpac-header,
body[data-contrast="true"] .sigpac-footer {
  background: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}

body.contrast *,
body.high-contrast *,
html.contrast body *,
body[data-contrast="true"] * {
  color: inherit;
}

body.contrast a,
body.high-contrast a,
html.contrast body a,
body[data-contrast="true"] a {
  color: #ff0 !important;
}

body.contrast .sigpac-button,
body.high-contrast .sigpac-button,
html.contrast body .sigpac-button,
body[data-contrast="true"] .sigpac-button {
  background: #ff0 !important;
  color: #000 !important;
  border: 2px solid #ff0 !important;
}

body.contrast .sigpac-button *,
body.high-contrast .sigpac-button *,
html.contrast body .sigpac-button *,
body[data-contrast="true"] .sigpac-button * {
  color: #000 !important;
}

body.contrast .sigpac-button-outline,
body.high-contrast .sigpac-button-outline,
html.contrast body .sigpac-button-outline,
body[data-contrast="true"] .sigpac-button-outline {
  background: #000 !important;
  color: #ff0 !important;
  border-color: #ff0 !important;
}

body.contrast .sigpac-button-outline *,
body.high-contrast .sigpac-button-outline *,
html.contrast body .sigpac-button-outline *,
body[data-contrast="true"] .sigpac-button-outline * {
  color: #ff0 !important;
}

/* NOTEBOOK */

@media (max-width: 1200px) {
  .sigpac-header .container-lg,
  .sigpac-main .container-lg,
  .sigpac-footer .container-lg {
    max-width: 1040px;
  }

  .sigpac-card {
    max-width: 880px;
  }
}

/* ==================================================
   TABLET
================================================== */

@media (max-width: 992px) {
  .sigpac-main {
    align-items: flex-start;
  }

  .sigpac-header .header-actions {
    gap: 10px;
  }

  .sigpac-card {
    grid-template-columns: 1fr;
    max-width: 700px;
    padding: 28px 22px;
  }

  .sigpac-card-brand {
    border-right: 0;
    border-bottom: 1px solid var(--sigpac-border);
    padding: 8px 12px 22px;
  }

  .sigpac-login-card {
    max-width: 420px;
  }

  .sigpac-footer-content {
    padding: 22px 16px;
  }

  .sigpac-footer-logos {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 20px 24px;
  }

  .sigpac-footer-logos a {
    width: 145px;
    min-width: 145px;
    height: 74px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sigpac-footer-logos img {
    display: block;
    width: auto;
    height: auto;
    max-width: 140px;
    max-height: 60px;
    object-fit: contain;
  }
}


/* ==================================================
   CELULAR
================================================== */

@media (max-width: 576px) {
  .sigpac-header .header-top {
    justify-content: space-between;
    gap: 8px;
  }

  .sigpac-header .header-actions .br-item {
    display: none;
  }

  .sigpac-brand {
    justify-content: center;
    text-align: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0 12px;
  }

  .sigpac-brand img {
    width: 130px;
    max-width: 80vw;
  }

  .sigpac-system-name {
    font-size: 0.95rem;
  }

  .sigpac-main {
    padding: 14px 0 18px;
  }

  .sigpac-card {
    border-radius: 18px;
    padding: 22px 16px;
  }

  .sigpac-card-icon {
    font-size: 40px;
    margin-bottom: 12px;
  }

  .sigpac-card-brand h1 {
    font-size: 36px;
    letter-spacing: 4px;
  }

  .sigpac-card-brand h2 {
    font-size: 19px;
  }

  .sigpac-card-brand p {
    font-size: 13.5px;
  }

  .sigpac-info {
    gap: 12px;
    font-size: 12.5px;
  }

  .sigpac-login-card {
    padding: 22px 16px;
    border-radius: 18px;
  }

  .sigpac-login-icon {
    font-size: 38px;
  }

  .sigpac-login-card h2 {
    font-size: 22px;
  }

  .sigpac-button,
  .sigpac-button-outline {
    min-height: 54px;
    font-size: 13.5px;
  }

  .sigpac-button small,
  .sigpac-button-outline small {
    font-size: 11.5px;
  }

  .sigpac-footer-content {
    padding: 22px 12px;
  }

  /*
   * Uma logo por linha.
   * A ordem visual será a mesma ordem dos links no HTML.
   */
  .sigpac-footer-logos {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    justify-items: center;
    gap: 18px;
  }

  .sigpac-footer-logos a {
    width: 100%;
    min-width: 0;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sigpac-footer-logos img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(240px, 82vw);
    max-height: 62px;
    object-fit: contain;
  }

  /* Ajustes individuais mantendo a proporção das marcas */

  .sigpac-footer-logos a:nth-child(1) img {
    max-width: min(220px, 80vw);
    max-height: 52px;
  }

  .sigpac-footer-logos a:nth-child(2) img {
    max-width: min(220px, 80vw);
    max-height: 56px;
  }

  .sigpac-footer-logos a:nth-child(3) img {
    max-width: min(230px, 82vw);
    max-height: 60px;
  }

  .sigpac-footer-logos a:nth-child(4) img {
    max-width: min(230px, 82vw);
    max-height: 62px;
  }

  .sigpac-footer-logos a:nth-child(5) img {
    max-width: min(230px, 82vw);
    max-height: 62px;
  }

  .sigpac-footer .br-divider {
    width: calc(100% - 24px);
    margin-left: auto;
    margin-right: auto;
  }

  .sigpac-footer-text {
    padding: 0 16px 20px;
    text-align: center;
  }
}


/* ==================================================
   CORREÇÃO DEFINITIVA — LOGOS DO RODAPÉ
   GOV.BR DESIGN SYSTEM + SIGPAC
================================================== */

.sigpac-footer .sigpac-footer-logos,
.br-footer .sigpac-footer-logos {
  width: 100% !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  align-items: center !important;
  justify-items: center !important;
  gap: 24px !important;
}

.sigpac-footer .sigpac-footer-logos > a,
.br-footer .sigpac-footer-logos > a {
  width: 100% !important;
  min-width: 0 !important;
  height: 78px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: none !important;
  flex-basis: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0 !important;
  text-decoration: none !important;
}

.sigpac-footer .sigpac-footer-logos > a > img,
.br-footer .sigpac-footer-logos > a > img {
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: 150px !important;
  max-height: 58px !important;
  object-fit: contain !important;
  margin: 0 auto !important;
}

/* Tablet: duas marcas por linha */
@media (max-width: 992px) {
  .sigpac-footer .sigpac-footer-logos,
  .br-footer .sigpac-footer-logos {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px 20px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a,
  .br-footer .sigpac-footer-logos > a {
    height: 76px !important;
  }
}

/* Celular: uma marca por linha, preservando a ordem do HTML */
@media (max-width: 576px) {
  .sigpac-footer .sigpac-footer-content,
  .br-footer .sigpac-footer-content {
    padding: 22px 12px !important;
  }

  .sigpac-footer .sigpac-footer-logos,
  .br-footer .sigpac-footer-logos {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a,
  .br-footer .sigpac-footer-logos > a {
    width: 100% !important;
    min-width: 0 !important;
    height: 72px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a > img,
  .br-footer .sigpac-footer-logos > a > img {
    max-width: min(220px, 78vw) !important;
    max-height: 58px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a:nth-child(1) > img,
  .br-footer .sigpac-footer-logos > a:nth-child(1) > img {
    max-width: min(210px, 76vw) !important;
    max-height: 50px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a:nth-child(2) > img,
  .br-footer .sigpac-footer-logos > a:nth-child(2) > img {
    max-width: min(215px, 76vw) !important;
    max-height: 54px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a:nth-child(3) > img,
  .br-footer .sigpac-footer-logos > a:nth-child(3) > img {
    max-width: min(220px, 78vw) !important;
    max-height: 58px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a:nth-child(4) > img,
  .br-footer .sigpac-footer-logos > a:nth-child(4) > img {
    max-width: min(220px, 78vw) !important;
    max-height: 60px !important;
  }

  .sigpac-footer .br-divider,
  .br-footer .br-divider {
    width: calc(100% - 24px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .sigpac-footer .sigpac-footer-text,
  .br-footer .sigpac-footer-text {
    padding: 0 16px 20px !important;
    text-align: center !important;
  }
}


/* ==================================================
   RODAPÉ — QUEBRA BINÁRIA DAS LOGOS
   Desktop/tablet: todas na mesma linha.
   Celular: todas em uma única coluna.
   Nunca ocorre quebra parcial.
================================================== */

.sigpac-footer .sigpac-footer-logos,
.br-footer.sigpac-footer .sigpac-footer-logos {
  width: 100% !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  align-items: center !important;
  justify-items: center !important;
  gap: clamp(8px, 2vw, 32px) !important;
}

.sigpac-footer .sigpac-footer-logos > a,
.br-footer.sigpac-footer .sigpac-footer-logos > a {
  width: 100% !important;
  min-width: 0 !important;
  height: 78px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: none !important;
  flex-basis: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0 !important;
  text-decoration: none !important;
}

.sigpac-footer .sigpac-footer-logos > a > img,
.br-footer.sigpac-footer .sigpac-footer-logos > a > img {
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: min(145px, 20vw) !important;
  max-height: 58px !important;
  object-fit: contain !important;
  margin: 0 auto !important;
}

/* Ajustes ópticos das quatro marcas no layout horizontal */
.sigpac-footer .sigpac-footer-logos > a:nth-child(1) > img,
.br-footer.sigpac-footer .sigpac-footer-logos > a:nth-child(1) > img {
  max-height: 48px !important;
}

.sigpac-footer .sigpac-footer-logos > a:nth-child(2) > img,
.br-footer.sigpac-footer .sigpac-footer-logos > a:nth-child(2) > img {
  max-height: 54px !important;
}

.sigpac-footer .sigpac-footer-logos > a:nth-child(3) > img,
.br-footer.sigpac-footer .sigpac-footer-logos > a:nth-child(3) > img {
  max-height: 58px !important;
}

.sigpac-footer .sigpac-footer-logos > a:nth-child(4) > img,
.br-footer.sigpac-footer .sigpac-footer-logos > a:nth-child(4) > img {
  max-height: 62px !important;
}

/* Em telas intermediárias, reduz as logos sem quebrar a linha */
@media (max-width: 900px) and (min-width: 577px) {
  .sigpac-footer .sigpac-footer-logos,
  .br-footer.sigpac-footer .sigpac-footer-logos {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a,
  .br-footer.sigpac-footer .sigpac-footer-logos > a {
    height: 64px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a > img,
  .br-footer.sigpac-footer .sigpac-footer-logos > a > img {
    max-width: min(110px, 21vw) !important;
    max-height: 46px !important;
  }
}

/* Celular: quebra as quatro logos de uma só vez */
@media (max-width: 576px) {
  .sigpac-footer .sigpac-footer-content,
  .br-footer.sigpac-footer .sigpac-footer-content {
    padding: 22px 12px !important;
  }

  .sigpac-footer .sigpac-footer-logos,
  .br-footer.sigpac-footer .sigpac-footer-logos {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a,
  .br-footer.sigpac-footer .sigpac-footer-logos > a {
    width: 100% !important;
    height: 72px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a > img,
  .br-footer.sigpac-footer .sigpac-footer-logos > a > img {
    max-width: min(220px, 78vw) !important;
    max-height: 58px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a:nth-child(1) > img,
  .br-footer.sigpac-footer .sigpac-footer-logos > a:nth-child(1) > img {
    max-height: 50px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a:nth-child(2) > img,
  .br-footer.sigpac-footer .sigpac-footer-logos > a:nth-child(2) > img {
    max-height: 54px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a:nth-child(3) > img,
  .br-footer.sigpac-footer .sigpac-footer-logos > a:nth-child(3) > img {
    max-height: 58px !important;
  }

  .sigpac-footer .sigpac-footer-logos > a:nth-child(4) > img,
  .br-footer.sigpac-footer .sigpac-footer-logos > a:nth-child(4) > img {
    max-height: 60px !important;
  }
}


/* ==================================================
   CORREÇÃO FINAL — TEXTO CENTRALIZADO NOS BOTÕES
   Manter este bloco no final do arquivo.
================================================== */

.sigpac-button,
.sigpac-button-outline {
  text-align: center !important;
}

.sigpac-button > div,
.sigpac-button-outline > div {
  flex: 1 1 auto !important;
  text-align: center !important;
}

.sigpac-card a.br-button.primary {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}