/* Premium Glassmorphism Design System - Portal de Fiscais de Contrato */
/* Câmara Municipal de Ji-Paraná */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* --- Variáveis de Estilo & Temas --- */
:root {
  --font-primary: 'Plus Jakarta Sans', sans-serif;
  /* Tema Escuro (Padrão - Replicando Cores da Pública Tecnologia) */
  --bg-app: hsl(222, 47%, 9%);
  --bg-card: hsla(223, 47%, 13%, 0.7);
  --bg-card-hover: hsla(223, 47%, 16%, 0.85);
  --border-color: hsla(223, 47%, 22%, 0.5);
  --border-glow: hsla(207, 95%, 52%, 0.15);
  
  --text-primary: hsl(210, 40%, 96%);
  --text-secondary: hsl(215, 20%, 70%);
  --text-muted: hsl(215, 16%, 50%);
  
  --primary: hsl(207, 95%, 52%); /* Azul Oficial Pública */
  --primary-glow: hsla(207, 95%, 52%, 0.25);
  --primary-dark: hsl(207, 95%, 40%);
  --secondary: hsl(28, 92%, 54%); /* Laranja/Ouro Oficial Pública */
  --secondary-glow: hsla(28, 92%, 54%, 0.2);
  
  --accent-vigente: hsl(150, 84%, 43%);
  --accent-vigente-glow: hsla(150, 84%, 43%, 0.15);
  --accent-encerrado: hsl(215, 15%, 60%);
  --accent-encerrado-glow: hsla(215, 15%, 60%, 0.1);
  --accent-error: hsl(350, 80%, 60%);
  --accent-error-glow: hsla(350, 80%, 60%, 0.15);
  
  --glass-blur: 12px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-card: 0 4px 20px 0 rgba(0, 0, 0, 0.15);
}

/* Tema Claro */
[data-theme="light"] {
  --bg-app: hsl(210, 20%, 96%);
  --bg-card: hsla(0, 0%, 100%, 0.85);
  --bg-card-hover: hsla(0, 0%, 100%, 0.95);
  --border-color: hsla(215, 30%, 84%, 0.8);
  --border-glow: hsla(207, 95%, 42%, 0.08);
  
  --text-primary: hsl(222, 47%, 12%);
  --text-secondary: hsl(215, 25%, 35%);
  --text-muted: hsl(215, 15%, 55%);
  
  --primary: hsl(207, 95%, 42%); /* Azul Oficial Pública */
  --primary-glow: hsla(207, 95%, 42%, 0.15);
  --primary-dark: hsl(207, 95%, 32%);
  --secondary: hsl(28, 92%, 46%); /* Laranja/Ouro Oficial Pública */
  --secondary-glow: hsla(28, 92%, 46%, 0.15);
  
  --accent-vigente: hsl(150, 75%, 35%);
  --accent-vigente-glow: hsla(150, 75%, 35%, 0.12);
  --accent-encerrado: hsl(215, 12%, 40%);
  --accent-encerrado-glow: hsla(215, 12%, 40%, 0.08);
  --accent-error: hsl(350, 75%, 40%);
  --accent-error-glow: hsla(350, 75%, 40%, 0.1);
}

/* --- Resets --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  transition: var(--transition-smooth);
  overflow-x: hidden;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0.75rem 1rem;
}

/* --- Layout Container --- */
.app-container {
  max-width: 1400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* --- Cabeçalho (Header) --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-main);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Logotipo Minimalista */
.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-swoosh {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 2px 8px var(--primary-glow));
}

.logo-swoosh path {
  fill: var(--primary);
  transition: var(--transition-smooth);
}

.title-section h1 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--text-primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title-section p {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

.actions-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Navegação entre Páginas */
.header-nav {
  display: flex;
  gap: 0.4rem;
}

.nav-item {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--border-color);
  border-color: rgba(242, 101, 34, 0.25);
  color: var(--secondary);
}

.theme-toggle-btn {
  background: var(--border-color);
  border: 1px solid transparent;
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.theme-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
  transform: translateY(-2px);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Cards de Estatísticas --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.85rem 1.15rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0;
  transition: var(--transition-smooth);
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-glow);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 0 15px var(--border-glow);
}

.stat-card:hover::before {
  opacity: 1;
}

/* Glow dourado especial no cartão de valor global */
.stat-card.value-card::before {
  background: linear-gradient(90deg, transparent, var(--secondary), transparent);
}

.stat-card.value-card:hover {
  border-color: var(--secondary-glow);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 0 15px var(--secondary-glow);
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card.value-card .stat-value {
  color: var(--secondary);
}

.stat-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* --- Painel Principal --- */
.main-panel {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-main);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* --- Filtros (Filtragem Legal e Organizada) --- */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.filter-bar {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr) auto;
  gap: 0.5rem;
  align-items: end;
}

