/* ── Reset & Variáveis ───────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&display=swap');

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

:root {
  /* Cores base — light mode */
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface2: #eef1f8;
  --border: #d4daea;
  --text: #1a2742;
  --text-muted: #6b7a99;

  /* Paleta Jaboatão da Imagem */
  --navy: #2132A3;
  /* Azul principal da imagem */
  --navy-light: #4A62D1;
  /* Azul claro para hover/badges */
  --navy-dark: #141D61;
  /* Azul escuro para textos */
  --gold: #FFC200;
  /* Amarelo/Laranja principal */
  --gold-light: #FFD64B;
  /* Amarelo claro para destaques */
  --gold-dark: #E58800;
  /* Laranja escuro */
  --green: #029642;
  /* Verde vibrante da estrela/seta */
  --blue-light: #00B5E2;
  /* Ciano do coração */

  /* Semânticas */
  --accent: #FFC200;
  --success: #029642;
  --warn: #E5A100;
  --danger: #D03030;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 2px 12px rgba(26, 58, 107, 0.10);
  --shadow-md: 0 4px 24px rgba(26, 58, 107, 0.14);
  --font: 'DM Sans', sans-serif;
  --ease: 0.18s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.page-wrapper {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  background: var(--navy);
  border-bottom: 4px solid transparent;
  border-image: linear-gradient(to right, var(--navy-light), var(--blue-light), var(--green), var(--gold)) 1;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 16px rgba(26, 58, 107, 0.25);
}

.header-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 62px;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--navy-dark);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(245, 168, 0, 0.4);
}

.logo-text {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  white-space: nowrap;
}

.logo-text span {
  color: var(--gold-light);
}

header nav {
  margin-left: auto;
}

header nav a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  transition: var(--ease);
}

header nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.page-hero {
  padding: 48px 0 36px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 36px;
}

.page-hero h1 {
  font-weight: 800;
  font-size: clamp(26px, 5vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.5px;
  color: var(--navy-dark);
}

/* .page-hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--blue-light), var(--green), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;  
} */

#em1 {
  color: var(--green);
}

.page-hero p {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 8px;
}

/* ── Stats ───────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--navy), var(--blue-light));
}

.stat-card:nth-child(2)::before {
  background: linear-gradient(90deg, var(--blue-light), var(--green));
}

.stat-card:nth-child(3)::before {
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-weight: 800;
  font-size: clamp(22px, 3vw, 30px);
  color: var(--navy-dark);
  line-height: 1;
  word-break: break-all;
}

/* ── Filtros ─────────────────────────────────────────────────────────────── */
.filtro-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}

.filtro-grupo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filtro-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.filtro-select {
  background: var(--surface2);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 30px 7px 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%236b7a99' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  transition: border-color var(--ease);
  max-width: 100%;
}

.filtro-select-sm {
  width: 150px;
}

.filtro-select-md {
  width: 200px;
  max-width: 220px;
}

.filtro-select-lg {
  width: 230px;
}

.filtro-select:focus {
  border-color: var(--navy-light);
  outline: 2px solid rgba(37, 77, 150, 0.15);
}

.filtro-direita {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}

.filtro-loading-empresas {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.filtro-contador {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
  font-weight: 500;
}

.btn-limpar {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  padding: 5px 11px;
  border-radius: 8px;
  transition: var(--ease);
  white-space: nowrap;
}

.btn-limpar:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(208, 48, 48, 0.06);
}

