:root {
  --navy: #12334d;
  --navy-dark: #0b263a;
  --teal: #087e91;
  --teal-dark: #066779;
  --ink: #26394a;
  --muted: #647789;
  --line: #dce6ed;
  --surface: #fff;
  --background: #f3f7fa;
  --focus: #f4c95d;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--teal-dark); }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.container {
  width: min(1180px, calc(100% - 36px));
  margin-inline: auto;
}

.topbar {
  background: var(--navy-dark);
  color: #fff;
  font-size: 13px;
}

.topbar .container {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 8px;
}

header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-block: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--navy);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 2px solid var(--teal);
  border-radius: 8px;
  color: var(--teal);
  font-size: 23px;
  font-weight: 850;
}

.brand strong {
  display: block;
  font-size: clamp(19px, 2.5vw, 26px);
  line-height: 1.25;
}

.brand small { color: var(--muted); }

nav {
  display: flex;
  align-items: center;
  gap: 8px 20px;
  flex-wrap: wrap;
}

nav a {
  color: var(--navy);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

nav a:hover { color: var(--teal); text-decoration: underline; }

nav .admin-link {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.hero {
  background: linear-gradient(115deg, #e2f0f4, #f5f8fa 75%);
  border-bottom: 1px solid var(--line);
}

.hero .container { padding-block: 44px 40px; }

.eyebrow {
  color: var(--teal-dark);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 12px;
  font-weight: 800;
}

h1 {
  margin: 8px 0 12px;
  color: var(--navy);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.2;
  letter-spacing: -.025em;
}

.hero p {
  max-width: 760px;
  margin: 0;
  color: #506779;
  font-size: 17px;
}

main { padding-block: 30px 48px; }

.panel {
  margin-bottom: 24px;
  padding: clamp(18px, 3vw, 26px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 4px 18px rgb(25 61 82 / 5%);
}

.panel h2 {
  margin: 0 0 18px;
  color: var(--navy);
  font-size: 21px;
  line-height: 1.35;
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 17px;
  align-items: end;
}

.field { min-width: 0; }

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

input, select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #cbd8e1;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input:focus, select:focus { border-color: var(--teal); }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

button:hover, .button:hover { background: var(--teal-dark); }

.secondary {
  border-color: var(--line);
  background: #edf4f7;
  color: var(--navy);
}

.secondary:hover { background: #dcebf0; }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading h2 { margin: 0; }

.count {
  color: var(--muted);
  font-size: 13px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #edf4f7;
  color: var(--navy);
  font-size: 13px;
  white-space: nowrap;
}

td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fbfc; }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  background: #e0f2f5;
  color: #075c6a;
  font-size: 12px;
  font-weight: 750;
}

.empty {
  padding: 26px 12px;
  color: var(--muted);
  text-align: center;
}

footer {
  background: var(--navy-dark);
  color: #e5edf2;
}

footer .container {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-block: 26px;
  font-size: 13px;
}

footer p { margin: 3px 0; }
footer a { color: #fff; }

@media (max-width: 900px) {
  .header-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }
  .search-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .container { width: calc(100% - 24px); }
  .topbar .container, footer .container { flex-direction: column; gap: 5px; }
  .header-row { padding-block: 16px; }
  nav { gap: 12px 16px; }
  .hero .container { padding-block: 30px; }
  .search-grid { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  th, td { padding: 10px; }
}

/* Seções institucionais */
.institutional {
  scroll-margin-top: 20px;
}

.institutional h2 {
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
}

.institutional p {
  max-width: 900px;
}

.institutional p:last-child {
  margin-bottom: 0;
}

#consulta, #edicoes {
  scroll-margin-top: 20px;
}

nav a {
  line-height: 1.5;
}

@media (max-width: 560px) {
  nav { width: 100%; }
  nav a { padding-block: 3px; }
}

/* Ajuste de navegação institucional */
.header-row {
  align-items: center;
  gap: 20px;
}

.header-row nav {
  flex: 1;
  justify-content: flex-end;
  gap: 8px 15px;
}

.header-row nav a {
  font-size: 13px;
  white-space: nowrap;
}

.header-row nav .admin-link {
  padding: 7px 10px;
}

@media (max-width: 1100px) {
  .header-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-row nav {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .header-row nav {
    display: flex;
    gap: 8px 14px;
  }

  .header-row nav a {
    white-space: normal;
  }
}