@media (max-width: 1024px) {
  .filter-bar {
    grid-template-columns: 1fr 1fr;
  }
  .filter-bar .btn-clear-col {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .filter-bar {
    grid-template-columns: 1fr;
  }
  .filter-bar .btn-clear-col {
    grid-column: span 1;
  }
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper svg {
  position: absolute;
  left: 0.75rem;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2.5;
}

.input-wrapper input {
  padding-left: 2.25rem !important;
}

.filter-group input, .filter-group select {
  width: 100%;
  height: 34px;
  background: hsla(223, 47%, 10%, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 0 0.65rem;
  font-family: var(--font-primary);
  font-size: 0.75rem;
  font-weight: 500;
  outline: none;
  transition: var(--transition-smooth);
}

[data-theme="light"] .filter-group input, [data-theme="light"] .filter-group select {
  background: rgba(255, 255, 255, 0.7);
}

.filter-group input::placeholder {
  color: var(--text-muted);
}

.filter-group input:focus, .filter-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
  background: hsla(223, 47%, 10%, 0.6);
}

[data-theme="light"] .filter-group input:focus, [data-theme="light"] .filter-group select:focus {
  background: #fff;
}

.filter-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='gray' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 14px;
  padding-right: 2rem;
}

.btn-clear {
  height: 34px;
  padding: 0 1rem;
  background: transparent;
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}

.btn-clear:hover {
  border-color: var(--accent-error);
  color: var(--accent-error);
  background: rgba(239, 68, 68, 0.05);
}

.btn-clear svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* --- Barra de Informações e Ações --- */
.results-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.65rem;
}

.results-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.results-count span {
  color: var(--text-primary);
  font-weight: 800;
}

.export-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-export {
  height: 30px;
  padding: 0 0.75rem;
  background: hsla(223, 47%, 18%, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
}

[data-theme="light"] .btn-export {
  background: rgba(255, 255, 255, 0.9);
}

.btn-export:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.btn-export svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* --- Tabela Customizada --- */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

/* Ocultar barra de rolagem */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.fiscais-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.75rem;
}

.fiscais-table th {
  background: hsla(223, 47%, 10%, 0.5);
  padding: 0.6rem 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .fiscais-table th {
  background: rgba(241, 245, 249, 0.8);
}

.fiscais-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 500;
  vertical-align: middle;
}

.fiscais-table tbody tr {
  transition: var(--transition-smooth);
  cursor: pointer;
}

.fiscais-table tbody tr:hover {
  background: hsla(223, 47%, 20%, 0.35);
}

[data-theme="light"] .fiscais-table tbody tr:hover {
  background: rgba(241, 245, 249, 0.5);
}

/* Colunas Ordenáveis */
th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  color: var(--text-primary);
}

.sort-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sort-header svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  opacity: 0.5;
  transition: var(--transition-smooth);
}

th.sortable:hover .sort-header svg {
  opacity: 1;
}

/* Badge de Status */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.vigente {
  background: var(--accent-vigente-glow);
  color: var(--accent-vigente);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge.encerrado {
  background: var(--accent-encerrado-glow);
  color: var(--accent-encerrado);
  border: 1px solid rgba(156, 163, 175, 0.3);
}

/* Estilo para links de contrato */
.contract-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.contract-link:hover {
  text-decoration: underline;
}

.contract-link svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* Botão Detalhar */
.btn-details {
  background: hsla(223, 47%, 20%, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

[data-theme="light"] .btn-details {
  background: rgba(241, 245, 249, 0.8);
}

.btn-details:hover {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
  color: #fff;
  transform: scale(1.05);
}

.btn-details svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* --- Rodapé da Tabela e Paginação --- */
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.per-page-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.per-page-group select {
  height: 26px;
  background: hsla(223, 47%, 10%, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-primary);
  padding: 0 1.25rem 0 0.4rem;
  font-family: var(--font-primary);
  font-size: 0.7rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='gray' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.35rem center;
  background-size: 8px;
}

[data-theme="light"] .per-page-group select {
  background-color: #fff;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pagination-btn {
  background: hsla(223, 47%, 18%, 0.5);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.7rem;
  transition: var(--transition-smooth);
}

[data-theme="light"] .pagination-btn {
  background: rgba(241, 245, 249, 0.8);
}

.pagination-btn:hover:not(:disabled) {
  background: hsla(223, 47%, 22%, 0.8);
  border-color: var(--primary);
}

.pagination-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 10px var(--primary-glow);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* --- Estado Vazio --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  gap: 0.75rem;
  text-align: center;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  stroke: var(--text-muted);
  stroke-width: 1.5;
  fill: none;
}

.empty-state p {
  font-size: 0.85rem;
  font-weight: 600;
}

/* --- Linha Cancelada / Com Alerta Especial --- */
.fiscais-table tbody tr.table-error {
  background: rgba(239, 68, 68, 0.04) !important;
}

.fiscais-table tbody tr.table-error:hover {
  background: rgba(239, 68, 68, 0.08) !important;
}

.fiscais-table tbody tr.table-error td {
  border-bottom-color: rgba(239, 68, 68, 0.15) !important;
}

.fiscais-table tbody tr.table-error td .contract-link {
  color: var(--accent-error) !important;
}

.fiscais-table tbody tr.table-error .badge {
  background: var(--accent-error-glow) !important;
  color: var(--accent-error) !important;
  border-color: rgba(239, 68, 68, 0.2) !important;
}

/* --- Modal com Glassmorphism Real --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 9, 20, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 100%;
  max-width: 680px;
  box-shadow: var(--shadow-main);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title-group h2 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-title-group p {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 0.1rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.modal-close-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

.modal-body {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-section-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.25rem;
}

.modal-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.modal-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

@media (max-width: 550px) {
  .modal-grid-2, .modal-grid-3 {
    grid-template-columns: 1fr;
  }
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.detail-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.detail-val {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-primary);
}

.detail-box-desc {
  background: hsla(223, 47%, 10%, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.76rem;
  color: var(--text-primary);
  line-height: 1.4;
  font-weight: 500;
}

[data-theme="light"] .detail-box-desc {
  background: rgba(241, 245, 249, 0.8);
}

.modal-footer {
  padding: 0.75rem 1.15rem;
  border-top: 1px solid var(--border-color);
  background: hsla(223, 47%, 10%, 0.2);
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

[data-theme="light"] .modal-footer {
  background: rgba(241, 245, 249, 0.5);
}

.btn-modal {
  height: 32px;
  padding: 0 1rem;
  border-radius: 6px;
  font-family: var(--font-primary);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
  outline: none;
}

.btn-modal-cancel {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-modal-cancel:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.btn-modal-action {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
}

.btn-modal-action:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 0 12px var(--primary-glow);
}

.btn-modal-action svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* --- Mobile Stack Cards (Substitutos da Tabela em Celulares) --- */
.mobile-cards-container {
  display: none;
  flex-direction: column;
  gap: 0.65rem;
}

.mobile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  box-shadow: var(--shadow-card);
}

.mobile-card.table-error {
  border-color: rgba(239, 68, 68, 0.2) !important;
}

.mobile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.35rem;
}