/* ── Section heading ─────────────────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-head h2 {
  font-weight: 700;
  font-size: 18px;
  color: var(--navy-dark);
}

.section-badge {
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 100px;
  border: 1px solid var(--border);
}

.section-badge.warn {
  background: rgba(245, 168, 0, 0.12);
  color: var(--gold-dark);
  border-color: rgba(245, 168, 0, 0.4);
}

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 40px;
  box-shadow: var(--shadow);
}

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

thead th {
  background: var(--navy);
  padding: 11px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.75);
  border-bottom: 2px solid var(--gold);
  white-space: normal;
  word-break: break-word;
  vertical-align: bottom;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--ease);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: #eef3fb;
}

tbody td {
  padding: 11px 10px;
  font-size: 13px;
  color: var(--text);
  vertical-align: middle;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.td-objeto {
  width: 28%;
}

.td-valor {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  font-weight: 500;
}

tfoot tr {
  background: var(--surface2);
}

tfoot td {
  padding: 13px 16px;
  font-size: 14px;
  border-top: 2px solid var(--border);
  color: var(--navy-dark);
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-default {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-concluida {
  background: rgba(30, 143, 58, 0.1);
  color: var(--success);
  border: 1px solid rgba(30, 143, 58, 0.3);
}

.badge-execucao {
  background: rgba(26, 58, 107, 0.1);
  color: var(--navy-light);
  border: 1px solid rgba(26, 58, 107, 0.25);
}

.badge-paralisada {
  background: rgba(224, 120, 0, 0.1);
  color: var(--warn);
  border: 1px solid rgba(224, 120, 0, 0.3);
}

.badge-cancelada {
  background: rgba(208, 48, 48, 0.1);
  color: var(--danger);
  border: 1px solid rgba(208, 48, 48, 0.3);
}

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  width: 100%;
}

.progress-bar-wrap>div {
  flex: 1;
  min-width: 0;
  height: 7px;
  background: var(--surface2);
  border-radius: 100px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy-light), var(--gold));
  border-radius: 100px;
  transition: width 1s ease;
}

.progress-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 600;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-detalhes {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--navy);
  border: none;
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 8px;
  white-space: nowrap;
  transition: var(--ease);
  box-shadow: 0 2px 6px rgba(26, 58, 107, 0.25);
}

.btn-detalhes:hover {
  background: var(--navy-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 58, 107, 0.3);
}

.btn-detalhes-warn {
  background: var(--warn);
  box-shadow: 0 2px 6px rgba(224, 120, 0, 0.3);
}

.btn-detalhes-warn:hover {
  background: #c96800;
}

.btn-voltar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--navy-light);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--navy-light);
  background: rgba(37, 77, 150, 0.05);
  transition: var(--ease);
  margin-bottom: 28px;
}

.btn-voltar:hover {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  display: none;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state::before {
  content: '◎';
  display: block;
  font-size: 28px;
  margin-bottom: 10px;
  opacity: 0.3;
}

/* ── Loading ─────────────────────────────────────────────────────────────── */
.loading-row td {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Célula objeto ───────────────────────────────────────────────────────── */
.obj-principal {
  font-weight: 600;
  color: var(--navy-dark);
  line-height: 1.4;
  white-space: normal;
}

.obj-secundario {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}

.obj-sem-info {
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}

/* btn texto/ícone */
.btn-texto {
  display: inline;
}

.btn-icone-only {
  display: none;
}

/* ══════════════════════════════════════════════════════════════════════════ */
/* DETALHE DA OBRA                                                           */
/* ══════════════════════════════════════════════════════════════════════════ */

.detalhe-hero {
  padding: 40px 0 30px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 32px;
}

.detalhe-hero h1 {
  font-weight: 800;
  font-size: clamp(20px, 4vw, 34px);
  letter-spacing: -0.3px;
  line-height: 1.2;
  margin-bottom: 10px;
  color: var(--navy-dark);
}

.obra-subtitulo {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 6px;
  line-height: 1.5;
}

.detalhe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  align-items: center;
  color: var(--text-muted);
  font-size: 13px;
}

.detalhe-meta strong {
  color: var(--navy-dark);
  font-weight: 600;
}

/* Cards detalhe */
.detalhe-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

.detalhe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
}

.card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.card-value {
  font-weight: 700;
  font-size: clamp(16px, 2vw, 20px);
  color: var(--navy-dark);
  word-break: break-word;
}

.card-accent {
  border-color: rgba(245, 168, 0, 0.4);
  background: rgba(245, 168, 0, 0.05);
  border-top: 3px solid var(--gold);
}

.card-accent .card-value {
  color: var(--gold-dark);
}

.detalhe-grid-contrato {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 20px;
}

.card-value-sm {
  font-size: clamp(14px, 1.6vw, 17px);
  line-height: 1.35;
}

.card-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.4;
}

.texto-muted {
  color: var(--text-muted) !important;
  font-weight: 500 !important;
}

/* Colunas secretaria / empresa */
.td-info {
  width: 16%;
  vertical-align: top;
}

.info-principal {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-dark);
  line-height: 1.35;
  word-break: break-word;
}

.info-secundaria {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  word-break: break-word;
}

.info-nao-informada {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* Progresso detalhe */
.detalhe-progresso {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 36px;
  box-shadow: var(--shadow);
}

.prog-label-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.prog-label-row strong {
  color: var(--navy-dark);
  display: block;
  font-size: 16px;
  font-weight: 700;
}

.prog-track {
  position: relative;
  height: 14px;
  background: var(--surface2);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

.prog-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 100px;
  transition: width 1.2s cubic-bezier(.23, 1, .32, 1);
}

.prog-medido {
  background: rgba(37, 77, 150, 0.25);
  z-index: 1;
}

.prog-pago {
  background: linear-gradient(90deg, var(--navy-light), var(--gold));
  z-index: 2;
}

.prog-pct-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.prog-pct-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
}

