:root {
  --azul: #07549a;
  --azul-escuro: #003e78;
  --azul-claro: #e9f2fa;
  --verde: #5cba39;
  --amarelo: #f7b928;
  --texto: #243240;
  --texto-suave: #586775;
  --borda: #d7dee5;
  --fundo: #ffffff;
  --fundo-suave: #f4f6f7;
  --foco: #ffbf47;
  --largura: 1180px;
  --escala-texto: 1;
}

* { box-sizing: border-box; }

html {
  font-size: calc(16px * var(--escala-texto));
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--texto);
  background: var(--fundo);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.55;
}

a { color: var(--azul); }
a:hover { text-decoration-thickness: 2px; }

a[href^="mailto:"] { overflow-wrap: anywhere; }

:focus-visible {
  outline: 3px solid var(--foco);
  outline-offset: 3px;
}

.container {
  width: min(var(--largura), calc(100% - 32px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 4px;
  color: #fff;
  background: #111;
}

.skip-link:focus { transform: translateY(0); }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.gov-stripe {
  height: 5px;
  background: linear-gradient(90deg, #139dd2 0 33.33%, var(--verde) 33.33% 66.66%, var(--amarelo) 66.66%);
}

.utility-bar {
  border-bottom: 1px solid var(--borda);
  background: #fff;
}

.utility-inner {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}

.site-search {
  display: flex;
  flex-wrap: wrap;
  width: min(460px, 100%);
}

.site-search-results { flex-basis: 100%; min-width: 0; color: var(--texto); }
.site-search-results p { margin: .65rem 0 0; }
.site-search-results p:empty { margin: 0; }
.site-search-results ul { margin: .65rem 0; padding-left: 1.4rem; }
.site-search-results li { margin: .4rem 0; }
.site-search-results a { overflow-wrap: anywhere; }

.site-search input,
.filter-panel select,
.filter-panel input {
  min-height: 40px;
  border: 1px solid #aeb9c3;
  border-radius: 5px;
  padding: 8px 10px;
  color: var(--texto);
  background: #fff;
}

.site-search input {
  flex: 1;
  min-width: 0;
  border-radius: 5px 0 0 5px;
}

button,
.button {
  min-height: 40px;
  border: 1px solid var(--azul);
  border-radius: 5px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--azul);
  cursor: pointer;
  text-decoration: none;
}

.site-search button { border-radius: 0 5px 5px 0; }

.button.secondary,
button.secondary {
  color: var(--azul);
  background: #fff;
}

.institutional-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.access-tools {
  display: flex;
  gap: 6px;
  align-items: center;
}

.access-tools button,
.access-tools a {
  display: inline-grid;
  min-width: 38px;
  min-height: 36px;
  place-items: center;
  padding: 5px 8px;
  border: 1px solid #b9c2cb;
  border-radius: 4px;
  color: var(--azul-escuro);
  background: #fff;
  font-size: .875rem;
  font-weight: 700;
  text-decoration: none;
}

.access-tools img { width: 23px; height: 23px; }

.main-header { background: var(--azul); color: #fff; }

.header-inner {
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: space-between;
  min-height: 104px;
}

.brand img {
  display: block;
  width: min(460px, 100%);
  height: auto;
}

.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-nav a {
  display: block;
  padding: 12px 13px;
  border-radius: 4px;
  color: #fff;
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] { background: rgba(255,255,255,.16); }

.green-line { height: 4px; background: var(--verde); }

.breadcrumb-wrap { padding-top: 28px; }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  width: fit-content;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--borda);
  border-radius: 6px;
  background: #fff;
  font-size: .9rem;
}

.breadcrumb a { text-decoration: none; }
.breadcrumb .separator { color: #778591; }

main { min-height: 480px; padding: 22px 0 64px; }

h1, h2, h3 { color: var(--azul-escuro); line-height: 1.2; }
h1 { margin: 8px 0 24px; font-size: clamp(1.75rem, 4vw, 2.45rem); }
h2 { margin-top: 34px; font-size: clamp(1.35rem, 3vw, 1.75rem); }
h3 { font-size: 1.12rem; }

.lead { max-width: 820px; color: var(--texto-suave); font-size: 1.12rem; }

.prototype-notice,
.warning-notice {
  margin: 22px 0;
  padding: 14px 16px;
  border-left: 5px solid var(--amarelo);
  border-radius: 4px;
  background: #fff8df;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: center;
  margin: 0 0 34px;
  padding: clamp(24px, 5vw, 48px);
  border-radius: 8px;
  color: #fff;
  background: var(--azul);
}

.hero h1 { margin: 0 0 12px; color: #fff; }
.hero p { margin: 0 0 24px; font-size: 1.08rem; }

.hero-card {
  padding: 22px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 7px;
  background: rgba(0,0,0,.1);
}

.hero-card strong { display: block; margin-bottom: 6px; font-size: 1.12rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  min-height: 128px;
  flex-direction: column;
  justify-content: center;
  padding: 22px;
  border: 1px solid var(--borda);
  border-radius: 7px;
  color: var(--azul-escuro);
  background: #fff;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 2px 7px rgba(12, 52, 85, .04);
}

.card:hover {
  border-color: var(--azul);
  box-shadow: 0 6px 18px rgba(12, 52, 85, .12);
  transform: translateY(-1px);
}

.card strong { font-size: 1.08rem; }
.card span { margin-top: 6px; color: var(--texto-suave); font-size: .92rem; }

.content-box {
  margin: 20px 0;
  padding: 20px;
  border: 1px solid var(--borda);
  border-radius: 7px;
  background: #fff;
}

.management-profile {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin: 24px 0;
}

.management-profile h3 { margin-top: 0; }

.management-photo {
  display: block;
  width: 200px;
  height: 200px;
  max-width: 100%;
  object-fit: cover;
  object-position: center top;
  border: 1px solid var(--borda);
  border-radius: 7px;
}

.organogram {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 18px auto;
  border: 1px solid var(--borda);
}

.document-list { margin: 16px 0; padding-left: 22px; }
.document-list li { margin: 8px 0; }

.filter-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin: 22px 0;
  padding: 18px;
  border: 1px solid var(--borda);
  border-radius: 7px;
  background: var(--fundo-suave);
}

.field { display: grid; gap: 5px; min-width: 160px; }
.field label { font-weight: 700; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.exports {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin: 16px 0;
}

.exports a { font-weight: 700; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--borda);
  border-radius: 7px;
}

/* Consulta principal de Licitações: largura e colunas restritas a esta página. */
main.container:has(#tabela-licitacoes) {
  width: min(1800px, calc(100% - 40px));
}
main:has(#tabela-licitacoes) section:has(> .table-wrap > #tabela-licitacoes) {
  min-width: 0;
}
.table-wrap:has(> #tabela-licitacoes) {
  max-width: 100%;
  overflow-x: auto;
}
#tabela-licitacoes {
  table-layout: fixed;
  min-width: 1400px;
}
#tabela-licitacoes th,
#tabela-licitacoes td {
  padding: 10px 8px;
  white-space: normal;
  overflow-wrap: anywhere;
}
#tabela-licitacoes th:nth-child(1) { width: 4%; }
#tabela-licitacoes th:nth-child(2) { width: 7%; }
#tabela-licitacoes th:nth-child(3) { width: 4%; }
#tabela-licitacoes th:nth-child(4) { width: 7%; }
#tabela-licitacoes th:nth-child(5) { width: 8%; }
#tabela-licitacoes th:nth-child(6) { width: 23%; }
#tabela-licitacoes th:nth-child(7),
#tabela-licitacoes th:nth-child(8) { width: 6%; }
#tabela-licitacoes th:nth-child(9),
#tabela-licitacoes th:nth-child(10) { width: 8%; }
#tabela-licitacoes th:nth-child(11) { width: 7%; }
#tabela-licitacoes th:nth-child(12) { width: 12%; }
#tabela-licitacoes td ul { margin: 0; padding-left: 1.1em; }
@media (max-width: 600px) {
  main.container:has(#tabela-licitacoes) { width: calc(100% - 20px); }
}
table { width: 100%; border-collapse: collapse; background: #fff; }
caption { padding: 12px; font-weight: 700; text-align: left; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--borda); text-align: left; vertical-align: top; }
th { color: #fff; background: var(--azul); }
tbody tr:nth-child(even) { background: #f7f9fa; }
tbody tr:last-child td { border-bottom: 0; }
.money { white-space: nowrap; text-align: right; }

.update-info {
  margin: 16px 0;
  color: var(--texto-suave);
  font-size: .94rem;
}

.result-count { margin: 10px 0; font-weight: 700; }

.site-footer { color: #fff; background: var(--azul); }
.footer-main { display: grid; grid-template-columns: 1fr 1.5fr; gap: 34px; padding: 34px 0; }
.footer-logo { max-width: 390px; width: 100%; height: auto; }
.footer-main a { color: #fff; }
.footer-main address { font-style: normal; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.2); padding: 14px 0; }
.footer-bottom-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

.high-contrast {
  --azul: #ffff00;
  --azul-escuro: #ffff00;
  --azul-claro: #000;
  --verde: #ffff00;
  --amarelo: #00ffff;
  --texto: #fff;
  --texto-suave: #fff;
  --borda: #fff;
  --fundo: #000;
  --fundo-suave: #111;
}

.high-contrast .main-header,
.high-contrast .site-footer,
.high-contrast th,
.high-contrast .hero,
.high-contrast button,
.high-contrast .button { color: var(--texto); background: var(--fundo-suave); }
.high-contrast .main-nav a,
.high-contrast .site-footer a { color: var(--azul); }
.high-contrast .hero h1 { color: var(--texto); }
.high-contrast .card,
.high-contrast .content-box,
.high-contrast table,
.high-contrast .breadcrumb,
.high-contrast .utility-bar,
.high-contrast .utility-bar button,
.high-contrast .utility-bar a,
.high-contrast .utility-bar input,
.high-contrast .filter-panel select,
.high-contrast #atos-palavra { color: #fff; background: #000; }
.high-contrast tbody tr:nth-child(even) { background: #111; }
.high-contrast .prototype-notice,
.high-contrast .warning-notice {
  color: var(--texto);
  background: var(--fundo);
  border-left-color: var(--amarelo);
}
.high-contrast .prototype-notice a,
.high-contrast .warning-notice a { color: var(--azul); }

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .header-inner, .utility-inner { align-items: stretch; flex-direction: column; padding: 12px 0; }
  .brand img { width: 100%; max-width: 520px; }
  .main-nav ul { display: grid; grid-template-columns: 1fr 1fr; }
  .hero, .footer-main { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .management-profile { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .container { width: min(var(--largura), calc(100% - 20px)); }
  .cards, .main-nav ul { grid-template-columns: 1fr; }
  .access-tools { flex-wrap: wrap; }
  .site-search { width: 100%; }
  .filter-panel { align-items: stretch; flex-direction: column; }
  .field { width: 100%; }
}

@media print {
  .utility-bar, .main-header, .filter-panel, .site-footer, .skip-link { display: none !important; }
  main { padding: 0; }
  .table-wrap { overflow: visible; }
  th { color: #000; background: #eee; }
}