.mobile-card-header .fiscal-name {
  font-weight: 800;
  font-size: 0.8rem;
}

.mobile-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.72rem;
}

.mobile-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.mobile-row .label {
  color: var(--text-secondary);
  font-weight: 600;
  min-width: 80px;
}

.mobile-row .val {
  text-align: right;
  font-weight: 700;
  color: var(--text-primary);
}

.mobile-card-footer {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--border-color);
  padding-top: 0.35rem;
  gap: 0.5rem;
}

.btn-mobile-details {
  height: 30px;
  padding: 0 0.75rem;
  background: var(--border-color);
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-mobile-details svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

@media (max-width: 768px) {
  .table-container {
    display: none;
  }
  .mobile-cards-container {
    display: flex;
  }
}

/* --- Título Interno da Seção --- */
.page-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.page-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--text-primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* --- Rodapé Oficial (Footer) --- */
.official-footer {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-main);
  margin-top: 0.5rem;
  width: 100%;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  font-family: var(--font-primary);
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-col h3 {
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  margin: 0;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 4px;
  display: inline-block;
}

.footer-col .entity-name {
  font-weight: 800;
  color: var(--text-primary);
}

.footer-col p {
  color: var(--text-secondary);
  margin: 0;
}

.footer-col p strong {
  color: var(--text-primary);
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.footer-col ul li a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-smooth);
}

.footer-col ul li a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.footer-col .contact-highlight {
  color: var(--secondary) !important;
  font-weight: 800;
}

.footer-col .contact-highlight:hover {
  text-decoration: underline;
}

.footer-col a {
  color: var(--primary);
  text-decoration: none;
}

.footer-col a:hover {
  text-decoration: underline;
}

.social-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.social-links a {
  display: inline-flex;
  transition: var(--transition-smooth);
}

.social-links a:hover {
  transform: translateY(-2px);
}

.social-links img {
  width: 20px;
  height: 20px;
}

/* --- Selo Ouro de Transparência --- */
.transparency-seal {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: hsla(28, 92%, 54%, 0.08);
  border: 1px solid rgba(242, 101, 34, 0.25);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  box-shadow: 0 0 10px rgba(242, 101, 34, 0.05);
  transition: var(--transition-smooth);
  user-select: none;
}

.transparency-seal:hover {
  background: hsla(28, 92%, 54%, 0.12);
  border-color: var(--secondary);
  box-shadow: 0 0 15px var(--secondary-glow);
  transform: translateY(-1px);
}

[data-theme="light"] .transparency-seal {
  background: hsla(28, 92%, 46%, 0.05);
  border-color: hsla(28, 92%, 46%, 0.2);
}

.seal-icon {
  width: 20px;
  height: 20px;
  fill: var(--secondary);
  stroke: var(--secondary);
  stroke-width: 1;
  filter: drop-shadow(0 0 4px var(--secondary-glow));
}

.seal-text {
  display: flex;
  flex-direction: column;
}

.seal-label {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.seal-grade {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--secondary);
  letter-spacing: 0.05em;
  margin-top: 1px;
  line-height: 1.1;
}