.medido-tag {
  background: rgba(37, 77, 150, 0.1);
  color: var(--navy-light);
  border: 1px solid rgba(37, 77, 150, 0.2);
}

.pago-tag {
  background: rgba(245, 168, 0, 0.12);
  color: var(--gold-dark);
  border: 1px solid rgba(245, 168, 0, 0.3);
}

/* ── Mapa ────────────────────────────────────────────────────────────────── */
.section-mapa {
  margin-bottom: 40px;
}

#mapa-container {
  display: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  height: 420px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

#mapa {
  height: 100%;
  width: 100%;
}

.mapa-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* Leaflet popup light */
.leaflet-popup-content-wrapper {
  background: #fff !important;
  color: var(--navy-dark) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  box-shadow: var(--shadow-md) !important;
}

.leaflet-popup-tip {
  background: #fff !important;
}

.leaflet-popup-content strong {
  color: var(--navy-dark);
  font-weight: 700;
}

/* ── Tabela de itens ─────────────────────────────────────────────────────── */
.tabela-itens {
  table-layout: fixed;
}

.tabela-itens .td-num {
  width: 36px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.tabela-itens .td-desc {
  line-height: 1.45;
  font-size: 13px;
  white-space: normal;
  color: var(--text);
  overflow-wrap: anywhere;
}

.tabela-itens .td-center {
  text-align: center;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 13px;
}

.tabela-itens .td-right {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.tabela-itens .td-destaque {
  color: var(--navy-dark);
  font-weight: 600;
}

.tabela-itens tfoot .tfoot-total {
  background: var(--navy);
}

.tabela-itens tfoot .tfoot-total td {
  color: #fff;
  font-size: 14px;
  border-top: none;
}

.tabela-itens tfoot .tfoot-total .td-destaque {
  color: var(--gold-light);
  font-size: 15px;
}

/* ── Documentos ──────────────────────────────────────────────────────────── */
.docs-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.doc-grupo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.doc-grupo-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--navy);
  font-weight: 700;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  border-bottom: 2px solid var(--gold);
}

.doc-grupo-count {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 100px;
}

.doc-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background var(--ease);
  cursor: pointer;
}

.doc-card:last-child {
  border-bottom: none;
}

.doc-card:hover {
  background: #eef3fb;
}

.doc-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.doc-descricao {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.doc-arquivo {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
}

.doc-baixar {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  background: rgba(37, 77, 150, 0.08);
  border: 1.5px solid rgba(37, 77, 150, 0.25);
  padding: 5px 13px;
  border-radius: 8px;
  white-space: nowrap;
  transition: var(--ease);
}

.doc-card:hover .doc-baixar {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.doc-sigiloso .doc-descricao {
  color: var(--text-muted);
}

.doc-sigiloso .doc-baixar {
  color: var(--text-muted);
  background: var(--surface2);
  border-color: var(--border);
  cursor: not-allowed;
}

/* ══════════════════════════════════════════════════════════════════════════ */
/* RESPONSIVIDADE                                                            */
/* ══════════════════════════════════════════════════════════════════════════ */

/*
  Estratégia de ocultação progressiva (sem scroll horizontal):
  ≥1024px  — 10 colunas  (todas)
   <1024px  —  9 colunas  (oculta Valor Pago)
   <860px   —  7 colunas  (oculta também Conclusão + Progresso)
   <640px   —  5 colunas  (oculta também Empresa + Início)
   <480px   —  3 colunas  (oculta também Situação; mantém Objeto, Valor Medido, Ações)
*/

/* ── ≤1024px: oculta "Valor Pago" (col 7) ─────────────────────── */
@media (max-width: 1024px) {
  .tabela-obras thead th:nth-child(7),
  .tabela-obras tbody td:nth-child(7) {
    display: none;
  }

  .detalhe-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ajusta larguras relativas com 9 colunas */
  .tabela-obras .td-objeto { width: 28%; }
  .tabela-obras .td-info   { width: 16%; }
}

/* ── ≤860px: oculta Conclusão (col 6) + Progresso (col 9) ─────── */
@media (max-width: 860px) {
  .tabela-obras thead th:nth-child(6),
  .tabela-obras tbody td:nth-child(6),
  .tabela-obras thead th:nth-child(9),
  .tabela-obras tbody td:nth-child(9) {
    display: none;
  }

  /* texto → ícone no botão */
  .btn-texto      { display: none; }
  .btn-icone-only { display: inline; }
  .btn-detalhes   { padding: 7px 10px; }

  /* ajusta larguras com 7 colunas visíveis */
  .tabela-obras .td-objeto { width: 32%; }
  .tabela-obras .td-info   { width: 18%; }
}

/* ── ≤768px: layout geral ─────────────────────────────────────── */
@media (max-width: 768px) {
  .page-wrapper {
    padding: 0 16px 60px;
  }

  .page-hero {
    padding: 32px 0 24px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .filtro-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .filtro-grupo {
    width: 100%;
  }

  .filtro-select,
  .filtro-select-sm,
  .filtro-select-lg {
    width: 100%;
    min-width: unset;
  }

  .filtro-direita {
    margin-left: 0;
    justify-content: space-between;
    width: 100%;
  }

  #mapa-container {
    height: 300px;
  }
}

/* ── ≤640px: oculta Empresa (col 3) + Início (col 5) ─────────── */
@media (max-width: 640px) {
  .tabela-obras thead th:nth-child(3),
  .tabela-obras tbody td:nth-child(3),
  .tabela-obras thead th:nth-child(5),
  .tabela-obras tbody td:nth-child(5) {
    display: none;
  }

  /* tabela paralisadas */
  .tabela-paralisadas thead th:nth-child(3),
  .tabela-paralisadas tbody td:nth-child(3),
  .tabela-paralisadas thead th:nth-child(4),
  .tabela-paralisadas tbody td:nth-child(4) {
    display: none;
  }

  .obj-secundario { display: none; }

  /* ajusta larguras com 5 colunas visíveis */
  .tabela-obras .td-objeto { width: 42%; }
  .tabela-obras .td-info   { width: 24%; }
}

/* ── ≤480px: oculta Situação (col 4) — 3 colunas finais ────────── */
@media (max-width: 480px) {
  .tabela-obras thead th:nth-child(4),
  .tabela-obras tbody td:nth-child(4) {
    display: none;
  }

  /* paralisadas: mantém Objeto, Valor Pago, Ações */
  .tabela-paralisadas thead th:nth-child(2),
  .tabela-paralisadas tbody td:nth-child(2),
  .tabela-paralisadas thead th:nth-child(5),
  .tabela-paralisadas tbody td:nth-child(5) {
    display: none;
  }

  .tabela-obras .td-objeto { width: 55%; }

  tbody td { font-size: 12px; padding: 9px 8px; }
  thead th  { font-size: 9px;  padding: 9px 8px; }
}

/* ── ≤560px ────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .page-wrapper {
    padding: 0 12px 50px;
  }

  header {
    padding: 0 14px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stats-grid .stat-card:last-child {
    grid-column: 1 / -1;
  }

  .detalhe-grid {
    grid-template-columns: 1fr 1fr;
  }

  #mapa-container {
    height: 250px;
  }

  .detalhe-hero h1 {
    font-size: clamp(18px, 5vw, 26px);
  }

  .prog-label-row {
    flex-direction: column;
    gap: 4px;
  }

  .doc-arquivo {
    display: none;
  }

  .doc-card {
    padding: 11px 14px;
  }

  .tabela-itens thead th:nth-child(3),
  .tabela-itens thead th:nth-child(4),
  .tabela-itens thead th:nth-child(5),
  .tabela-itens tbody td:nth-child(3),
  .tabela-itens tbody td:nth-child(4),
  .tabela-itens tbody td:nth-child(5) {
    display: none;
  }
}

/* ── ≤380px ────────────────────────────────────────────────────── */
@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card:last-child {
    grid-column: auto;
  }

  .detalhe-grid {
    grid-template-columns: 1fr;
  }

  .logo-text {
    font-size: 14px;
  }
}

/* ── Botões de exportação ───────────────────────────────────────────────────── */
.export-bar {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 20px;
}

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--ease);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-export svg {
  flex-shrink: 0;
}

.btn-export:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-export-csv:hover {
  border-color: #2ea043;
  background: rgba(46, 160, 67, 0.1);
  color: #2ea043;
}

.btn-export-excel:hover {
  border-color: #1f7e3c;
  background: rgba(31, 126, 60, 0.1);
  color: #1f7e3c;
}

@media (max-width: 640px) {
  .export-bar {
    justify-content: stretch;
  }
  .btn-export {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 900px) {
  .detalhe-grid-contrato {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .btn-export span {
    display: none;
  }
  .btn-export {
    padding: 8px 12px;
  }
  .btn-export svg {
    margin: 0;
  }
}