/* ============================================================
   SISTEMA DE CONTROLE DE CONTRATOS E EMPENHOS
   Prefeitura Municipal de Conde / PB — Secretaria de Administração
   Tema Escuro Institucional & UI/UX Premium
   ============================================================ */

/* ---------- CSS CUSTOM PROPERTIES & PALETA HERÁLDICA (CIDADE DE CONDE / PB) ---------- */
:root {
  /* Paleta Heráldica Extraída do Brasão Oficial da Cidade de Conde */
  --azul-celeste: #3898EC;
  --azul-primario: #1E6091;
  --azul-marinho: #0B2E59;
  --azul-marinho-grad: #154580;
  --azul-hover: #164E8A;
  --azul-destaque: #2563EB;
  --azul-escuro: #071933;

  --amarelo-ouro: #FFD700;
  --amarelo: #FACC15;
  --amarelo-brilhante: #FBBF24;
  --amarelo-bg: rgba(250, 204, 21, 0.16);

  --vermelho-oficial: #E31E24;
  --vermelho: #DC2626;
  --vermelho-brilhante: #EF4444;
  --vermelho-bg: rgba(227, 30, 36, 0.14);

  --verde-oficial: #16A34A;
  --verde: #16A34A;
  --verde-brilhante: #22C55E;
  --verde-bg: rgba(22, 163, 74, 0.14);

  /* Sombras & Geometria Corporativa Executiva */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 8px;
  --transition: 0.15s ease;
  --header-height: 66px;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* ---------- TEMA CLARO INSTITUCIONAL (PADRÃO PREFEITURA DE CONDE) ---------- */
:root,
html[data-theme="claro"] {
  --fundo: #F4F7FB;
  --card-bg: #FFFFFF;
  --card-bg-elevated: #F8FAFC;
  --subcard-bg: #F1F5F9;
  --input-bg: #FFFFFF;
  --texto: #0F172A;
  --texto-claro: #334155;
  --texto-muted: #64748B;
  --borda: #E2E8F0;
  --borda-hover: #CBD5E1;
  --borda-foco: #2563EB;
  --sombra: 0 2px 8px rgba(15, 23, 42, 0.06);
  --sombra-elevada: 0 10px 25px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --card-numero-color: #1E40AF;
  --total-destaque-color: #1E6091;
  --table-th-bg: #F8FAFC;
  --table-border: #E2E8F0;
}

/* ---------- TEMA ESCURO MODERNO INSTITUCIONAL ---------- */
html[data-theme="escuro"] {
  --fundo: #0B132B;
  --card-bg: #162035;
  --card-bg-elevated: #1C2A44;
  --subcard-bg: #111A2D;
  --input-bg: #0E1726;
  --texto: #F1F5F9;
  --texto-claro: #94A3B8;
  --texto-muted: #64748B;
  --borda: #23334D;
  --borda-hover: #374E70;
  --borda-foco: #3898EC;
  --sombra: 0 4px 14px rgba(0, 0, 0, 0.3);
  --sombra-elevada: 0 12px 36px rgba(0, 0, 0, 0.5);
  --card-numero-color: #93C5FD;
  --total-destaque-color: #38BDF8;
  --table-th-bg: #0E1726;
  --table-border: #23334D;
}

/* ---------- RESET & BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--azul-destaque); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  font-family: inherit; font-size: 0.93rem;
  border: 1.5px solid var(--borda);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  background: var(--input-bg);
  color: var(--texto);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--azul-hover);
  box-shadow: 0 0 0 3px rgba(0, 102, 191, 0.25);
}
textarea { resize: vertical; }
label { display: block; font-weight: 600; font-size: 0.82rem; color: var(--texto-claro); margin-bottom: 0.3rem; }
.required { color: var(--vermelho); }
code { background: rgba(0, 102, 191, 0.15); color: #60A5FA; padding: 0.15em 0.4em; border-radius: 3px; font-size: 0.88em; }

/* Scrollbar customizada */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--fundo); }
::-webkit-scrollbar-thumb { background: var(--borda-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--azul-hover); }

/* ---------- LOGIN SCREEN ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, #154580 0%, #0B2E59 45%, #071933 100%);
  padding: 1.5rem;
}
.login-card {
  background: var(--card-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius);
  box-shadow: var(--sombra-elevada);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  animation: fadeSlideUp 0.3s ease;
  position: relative;
}
.login-header {
  background: linear-gradient(135deg, var(--azul-marinho) 0%, var(--azul-marinho-grad) 100%);
  color: #FFF;
  text-align: center;
  padding: 2rem 1.6rem 1.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
}
.login-brand-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.login-brasao-img {
  height: 60px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}
.login-brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}
.login-header .brand-sub,
.header-brand .brand-sub {
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 3px;
}
.login-header .brand-main,
.header-brand .brand-main {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  text-transform: uppercase;
  line-height: 0.95;
}
.login-header .brand-slogan,
.header-brand .brand-slogan {
  font-size: 0.72rem;
  font-style: normal;
  color: #94A3B8;
  font-weight: 500;
  margin-top: 4px;
  letter-spacing: 0.03em;
}
.login-system-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin: 14px auto 12px;
  width: 90%;
}
.login-system-box h2 {
  font-size: 0.94rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: 0.2px;
}
.login-system-box .login-subtitle {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 0.25rem;
  letter-spacing: 0.3px;
}
#loginForm { padding: 1.6rem 1.6rem 1.4rem; }
#loginForm .form-group { margin-bottom: 1rem; }
#loginForm label { color: var(--texto-claro); font-weight: 600; font-size: 0.8rem; }
.login-error { color: var(--vermelho); font-size: 0.82rem; text-align: center; min-height: 1.2rem; margin-bottom: 0.5rem; }
.btn-login {
  width: 100%; padding: 0.7rem;
  background: #2563EB;
  color: #FFF; border: 1px solid #1D4ED8;
  border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600;
  transition: all var(--transition);
}
.btn-login:hover {
  background: #1D4ED8;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.login-hint { text-align: center; font-size: 0.76rem; color: var(--texto-muted); margin-top: 1.1rem; }

/* Password wrapper & toggle */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-wrapper input {
  padding-right: 2.75rem !important;
  width: 100%;
}
.btn-toggle-password {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--texto-muted);
  cursor: pointer;
  padding: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: color 0.2s ease;
  z-index: 2;
}
.btn-toggle-password:hover {
  color: var(--texto);
}
.btn-toggle-password:focus {
  outline: none;
  color: #38BDF8;
}

/* Rodapé Institucional na tela de Login */
.login-institutional-footer {
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  color: var(--texto-muted);
  text-align: center;
  line-height: 1.4;
}
.login-institutional-footer i {
  color: #38BDF8;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* Empty State Moderno e Sóbrio */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3.5rem 1.5rem;
  margin: 2rem auto;
  max-width: 580px;
  background: var(--card-bg);
  border: 1px dashed var(--borda);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.2rem;
  border: 1px solid rgba(37, 99, 235, 0.25);
}
.empty-state-icon i {
  font-size: 1.8rem;
  color: #60A5FA;
}
.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--texto);
  margin-bottom: 0.5rem;
}
.empty-state p {
  font-size: 0.88rem;
  color: var(--texto-muted);
  line-height: 1.5;
  margin-bottom: 1.5rem;
  max-width: 440px;
}
.empty-state .btn-primary {
  padding: 0.65rem 1.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---------- APP HEADER ---------- */
#appHeader {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #0B1E38 0%, #0F2D54 100%);
  color: #FFF; padding: 0 1.6rem;
  height: var(--header-height);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.header-brasao-img {
  height: 44px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}
.header-brand-divider {
  width: 1px;
  height: 34px;
  background: rgba(255, 255, 255, 0.18);
}
.header-text {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.brand-titles {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.brand-system-divider {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.15);
}
.brand-system {
  display: flex;
  flex-direction: column;
}
.brand-system h1 {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
  color: #FFF;
}
.brand-system span {
  font-size: 0.72rem;
  color: #94A3B8;
}
.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.btn-header {
  height: 34px;
  padding: 0 0.8rem;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  font-size: 0.78rem; font-weight: 500;
  background: transparent; color: #E2E8F0;
  display: inline-flex; align-items: center; gap: 0.45rem;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-header:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  color: #FFF;
}
.btn-primary-header {
  background: #2563EB;
  border: 1px solid #3B82F6;
  color: #FFF;
  font-weight: 600;
}
.btn-primary-header:hover {
  background: #1D4ED8;
  border-color: #2563EB;
  box-shadow: 0 2px 8px rgba(37,99,235,0.35);
}
.btn-icon-header {
  padding: 0 0.65rem;
  font-size: 0.85rem;
}
.btn-logout {
  border-color: rgba(239, 68, 68, 0.28);
  color: #FCA5A5;
  background: transparent;
}
.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #EF4444;
  color: #FFF;
}
.header-cloud-pill {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #E2E8F0;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.header-cloud-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}
.header-cloud-pill i {
  color: #10B981;
}
.header-cloud-pill.cloud-storage-only {
  background: rgba(56, 152, 236, 0.12);
  border-color: rgba(56, 152, 236, 0.35);
  color: #93C5FD;
}
.header-cloud-pill.cloud-storage-only i {
  color: #60A5FA;
}
.header-cloud-pill.cloud-offline {
  background: rgba(227, 30, 36, 0.12);
  border-color: rgba(227, 30, 36, 0.35);
  color: #FCA5A5;
}
.header-cloud-pill.cloud-offline i {
  color: #F87171;
}
.theme-switch-pill {
  height: 34px;
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}
.theme-pill-btn {
  height: 28px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  padding: 0 0.65rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.theme-pill-btn:hover {
  color: #FFF;
}
.theme-pill-btn.active {
  background: rgba(255, 255, 255, 0.18);
  color: #FFF;
  font-weight: 600;
  box-shadow: none;
}
.theme-pill-btn.active i {
  color: #FFF;
}
.header-divider { width: 1px; height: 24px; background: rgba(255,255,255,0.18); margin: 0 0.2rem; }
.user-info { display: flex; align-items: center; gap: 0.5rem; }
.user-avatar { font-size: 1.25rem; opacity: 0.85; color: #93C5FD; }
.user-name { font-size: 0.8rem; opacity: 0.9; font-weight: 500; }

/* ---------- MAIN CONTENT ---------- */
#mainContent { max-width: 1360px; margin: 0 auto; padding: 1.5rem 1.8rem; }

/* ---------- KPI CARDS ---------- */
.kpi-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--sombra);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.kpi-card:hover {
  border-color: var(--borda-hover);
  box-shadow: var(--sombra-elevada);
}
.kpi-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 1;
}
.kpi-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--texto-muted);
}
.kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--texto);
  line-height: 1.2;
}
.kpi-icon {
  width: auto;
  height: auto;
  font-size: 1.6rem;
  color: var(--texto-muted);
  opacity: 0.25;
  background: transparent !important;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- FILTERS ---------- */
.filter-section {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem;
  margin-bottom: 1.3rem;
}
.search-wrapper { position: relative; flex: 1; min-width: 270px; }
.search-icon { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--texto-muted); font-size: 0.85rem; }
#searchInput {
  padding-left: 2.3rem;
  height: 36px;
  background: var(--card-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  box-shadow: none;
  font-size: 0.84rem;
}
#searchInput:focus { border-color: var(--azul-destaque); background: var(--input-bg); }
.filter-buttons { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.filter-btn {
  padding: 0.42rem 0.85rem;
  height: 36px;
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--texto-claro);
  font-size: 0.78rem; font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.filter-btn:hover { border-color: var(--borda-hover); color: var(--texto); }
.filter-btn.active {
  background: var(--card-bg-elevated);
  color: var(--texto);
  border-color: var(--azul-destaque);
  font-weight: 600;
}

/* ---------- CONTRACT CARDS (TELA PRINCIPAL) ---------- */
.contract-list { display: flex; flex-direction: column; gap: 0.9rem; }
.contract-card {
  background: var(--card-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius);
  box-shadow: var(--sombra);
  padding: 1.2rem 1.4rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  animation: fadeSlideUp 0.25s ease;
}
.contract-card:hover {
  box-shadow: var(--sombra-elevada);
  border-color: var(--borda-hover);
}

.card-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.65rem; }
.card-title-group { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.card-title-group:hover .card-numero { color: var(--azul-destaque); }
.card-numero { font-size: 1.05rem; font-weight: 700; color: var(--card-numero-color); font-variant-numeric: tabular-nums; }
.card-processo {
  font-size: 0.72rem;
  color: var(--texto-muted);
  background: var(--subcard-bg);
  border: 1px solid var(--borda);
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
}
.card-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

.badge {
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.badge-vigente { background: rgba(16, 185, 129, 0.12); color: #10B981; border: 1px solid rgba(16, 185, 129, 0.3); font-weight: 700; }
.badge-vencendo { background: rgba(245, 158, 11, 0.12); color: #F59E0B; border: 1px solid rgba(245, 158, 11, 0.3); font-weight: 700; }
.badge-vencido { background: rgba(239, 68, 68, 0.12); color: #EF4444; border: 1px solid rgba(239, 68, 68, 0.3); font-weight: 700; }
.badge-neutral { background: var(--subcard-bg); color: var(--texto-muted); border: 1px solid var(--borda); font-weight: 600; }

html[data-theme="escuro"] .badge-vigente { color: #34D399; }
html[data-theme="escuro"] .badge-vencendo { color: #FBBF24; }
html[data-theme="escuro"] .badge-vencido { color: #F87171; }

.card-descricao {
  font-size: 0.88rem; color: var(--texto);
  margin-bottom: 0.8rem; line-height: 1.45;
}

/* Meta Data Grid (Contratada, Gestor, Fiscal) */
.card-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem 1.2rem;
  margin-bottom: 0.8rem;
  font-size: 0.82rem;
}
.meta-item { display: flex; flex-direction: column; gap: 0.15rem; }
.meta-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--texto-muted); font-weight: 600; }
.meta-value { color: var(--texto); font-weight: 500; word-break: break-word; }

/* Sub-bloco de Vigência e Aditivo no Card */
.card-subbloco-vigencia {
  background: var(--subcard-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.95rem;
  margin-bottom: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem 1rem;
  font-size: 0.8rem;
}
.subbloco-item { display: flex; flex-direction: column; gap: 0.12rem; }
.subbloco-label { font-size: 0.66rem; text-transform: uppercase; color: var(--texto-muted); font-weight: 600; letter-spacing: 0.05em; }
.subbloco-value { color: var(--texto); font-weight: 600; }

/* Sub-faixa de Aditivo */
.card-aditivo-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem;
  background: var(--subcard-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-size: 0.76rem;
  margin-bottom: 0.8rem;
}
.aditivo-tag { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--texto-muted); }
.aditivo-tag strong { color: var(--texto); font-weight: 600; }
.aditivo-sep { color: var(--borda); user-select: none; }

/* Quadro Financeiro em 4 Colunas */
.card-financeiro-4cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr 1.45fr;
  gap: 0.75rem;
  background: var(--subcard-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin-bottom: 0.9rem;
}
.fin-col { display: flex; flex-direction: column; justify-content: center; }
.fin-col-label { font-size: 0.66rem; color: var(--texto-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-bottom: 0.2rem; }
.fin-col-valor { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.fin-col-valor.neutral { color: var(--texto); }
.fin-col-valor.saldo-ok { color: #10B981 !important; }
.fin-col-valor.saldo-alerta { color: #F59E0B !important; }
.fin-col-valor.saldo-critico { color: #EF4444 !important; }

.fin-progress-group { display: flex; flex-direction: column; gap: 0.25rem; }
.fin-progress-header { display: flex; justify-content: space-between; font-size: 0.72rem; }

/* Progress bar */
.progress-bar-wrapper {
  width: 100%; height: 6px;
  background: var(--borda);
  border-radius: 3px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 3px;
  transition: width 0.4s ease;
  background: #10B981;
}
.progress-bar-fill.progress-medium { background: #F59E0B; }
.progress-bar-fill.progress-high { background: #EF4444; }

/* Ações do Card */
.card-actions {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
  padding-top: 0.75rem; border-top: 1px solid var(--borda);
}
.btn-action-primary {
  padding: 0.42rem 0.9rem;
  border-radius: var(--radius-sm);
  background: #16A34A;
  border: 1px solid #15803D;
  color: #FFF;
  font-size: 0.78rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 0.4rem;
  transition: all var(--transition);
}
.btn-action-primary:hover {
  background: #15803D;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}
.card-actions-secondary-grid {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
}
.btn-action-secondary {
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--borda);
  color: var(--texto-claro);
  font-size: 0.78rem; font-weight: 500;
  display: inline-flex; align-items: center; gap: 0.35rem;
  transition: all var(--transition);
}
.btn-action-secondary:hover {
  background: var(--card-bg-elevated);
  border-color: var(--borda-hover);
  color: var(--texto);
}
.btn-action-delete {
  padding: 0.42rem 0.65rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--texto-muted);
  font-size: 0.78rem; font-weight: 500;
  margin-left: auto;
  transition: all var(--transition);
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-action-delete:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #EF4444;
}

/* ---------- MODALS ---------- */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(5, 11, 24, 0.78);
  backdrop-filter: blur(5px);
  z-index: 1000;
  align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-lg);
  box-shadow: var(--sombra-elevada);
  width: 100%; max-height: 92vh;
  display: flex; flex-direction: column;
  animation: slideUp 0.28s ease;
  overflow: hidden;
}
.modal-small { max-width: 480px; }
.modal-medium { max-width: 680px; }
.modal-large { max-width: 820px; }
.modal-super-large { max-width: 1240px; width: 95vw; height: 90vh; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--borda);
  background: linear-gradient(135deg, #0B1E38 0%, #102B50 100%);
  color: #FFF;
  flex-shrink: 0;
}
.modal-header h2 { font-size: 1.05rem; display: flex; align-items: center; gap: 0.5rem; color: #FFF; font-weight: 700; }
.modal-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.modal-header-danger { background: linear-gradient(135deg, #7F1D1D, #991B1B); }
.modal-close {
  background: none; border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.5rem; line-height: 1;
  transition: color var(--transition);
  padding: 0.2rem 0.4rem;
  cursor: pointer;
}
.modal-close:hover { color: #FFF; }
.modal-body { padding: 1.3rem 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--borda);
  background: var(--subcard-bg);
  flex-shrink: 0;
}

/* Modal Buttons */
.btn-primary {
  padding: 0.5rem 1.1rem;
  background: #2563EB;
  color: #FFF; border: 1px solid #1D4ED8;
  border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 600;
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-primary:hover { background: #1D4ED8; }
.btn-secondary {
  padding: 0.5rem 1.1rem;
  background: transparent;
  border: 1px solid var(--borda);
  color: var(--texto-claro);
  border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 500;
  transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--borda-hover); color: var(--texto); background: var(--card-bg-elevated); }
.btn-danger {
  padding: 0.5rem 1.1rem;
  background: #DC2626; color: #FFF;
  border: 1px solid #B91C1C; border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 600;
  transition: opacity var(--transition);
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-danger:hover { background: #B91C1C; }

/* ---------- FICHA DETALHADA: TAB NAVIGATION ---------- */
.ficha-tabs-nav {
  display: flex; gap: 0.3rem;
  background: var(--subcard-bg);
  border-bottom: 1px solid var(--borda);
  padding: 0 1.5rem;
  flex-shrink: 0;
  overflow-x: auto;
}
.ficha-tab-btn {
  background: transparent; border: none;
  color: var(--texto-muted);
  padding: 0.75rem 1rem;
  font-size: 0.82rem; font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 0.45rem;
  cursor: pointer;
}
.ficha-tab-btn:hover { color: var(--texto); }
.ficha-tab-btn.active {
  color: #3B82F6;
  border-bottom-color: #3B82F6;
  background: transparent;
  font-weight: 600;
}
.tab-badge {
  background: var(--borda);
  color: var(--texto-muted);
  font-size: 0.68rem; font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.ficha-tab-btn.active .tab-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #3B82F6;
}

.ficha-tab-pane { display: none; }
.ficha-tab-pane.active { display: block; animation: fadeIn 0.2s ease; }

/* ---------- FICHA ABA 1: VISÃO GERAL ---------- */
.ficha-grid-container {
  display: flex; flex-direction: column; gap: 1rem;
}
.ficha-bloco {
  background: var(--subcard-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
}
.ficha-bloco-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.85rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--borda);
}
.ficha-bloco-title {
  font-size: 0.88rem; font-weight: 700; color: var(--texto);
  display: inline-flex; align-items: center; gap: 0.45rem;
}
.ficha-bloco-grid-2 {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem 1.5rem;
}
.ficha-bloco-grid-3 {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.ficha-item { display: flex; flex-direction: column; }
.ficha-item-label { font-size: 0.72rem; color: var(--texto-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.3px; margin-bottom: 0.2rem; }
.ficha-item-value { font-size: 0.92rem; color: var(--texto); font-weight: 500; word-break: break-word; }
.ficha-item-value.highlight { font-size: 1.15rem; font-weight: 700; color: #38BDF8; }

/* Cards de Fiscais e Gestores */
.responsaveis-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
.responsavel-card {
  background: var(--card-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  display: flex; gap: 1rem; align-items: flex-start;
}
.responsavel-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0, 102, 191, 0.2); color: #60A5FA;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.responsavel-info { flex: 1; }
.responsavel-papel { font-size: 0.7rem; text-transform: uppercase; color: var(--texto-muted); font-weight: 700; letter-spacing: 0.4px; }
.responsavel-nome { font-size: 1rem; font-weight: 700; color: #FFF; margin: 0.15rem 0 0.35rem; }
.responsavel-contato { font-size: 0.78rem; color: var(--texto-claro); display: flex; flex-direction: column; gap: 0.2rem; }
.responsavel-contato span { display: inline-flex; align-items: center; gap: 0.4rem; }

/* Detalhamento Financeiro na Ficha */
.fin-cards-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem; margin-bottom: 1rem;
}
.fin-kpi-subcard {
  background: var(--card-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex; flex-direction: column;
}
.fin-kpi-subcard .kpi-sub-label { font-size: 0.7rem; color: var(--texto-muted); text-transform: uppercase; font-weight: 600; margin-bottom: 0.25rem; }
.fin-kpi-subcard .kpi-sub-val { font-size: 1.2rem; font-weight: 700; }

/* Cronograma / Vigência Card */
.cronograma-timeline {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem; align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
}

/* ---------- FICHA ABA 2: ANEXOS & SPLIT-SCREEN VIEWER ---------- */
.anexos-split-container {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.2rem;
  height: 600px;
}
.anexos-list-col {
  background: var(--subcard-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.anexos-col-header {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--borda);
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem;
}
.anexos-col-header h4 { font-size: 0.88rem; font-weight: 700; color: #FFF; }
.btn-add-anexo {
  padding: 0.35rem 0.75rem;
  background: linear-gradient(135deg, var(--azul-primario), #0066BF);
  color: #FFF; border: none; border-radius: var(--radius-sm);
  font-size: 0.76rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.anexos-filter-bar {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--borda);
  display: flex; gap: 0.3rem; overflow-x: auto;
}
.anexo-filter-pill {
  padding: 0.2rem 0.55rem;
  border-radius: 12px;
  background: transparent; border: 1px solid var(--borda);
  color: var(--texto-muted);
  font-size: 0.68rem; font-weight: 600;
}
.anexo-filter-pill.active { background: var(--azul-hover); color: #FFF; border-color: var(--azul-hover); }

.anexos-scroll-list {
  flex: 1; overflow-y: auto;
  padding: 0.6rem; display: flex; flex-direction: column; gap: 0.5rem;
}
.anexo-card-item {
  background: var(--card-bg);
  border: 1.5px solid var(--borda);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  transition: all var(--transition);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.anexo-card-item:hover { border-color: var(--azul-destaque); background: var(--card-bg-elevated); }
.anexo-card-item.selected {
  border-color: #38BDF8;
  background: rgba(56, 189, 248, 0.08);
}
.anexo-item-top { display: flex; align-items: center; gap: 0.6rem; }
.anexo-file-icon { font-size: 1.4rem; }
.anexo-file-icon.pdf { color: #F87171; }
.anexo-file-icon.docx { color: #60A5FA; }
.anexo-file-icon.img { color: #C084FC; }
.anexo-item-title { font-size: 0.84rem; font-weight: 600; color: #FFF; flex: 1; word-break: break-all; }
.anexo-item-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; color: var(--texto-muted); }
.anexo-cat-tag {
  background: rgba(255,255,255,0.08);
  padding: 0.15rem 0.45rem; border-radius: 4px;
  font-size: 0.68rem; color: #E2E8F0;
}
.anexo-item-actions { display: flex; gap: 0.3rem; margin-top: 0.2rem; }
.btn-anx-act {
  padding: 0.25rem 0.55rem;
  border-radius: 4px; border: 1px solid var(--borda);
  background: transparent; color: var(--texto-claro);
  font-size: 0.72rem; display: inline-flex; align-items: center; gap: 0.25rem;
}
.btn-anx-act:hover { color: #FFF; background: rgba(255,255,255,0.1); }
.btn-viewer-fullscreen {
  background: #2563EB;
  color: #FFF !important;
  border-color: #1D4ED8;
  font-weight: 600;
}
.btn-viewer-fullscreen:hover {
  background: #1D4ED8 !important;
  color: #FFF !important;
}
.btn-anx-del:hover { color: #F87171; border-color: rgba(239, 68, 68, 0.4); }

/* Visualizador Integrado (Coluna Direita) */
.anexos-viewer-col {
  background: var(--subcard-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.viewer-top-bar {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--borda);
  background: var(--card-bg);
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; flex-shrink: 0;
}
.viewer-doc-title { font-size: 0.88rem; font-weight: 600; color: #FFF; display: inline-flex; align-items: center; gap: 0.5rem; }
.viewer-actions { display: flex; gap: 0.4rem; }
.viewer-body-container {
  flex: 1; width: 100%; height: 100%;
  position: relative; background: #0F172A;
  display: flex; align-items: center; justify-content: center;
}
.doc-iframe {
  width: 100%; height: 100%;
  border: none; background: #FFF;
}
.viewer-empty-state {
  text-align: center; color: var(--texto-muted);
  padding: 2rem;
}
.viewer-empty-state i { font-size: 3.5rem; opacity: 0.3; margin-bottom: 0.8rem; }
.viewer-empty-state p { font-size: 0.9rem; }

/* ---------- FICHA ABA 3 & 4: TABELAS DE ADITIVOS E EXTRATO ---------- */
.tabela-container {
  width: 100%; overflow-x: auto;
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  background: var(--subcard-bg);
}
.tabela-custom {
  width: 100%; border-collapse: collapse;
  font-size: 0.84rem; text-align: left;
}
.tabela-custom th {
  background: var(--card-bg);
  color: var(--texto-muted);
  text-transform: uppercase; font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--borda);
}
.tabela-custom td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--borda);
  color: var(--texto);
}
.tabela-custom tr:last-child td { border-bottom: none; }
.tabela-custom tr:hover td { background: rgba(255,255,255,0.02); }

/* ---------- AI IMPORT AREA ---------- */
.ai-import-area {
  background: linear-gradient(135deg, rgba(0, 86, 179, 0.08), rgba(0, 139, 69, 0.08));
  border: 2px dashed #3B82F6;
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.3rem;
  transition: border-color var(--transition);
}
.ai-import-area.drag-over {
  border-color: var(--verde-brilhante);
  background: rgba(16, 185, 129, 0.12);
}
.ai-import-header {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 700; font-size: 0.9rem;
  color: #60A5FA; margin-bottom: 0.7rem;
}
.ai-import-header i { color: #34D399; }
.drop-zone { text-align: center; padding: 1.4rem 1rem; cursor: pointer; }
.drop-icon { font-size: 2.2rem; color: #60A5FA; opacity: 0.6; margin-bottom: 0.5rem; }
.drop-zone p { font-size: 0.88rem; color: var(--texto-claro); }
.file-label { color: #93C5FD; font-weight: 600; cursor: pointer; text-decoration: underline; }
.drop-zone small { font-size: 0.74rem; color: var(--texto-muted); }
.ai-status {
  font-size: 0.82rem; padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm); margin-top: 0.6rem;
  display: none; line-height: 1.4;
}
.ai-status.processing { display: block; background: rgba(0, 102, 191, 0.15); color: #93C5FD; border: 1px solid rgba(147, 197, 253, 0.2); }
.ai-status.success { display: block; background: var(--verde-bg); color: #34D399; border: 1px solid rgba(52, 211, 153, 0.3); }
.ai-status.error { display: block; background: var(--vermelho-bg); color: #F87171; border: 1px solid rgba(248, 113, 113, 0.3); }
.attached-file {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.8rem;
  background: rgba(0, 102, 191, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: var(--radius-sm); font-size: 0.82rem; margin-top: 0.6rem;
}
.attached-file i { color: #60A5FA; }
.btn-remove-file { background: none; border: none; color: #F87171; font-size: 0.9rem; margin-left: auto; padding: 0.2rem; cursor: pointer; }

/* ---------- EMPENHO MODAL RESUMO ---------- */
.empenho-resumo {
  background: var(--subcard-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  padding: 1.1rem; margin-bottom: 1.2rem;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.6rem;
}
.empenho-contrato-info strong { font-size: 1.05rem; color: #93C5FD; display: block; margin-bottom: 0.15rem; }
.empenho-contrato-info span { font-size: 0.8rem; color: var(--texto-claro); }
.empenho-saldo-info { text-align: right; }
.empenho-saldo-label { font-size: 0.7rem; color: var(--texto-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.empenho-saldo-valor { font-size: 1.45rem; font-weight: 700; color: #34D399; }

/* ---------- HISTÓRICO LISTA ---------- */
.historico-contrato-info {
  background: var(--subcard-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem; margin-bottom: 1rem;
  font-size: 0.88rem;
}
.historico-lista { display: flex; flex-direction: column; gap: 0.55rem; }
.historico-item {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  font-size: 0.85rem; transition: background var(--transition);
}
.historico-item:hover { background: var(--card-bg-elevated); }
.hist-data { color: var(--texto-muted); font-size: 0.78rem; min-width: 80px; }
.hist-nota { color: #60A5FA; font-weight: 600; min-width: 130px; }
.hist-valor { font-weight: 700; color: #F87171; min-width: 115px; }
.hist-obs { color: var(--texto-claro); font-size: 0.82rem; flex: 1; }
.btn-estornar {
  background: var(--vermelho-bg); border: 1px solid rgba(239,68,68,0.3);
  color: #F87171; padding: 0.35rem 0.65rem; border-radius: var(--radius-sm);
  font-size: 0.76rem; font-weight: 600; white-space: nowrap;
}
.btn-estornar:hover { background: var(--vermelho); color: #FFF; }
.historico-empty { text-align: center; padding: 2.5rem 1rem; color: var(--texto-muted); }
.historico-empty i { font-size: 2.5rem; opacity: 0.3; margin-bottom: 0.6rem; display: block; }

/* ---------- FORM LAYOUT ---------- */
.form-row { display: flex; gap: 0.85rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }
.form-group { margin-bottom: 0.95rem; }
.form-group-wide { flex: 2 !important; min-width: 280px !important; }
.form-group-small { flex: 0 0 170px !important; min-width: auto !important; }
.form-divider {
  text-align: center; border-bottom: 1px solid var(--borda);
  margin: 1rem 0 1.2rem; line-height: 0.1;
}
.form-divider span {
  background: var(--card-bg); padding: 0 0.8rem;
  font-size: 0.76rem; color: var(--texto-muted);
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.input-readonly { background: var(--subcard-bg); color: var(--texto-claro); cursor: default; }

/* ---------- TOAST NOTIFICATIONS ---------- */
.toast-container {
  position: fixed; top: calc(var(--header-height) + 1rem); right: 1rem;
  z-index: 2500; display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.75rem 1.2rem; border-radius: var(--radius-sm);
  box-shadow: var(--sombra-elevada); font-size: 0.85rem; font-weight: 500;
  min-width: 290px; max-width: 440px;
  animation: slideInRight 0.3s ease, fadeOut 0.4s ease 4.1s forwards;
}
.toast-success { background: #065F46; color: #A7F3D0; border: 1px solid #059669; }
.toast-error { background: #7F1D1D; color: #FECACA; border: 1px solid #DC2626; }
.toast-warning { background: #78350F; color: #FDE68A; border: 1px solid #D97706; }
.toast-info { background: #1E3A8A; color: #BFDBFE; border: 1px solid #2563EB; }

/* ---------- ÁREA DE IMPRESSÃO (ESPELHO DO CONTRATO E AUDITORIA) ---------- */
#printEspelhoArea, #printAuditArea { display: none; }

@media print {
  body * { visibility: hidden !important; }
  #printEspelhoArea, #printEspelhoArea *,
  #printAuditArea, #printAuditArea * { visibility: visible !important; }
  #printEspelhoArea, #printAuditArea {
    display: block !important;
    position: absolute; left: 0; top: 0; width: 100%;
    background: #FFF !important; color: #000 !important;
    padding: 1.5cm; font-family: 'Times New Roman', serif;
  }
  .print-header { text-align: center; border-bottom: 2px solid #000; padding-bottom: 12px; margin-bottom: 18px; }
  .print-header h1 { font-size: 16pt; margin-bottom: 4px; }
  .print-header h2 { font-size: 12pt; font-weight: normal; }
  .print-title { text-align: center; font-size: 14pt; font-weight: bold; margin: 15px 0; text-transform: uppercase; }
  .print-table { width: 100%; border-collapse: collapse; margin-bottom: 15px; }
  .print-table th, .print-table td { border: 1px solid #333; padding: 6px 8px; font-size: 10pt; text-align: left; }
  .print-table th { background: #EEE; }
  .print-signatures { display: flex; justify-content: space-around; margin-top: 50px; }
  .print-sign-box { text-align: center; width: 220px; border-top: 1px solid #000; padding-top: 6px; font-size: 10pt; }
}

/* ---------- ANIMATIONS ---------- */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(60px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ---------- CENTRAL DE ALERTAS & NOTIFICAÇÕES (SINO & DROPDOWN) ---------- */
.notif-wrapper { position: relative; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--vermelho-brilhante); color: #FFF;
  font-size: 0.65rem; font-weight: 800;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
  animation: pulseNotif 2s infinite;
}
@keyframes pulseNotif {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.notif-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 360px; max-width: 90vw;
  background: var(--card-bg-elevated);
  border: 1px solid var(--borda-hover);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
  z-index: 1500;
  overflow: hidden;
  animation: fadeSlideUp 0.25s ease;
}
.notif-header {
  padding: 0.8rem 1rem;
  background: var(--subcard-bg);
  border-bottom: 1px solid var(--borda);
  display: flex; align-items: center; justify-content: space-between;
}
.notif-header-title { font-size: 0.88rem; font-weight: 700; color: #FFF; display: inline-flex; align-items: center; gap: 0.4rem; }
.notif-header-title i { color: #FBBF24; }
.notif-count-tag {
  background: rgba(239, 68, 68, 0.2); color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 0.7rem; font-weight: 700;
  padding: 0.15rem 0.5rem; border-radius: 10px;
}
.notif-list {
  max-height: 380px; overflow-y: auto;
  display: flex; flex-direction: column;
}
.notif-item {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--borda);
  display: flex; flex-direction: column; gap: 0.3rem;
  cursor: pointer; transition: background var(--transition);
  border-left: 4px solid transparent;
}
.notif-item:hover { background: var(--subcard-bg); }
.notif-item.alerta-vermelho { border-left-color: var(--vermelho-brilhante); background: rgba(239, 68, 68, 0.05); }
.notif-item.alerta-amarelo { border-left-color: var(--amarelo-brilhante); background: rgba(245, 166, 35, 0.05); }
.notif-item:last-child { border-bottom: none; }
.notif-item-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; }
.notif-item-title { font-weight: 700; color: #FFF; display: inline-flex; align-items: center; gap: 0.35rem; }
.notif-item-badge { font-size: 0.68rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 4px; }
.badge-alerta-critico { background: rgba(239, 68, 68, 0.25); color: #FCA5A5; }
.badge-alerta-atencao { background: rgba(245, 166, 35, 0.25); color: #FDE68A; }
.notif-item-msg { font-size: 0.78rem; color: var(--texto-claro); line-height: 1.35; }
.notif-item-footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; color: var(--texto-muted); margin-top: 0.2rem; }
.notif-item-btn { color: #60A5FA; font-weight: 600; text-decoration: underline; background: none; border: none; font-size: 0.72rem; cursor: pointer; }

/* ---------- BANNER DE ALERTAS DO DASHBOARD (SLIM LINE) ---------- */
.alert-banner {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  margin-bottom: 1.2rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.8rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  animation: fadeSlideUp 0.25s ease;
}
.alert-banner-left { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 260px; }
.alert-indicator-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #F59E0B; flex-shrink: 0;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}
.alert-banner-text { font-size: 0.82rem; color: #E2E8F0; line-height: 1.4; }
.alert-banner-text strong { color: #FDE68A; }
.alert-banner-actions { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.btn-alert-banner {
  padding: 0.25rem 0.65rem;
  background: transparent; border: 1px solid var(--borda);
  color: var(--texto-claro); border-radius: 4px;
  font-size: 0.74rem; font-weight: 500;
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.btn-alert-banner:hover { background: var(--card-bg-elevated); color: var(--texto); border-color: var(--borda-hover); }
.btn-alert-close {
  background: none; border: none; color: var(--texto-muted);
  font-size: 0.95rem; padding: 0.2rem 0.4rem; cursor: pointer;
  transition: color var(--transition);
}
.btn-alert-close:hover { color: #FFF; }

/* ---------- ALERTA EM TEMPO REAL NO MODAL DE EMPENHO ---------- */
.empenho-alerta-box {
  padding: 0.7rem 0.9rem; border-radius: var(--radius-sm);
  font-size: 0.82rem; margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.6rem;
  animation: fadeIn 0.2s ease;
}
.empenho-alerta-box.alerta-erro { background: rgba(239, 68, 68, 0.18); border: 1px solid rgba(239, 68, 68, 0.4); color: #FCA5A5; }
.empenho-alerta-box.alerta-aviso { background: rgba(245, 166, 35, 0.18); border: 1px solid rgba(245, 166, 35, 0.4); color: #FDE68A; }
.empenho-alerta-box.alerta-vencido { background: rgba(239, 68, 68, 0.25); border: 1px solid rgba(239, 68, 68, 0.5); color: #FECACA; }

/* ---------- CONTROLE DE ACESSO POR PERFIL (RBAC) & CABEÇALHO ---------- */
.user-details-header {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  line-height: 1.1;
}
.user-role-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: inline-block;
  width: fit-content;
}
.user-role-badge.role-master {
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.5), rgba(79, 70, 229, 0.4));
  color: #FDE047;
  border: 1px solid rgba(251, 191, 36, 0.7);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.25);
  font-weight: 800;
}
.user-role-badge.role-sead,
.user-role-badge.role-secad {
  background: rgba(0, 74, 143, 0.4);
  color: #93C5FD;
  border: 1px solid rgba(59, 130, 246, 0.6);
}
.user-role-badge.role-sefaz {
  background: rgba(0, 139, 69, 0.4);
  color: #86EFAC;
  border: 1px solid rgba(34, 197, 94, 0.6);
}

/* ---------- ATALHOS RÁPIDOS NA TELA DE LOGIN ---------- */
.login-perfis-demo {
  margin-top: 1.3rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.perfis-demo-label {
  font-size: 0.74rem;
  color: var(--texto-muted);
  text-align: center;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.perfis-demo-label i { color: #F5A623; }
.perfis-demo-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.btn-demo-perfil {
  padding: 0.65rem 0.75rem;
  background: var(--subcard-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  color: var(--texto);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-align: left;
  transition: all var(--transition);
}
.btn-demo-perfil:hover {
  background: var(--card-bg-elevated);
  transform: translateY(-1px);
  border-color: var(--borda-hover);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.btn-demo-sead i,
.btn-demo-secad i { color: #2563EB; font-size: 1.25rem; }
.btn-demo-sefaz i { color: #16A34A; font-size: 1.25rem; }
.btn-demo-perfil strong { display: block; font-size: 0.78rem; font-weight: 700; color: var(--texto); }
.btn-demo-perfil small { display: block; font-size: 0.67rem; color: var(--texto-muted); margin-top: 0.1rem; }

/* ---------- TRILHA GLOBAL DE AUDITORIA (LOGS) ---------- */
.modal-extra-large {
  max-width: 1250px;
  width: 96vw;
}
.audit-badge-total {
  background: rgba(59, 130, 246, 0.2);
  color: #93C5FD;
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 10px;
}
.audit-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  padding: 0.9rem 1.1rem;
  background: var(--subcard-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 1.1rem;
  align-items: center;
  border: 1px solid var(--borda);
}
.audit-search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
}
.audit-search-box input {
  width: 100%;
  padding: 0.55rem 0.8rem 0.55rem 2.1rem;
  background: var(--input-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  color: var(--texto);
  font-size: 0.84rem;
}
.audit-search-box input:focus {
  border-color: var(--azul-destaque);
  outline: none;
}
.audit-search-box i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--texto-muted);
  font-size: 0.85rem;
}
.audit-filter-select, .audit-filter-date {
  padding: 0.55rem 0.8rem;
  background: var(--input-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  color: var(--texto);
  font-size: 0.82rem;
  cursor: pointer;
}
.audit-filter-select:focus, .audit-filter-date:focus {
  border-color: var(--azul-destaque);
  outline: none;
}
.audit-actions-group {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.btn-audit-action {
  padding: 0.52rem 0.85rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  color: #FFF;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition);
}
.btn-audit-action:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}
.audit-table-wrapper {
  max-height: 480px;
  overflow-y: auto;
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
}
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}
.audit-table th {
  background: var(--table-th-bg);
  padding: 0.75rem 0.9rem;
  color: var(--texto-claro);
  font-weight: 700;
  border-bottom: 1px solid var(--borda);
  position: sticky;
  top: 0;
  z-index: 10;
  letter-spacing: 0.3px;
}
.audit-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--borda);
  vertical-align: top;
  color: var(--texto-claro);
}
.audit-table tr:hover td {
  background: rgba(37, 99, 235, 0.04);
}
.audit-data-hora {
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--texto-muted);
  white-space: nowrap;
}
.audit-user-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.audit-user-name {
  font-weight: 700;
  color: var(--texto);
}
.audit-user-sub {
  font-size: 0.7rem;
  color: var(--texto-muted);
}
.audit-badge-cat {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.14rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  display: inline-block;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-cat-auth { background: rgba(148, 163, 184, 0.2); color: #CBD5E1; border: 1px solid rgba(148, 163, 184, 0.3); }
.badge-cat-empenho { background: rgba(245, 166, 35, 0.2); color: #FDE68A; border: 1px solid rgba(245, 166, 35, 0.4); }
.badge-cat-contrato { background: rgba(59, 130, 246, 0.2); color: #93C5FD; border: 1px solid rgba(59, 130, 246, 0.4); }
.badge-cat-aditivo { background: rgba(168, 85, 247, 0.2); color: #D8B4FE; border: 1px solid rgba(168, 85, 247, 0.4); }
.badge-cat-anexo { background: rgba(16, 185, 129, 0.2); color: #86EFAC; border: 1px solid rgba(16, 185, 129, 0.4); }
.badge-cat-usuario { background: rgba(236, 72, 153, 0.2); color: #F472B6; border: 1px solid rgba(236, 72, 153, 0.4); }

.audit-contrato-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.74rem;
  color: #93C5FD;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.audit-contrato-tag:hover {
  background: rgba(59, 130, 246, 0.25);
  color: #FFF;
}
.audit-desc-box {
  line-height: 1.45;
  color: #F1F5F9;
  font-size: 0.81rem;
}
.audit-desc-box strong {
  color: #FDE68A;
}

/* ---------- MODAL GERENCIAMENTO DE USUÁRIOS (RBAC) ---------- */
.usuario-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.85rem;
  background: var(--subcard-bg);
  padding: 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--borda);
}
.usuarios-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}
.usuarios-table th {
  background: var(--table-th-bg);
  padding: 0.75rem 0.9rem;
  color: var(--texto-claro);
  font-weight: 700;
  border-bottom: 1px solid var(--borda);
  position: sticky;
  top: 0;
  z-index: 5;
}
.usuarios-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--borda);
  color: var(--texto-claro);
  vertical-align: middle;
}
.usuarios-table tr:hover td {
  background: rgba(37, 99, 235, 0.04);
}
.acoes-usuario-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}
.btn-senha-usuario {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #FCD34D;
  padding: 0.3rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 600;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  height: 26px;
}
.btn-senha-usuario:hover {
  background: #D97706;
  border-color: #F59E0B;
  color: #FFF;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}
.btn-excluir-usuario {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #FCA5A5;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 600;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
}
.btn-excluir-usuario:hover {
  background: var(--vermelho);
  color: #FFF;
}
.empenho-autor-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--texto-muted);
  margin-top: 0.25rem;
}
.empenho-autor-tag i {
  color: #34D399;
}

/* ============================================================
   AJUSTES FINOS DE CONTRASTE E LEGIBILIDADE — TEMA CLARO INSTITUCIONAL
   ============================================================ */
html[data-theme="claro"] body {
  background: #F4F7FB;
  color: #0F172A;
}

/* Banner de Alerta no Topo (Slim Line) */
html[data-theme="claro"] .alert-banner {
  background: #FFFBEB;
  border: 1px solid #FCD34D;
  box-shadow: 0 1px 3px rgba(217, 119, 6, 0.08);
}
html[data-theme="claro"] .alert-banner-text {
  color: #78350F;
  font-weight: 500;
}
html[data-theme="claro"] .alert-banner-text strong {
  color: #451A03;
  font-weight: 700;
}
html[data-theme="claro"] .btn-alert-banner {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #334155;
}
html[data-theme="claro"] .btn-alert-banner:hover {
  background: #F8FAFC;
  color: #0F172A;
  border-color: #94A3B8;
}
html[data-theme="claro"] .btn-alert-close {
  color: #92400E;
}
html[data-theme="claro"] .btn-alert-close:hover {
  color: #451A03;
}

/* Cards de KPI */
html[data-theme="claro"] .kpi-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
html[data-theme="claro"] .kpi-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
html[data-theme="claro"] .kpi-value {
  color: #0F172A;
}
html[data-theme="claro"] .kpi-label {
  color: #64748B;
  font-weight: 600;
}
html[data-theme="claro"] .kpi-blue .kpi-icon {
  background: #EFF6FF;
  color: #1D4ED8;
}
html[data-theme="claro"] .kpi-dark .kpi-icon {
  background: #F0F9FF;
  color: #0369A1;
}
html[data-theme="claro"] .kpi-amber .kpi-icon {
  background: #FFFBEB;
  color: #D97706;
}
html[data-theme="claro"] .kpi-green .kpi-icon {
  background: #F0FDF4;
  color: #15803D;
}

/* Barra de Pesquisa e Filtros */
html[data-theme="claro"] #searchInput {
  background: #FFFFFF;
  color: #0F172A;
  border: 1.5px solid #CBD5E1;
}
html[data-theme="claro"] #searchInput:focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
html[data-theme="claro"] #searchInput::placeholder {
  color: #94A3B8;
}
html[data-theme="claro"] .search-icon {
  color: #64748B;
}
html[data-theme="claro"] .filter-btn {
  background: #FFFFFF;
  color: #334155;
  border: 1.5px solid #CBD5E1;
}
html[data-theme="claro"] .filter-btn:hover {
  border-color: #2563EB;
  color: #1D4ED8;
}
html[data-theme="claro"] .filter-btn.active {
  background: #1E40AF;
  color: #FFFFFF;
  border-color: #1E40AF;
  box-shadow: 0 2px 8px rgba(30, 64, 175, 0.35);
}

/* Card do Contrato na Listagem */
html[data-theme="claro"] .contract-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}
html[data-theme="claro"] .contract-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}
html[data-theme="claro"] .card-numero {
  color: #1E40AF;
}
html[data-theme="claro"] .card-title-group:hover .card-numero {
  color: #2563EB;
}
html[data-theme="claro"] .card-descricao {
  color: #1E293B;
}
html[data-theme="claro"] .card-meta {
  color: #475569;
}
html[data-theme="claro"] .card-meta span i {
  color: #2563EB;
}
html[data-theme="claro"] .card-subbloco-vigencia {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
}
html[data-theme="claro"] .subbloco-label {
  color: #64748B;
}
html[data-theme="claro"] .subbloco-value {
  color: #0F172A;
}
html[data-theme="claro"] .subbloco-value i {
  color: #2563EB;
}
html[data-theme="claro"] .card-aditivo-strip {
  background: #EFF6FF;
  border: 1px dashed #93C5FD;
}
html[data-theme="claro"] .aditivo-tag {
  color: #475569;
}
html[data-theme="claro"] .aditivo-tag strong {
  color: #0F172A;
}
html[data-theme="claro"] .aditivo-tag.reajuste-tag strong {
  color: #B45309;
}
html[data-theme="claro"] .card-financeiro-4cols {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
}
html[data-theme="claro"] .fin-col-label {
  color: #64748B;
}
html[data-theme="claro"] .fin-col-valor.original {
  color: #0F172A;
}
html[data-theme="claro"] .fin-col-valor.reajuste {
  color: #B45309;
}
html[data-theme="claro"] .fin-col-valor.total {
  color: #1E40AF;
}
html[data-theme="claro"] .fin-col-valor.empenhado {
  color: #B45309;
}
html[data-theme="claro"] .fin-col-valor.saldo {
  color: #15803D;
}
html[data-theme="claro"] .fin-col-valor.saldo-critico {
  color: #DC2626;
}
html[data-theme="claro"] .progress-bar-wrapper {
  background: #E2E8F0;
}
html[data-theme="claro"] .card-actions {
  border-top-color: #E2E8F0;
}
html[data-theme="claro"] .btn-action-primary {
  background: #16A34A;
  border-color: #15803D;
  color: #FFFFFF;
}
html[data-theme="claro"] .btn-action-primary:hover {
  background: #15803D;
}
html[data-theme="claro"] .btn-action-secondary {
  background: #FFFFFF;
  border-color: #CBD5E1;
  color: #334155;
}
html[data-theme="claro"] .btn-action-secondary:hover {
  background: #F1F5F9;
  border-color: #94A3B8;
  color: #0F172A;
}
html[data-theme="claro"] .btn-action-delete {
  color: #94A3B8;
}
html[data-theme="claro"] .btn-action-delete:hover {
  background: #FEE2E2;
  border-color: #FCA5A5;
  color: #DC2626;
}

/* Modais e Abas em Tema Claro */
html[data-theme="claro"] .modal-content {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
}
html[data-theme="claro"] .modal-body {
  background: #FFFFFF;
  color: #0F172A;
}
html[data-theme="claro"] .modal-footer {
  background: #F8FAFC;
  border-top: 1px solid #E2E8F0;
}
html[data-theme="claro"] .ficha-tabs-bar {
  background: #F8FAFC;
  border-bottom: 2px solid #E2E8F0;
}
html[data-theme="claro"] .ficha-tab-btn {
  color: #475569;
}
html[data-theme="claro"] .ficha-tab-btn:hover {
  color: #0F172A;
}
html[data-theme="claro"] .ficha-tab-btn.active {
  color: #1E40AF;
  border-bottom-color: #1E40AF;
  background: #EFF6FF;
}
html[data-theme="claro"] .ficha-bloco {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
}
html[data-theme="claro"] .ficha-bloco-titulo {
  color: #1E40AF;
  border-bottom-color: #E2E8F0;
}
html[data-theme="claro"] .ficha-item-label {
  color: #64748B;
}
html[data-theme="claro"] .ficha-item-value {
  color: #0F172A;
}
html[data-theme="claro"] .ficha-item-value.highlight {
  color: #1E40AF;
}
html[data-theme="claro"] .responsavel-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
}
html[data-theme="claro"] .responsavel-nome {
  color: #0F172A;
}
html[data-theme="claro"] .responsavel-papel {
  color: #64748B;
}
html[data-theme="claro"] .responsavel-contato {
  color: #475569;
}
html[data-theme="claro"] .responsavel-avatar {
  background: #EFF6FF;
  color: #2563EB;
}
html[data-theme="claro"] .fin-kpi-subcard {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
}
html[data-theme="claro"] .cronograma-timeline {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
}

/* Anexos e Viewer em Tema Claro */
html[data-theme="claro"] .anexos-list-col {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
}
html[data-theme="claro"] .anexos-col-header {
  background: #FFFFFF;
  border-bottom: 1px solid #E2E8F0;
}
html[data-theme="claro"] .anexos-col-header h4 {
  color: #0F172A;
}
html[data-theme="claro"] .anexo-card-item {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
}
html[data-theme="claro"] .anexo-card-item:hover {
  background: #F0F9FF;
  border-color: #2563EB;
}
html[data-theme="claro"] .anexo-card-item.selected {
  background: #EFF6FF;
  border-color: #2563EB;
}
html[data-theme="claro"] .anexo-item-title {
  color: #0F172A;
}
html[data-theme="claro"] .anexo-cat-tag {
  background: #F1F5F9;
  color: #475569;
}
html[data-theme="claro"] .btn-anx-act {
  color: #334155;
  border-color: #CBD5E1;
  background: #F8FAFC;
}
html[data-theme="claro"] .btn-anx-act:hover {
  background: #E2E8F0;
  color: #0F172A;
}
html[data-theme="claro"] .anexos-viewer-col {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
}
html[data-theme="claro"] .viewer-top-bar {
  background: #FFFFFF;
  border-bottom: 1px solid #E2E8F0;
}
html[data-theme="claro"] .viewer-doc-title {
  color: #0F172A;
}
html[data-theme="claro"] .viewer-body-container {
  background: #E2E8F0;
}

/* Tabelas e Extratos em Tema Claro */
html[data-theme="claro"] .tabela-container {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
}
html[data-theme="claro"] .tabela-custom th {
  background: #F8FAFC;
  color: #334155;
  border-bottom: 1.5px solid #CBD5E1;
}
html[data-theme="claro"] .tabela-custom td {
  color: #1E293B;
  border-bottom: 1px solid #E2E8F0;
}
html[data-theme="claro"] .tabela-custom tr:hover td {
  background: #F8FAFC;
}

/* Central de Notificações em Tema Claro */
html[data-theme="claro"] .notif-dropdown {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.18);
}
html[data-theme="claro"] .notif-header {
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
}
html[data-theme="claro"] .notif-header-title {
  color: #0F172A;
}
html[data-theme="claro"] .notif-item {
  border-bottom: 1px solid #E2E8F0;
}
html[data-theme="claro"] .notif-item:hover {
  background: #F8FAFC;
}
html[data-theme="claro"] .notif-item-title {
  color: #0F172A;
}
html[data-theme="claro"] .notif-item-desc {
  color: #475569;
}
html[data-theme="claro"] .notif-item-meta {
  color: #64748B;
}

/* Auditoria & Usuários em Tema Claro */
html[data-theme="claro"] .audit-toolbar {
  background: #F8FAFC;
  border-color: #E2E8F0;
}
html[data-theme="claro"] .audit-search-box input,
html[data-theme="claro"] .audit-filter-select,
html[data-theme="claro"] .audit-filter-date {
  background: #FFFFFF;
  color: #0F172A;
  border: 1.5px solid #CBD5E1;
}
html[data-theme="claro"] .btn-audit-action {
  background: #FFFFFF;
  color: #1E293B;
  border: 1.5px solid #CBD5E1;
}
html[data-theme="claro"] .btn-audit-action:hover {
  background: #F1F5F9;
  border-color: #1E40AF;
  color: #1E40AF;
}
html[data-theme="claro"] .audit-table-wrapper {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
}
html[data-theme="claro"] .audit-table th {
  background: #F8FAFC;
  color: #334155;
  border-bottom: 1.5px solid #CBD5E1;
}
html[data-theme="claro"] .audit-table td {
  color: #1E293B;
  border-bottom: 1px solid #E2E8F0;
}
html[data-theme="claro"] .audit-user-name {
  color: #0F172A;
}
html[data-theme="claro"] .audit-desc-box {
  color: #0F172A;
}
html[data-theme="claro"] .audit-desc-box strong {
  color: #B45309;
}
html[data-theme="claro"] .audit-contrato-tag {
  background: #EFF6FF;
  color: #1D4ED8;
}
html[data-theme="claro"] .usuarios-table th {
  background: #F8FAFC;
  color: #334155;
  border-bottom: 1.5px solid #CBD5E1;
}
html[data-theme="claro"] .usuarios-table td {
  color: #1E293B;
  border-bottom: 1px solid #E2E8F0;
}
html[data-theme="claro"] .usuario-form-grid {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
}
html[data-theme="claro"] .btn-senha-usuario {
  background: #FEF3C7;
  border-color: #FCD34D;
  color: #92400E;
}
html[data-theme="claro"] .btn-senha-usuario:hover {
  background: #F59E0B;
  border-color: #D97706;
  color: #FFF;
}
html[data-theme="claro"] .btn-excluir-usuario {
  background: #FEE2E2;
  border-color: #FCA5A5;
  color: #DC2626;
}
html[data-theme="claro"] .btn-excluir-usuario:hover {
  background: #DC2626;
  border-color: #B91C1C;
  color: #FFF;
}

/* ============================================================
   PWA, SAFE AREA & RESPONSIVIDADE MOBILE-FIRST ADAPTATIVA
   ============================================================ */

/* Prevenção de rolagem horizontal e suporte a entalhes (Notch / Dynamic Island) */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-tap-highlight-color: transparent;
}

#appHeader {
  padding-left: max(1.2rem, env(safe-area-inset-left));
  padding-right: max(1.2rem, env(safe-area-inset-right));
  padding-top: env(safe-area-inset-top);
}

/* Visibilidade de ações no cabeçalho: Desktop vs Mobile */
.header-desktop-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.header-mobile-actions {
  display: none;
}

/* Botão Instalar App */
.btn-install-app {
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.5);
  color: #93C5FD;
  font-weight: 600;
  cursor: pointer;
}
.btn-install-app:hover {
  background: rgba(37, 99, 235, 0.3);
  color: #FFF;
  border-color: #60A5FA;
}

/* ---------- MOBILE DRAWER (MENU LATERAL) ---------- */
.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 11, 24, 0.72);
  backdrop-filter: blur(4px);
  z-index: 1999;
  animation: fadeIn 0.2s ease;
}
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 310px;
  max-width: 86vw;
  height: 100vh;
  height: 100dvh;
  background: var(--card-bg);
  border-left: 1px solid var(--borda);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -4px 0 25px rgba(0, 0, 0, 0.5);
}
.mobile-drawer.open {
  transform: translateX(0);
}
.drawer-header {
  padding: 1.1rem 1.2rem;
  padding-top: max(1.1rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--borda);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--subcard-bg);
  flex-shrink: 0;
}
.drawer-user-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.drawer-close {
  background: none;
  border: none;
  color: var(--texto-muted);
  font-size: 1.6rem;
  line-height: 1;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: color var(--transition);
}
.drawer-close:hover {
  color: var(--texto);
}
.drawer-body {
  padding: 1rem 1.1rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}
.drawer-section-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--texto-muted);
  font-weight: 700;
  margin: 0.8rem 0 0.3rem;
}
.drawer-theme-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}
.drawer-theme-btn {
  padding: 0.6rem 0.5rem;
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  background: var(--subcard-bg);
  color: var(--texto-claro);
  font-size: 0.76rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all var(--transition);
}
.drawer-theme-btn:hover {
  border-color: var(--borda-hover);
  color: var(--texto);
}
.drawer-theme-btn.active {
  background: #2563EB;
  color: #FFF;
  border-color: #2563EB;
}
.drawer-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.72rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--borda);
  background: var(--subcard-bg);
  color: var(--texto);
  font-size: 0.84rem;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: all var(--transition);
}
.drawer-item:hover {
  background: var(--card-bg-elevated);
  border-color: var(--borda-hover);
}
.drawer-item i {
  font-size: 1rem;
  color: var(--texto-muted);
  width: 20px;
  text-align: center;
}
.drawer-item-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.drawer-item-text strong {
  font-size: 0.84rem;
  color: var(--texto);
}
.drawer-item-text small {
  font-size: 0.7rem;
  color: var(--texto-muted);
}
.drawer-badge {
  background: #EF4444;
  color: #FFF;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.12rem 0.45rem;
  border-radius: 10px;
}
.btn-drawer-install {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(16, 185, 129, 0.2));
  border-color: rgba(37, 99, 235, 0.5);
  margin-bottom: 0.4rem;
}
.btn-drawer-install i {
  color: #38BDF8;
}
.drawer-item-logout {
  border-color: rgba(239, 68, 68, 0.3);
  color: #FCA5A5;
}
.drawer-item-logout i {
  color: #F87171;
}
.drawer-item-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #EF4444;
}
.drawer-divider {
  height: 1px;
  background: var(--borda);
  margin: 0.6rem 0;
}

/* ---------- POPUP INSTALAR APLICATIVO APÓS LOGIN ---------- */
.pwa-install-popup-content {
  max-width: 440px;
}
.pwa-benefits-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--subcard-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
}
.pwa-benefit-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.pwa-benefit-item i {
  color: var(--azul-primario);
  font-size: 0.95rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
}
.pwa-benefit-item strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--texto);
}
.pwa-benefit-item small {
  display: block;
  font-size: 0.73rem;
  color: var(--texto-muted);
  line-height: 1.35;
}

/* ---------- MODAL IOS INSTALLATION STEPS ---------- */
.ios-install-steps {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.1rem;
}
.ios-step-item {
  display: flex;
  gap: 0.85rem;
  background: var(--subcard-bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  align-items: flex-start;
}
.ios-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #2563EB;
  color: #FFF;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ios-step-content strong {
  display: block;
  font-size: 0.84rem;
  color: var(--texto);
  margin-bottom: 0.25rem;
}
.ios-step-content p {
  font-size: 0.78rem;
  color: var(--texto-claro);
  line-height: 1.45;
}
.ios-install-badge-note {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-size: 0.76rem;
  color: var(--texto);
  line-height: 1.4;
}

/* ---------- BREAKPOINT: TABLET & DESKTOP COMPACTO (< 1024px) ---------- */
@media (max-width: 1023px) {
  .header-desktop-actions {
    display: none !important;
  }
  .header-mobile-actions {
    display: flex !important;
    align-items: center;
    gap: 0.45rem;
  }
  #appHeader {
    height: 60px;
    padding: 0 1rem;
    padding-top: env(safe-area-inset-top);
  }
  .header-brasao-img {
    height: 38px;
  }
  .brand-titles .brand-slogan {
    display: none;
  }
  .brand-system span {
    display: none;
  }
  .brand-system h1 {
    font-size: 0.84rem;
  }
  .btn-mobile-novo {
    height: 34px;
    padding: 0 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
  }
  .btn-mobile-menu {
    height: 34px;
    width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
  }
  .anexos-split-container {
    grid-template-columns: 1fr;
    height: auto;
  }
  .anexos-list-col {
    height: 300px;
  }
  .anexos-viewer-col {
    height: 480px;
  }
}

/* ---------- BREAKPOINT: SMARTPHONES (ANDROID & IPHONE <= 768px) ---------- */
@media (max-width: 768px) {
  /* Prevenção de Zoom Automático no Safari iOS */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Padding confortável e preenchimento de tela */
  #mainContent {
    padding: 0.85rem 0.75rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }

  /* Quadro de Indicadores (KPIs) 2x2 no Celular */
  .kpi-section {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.55rem;
    margin-bottom: 1.1rem;
  }
  .kpi-card {
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
  }
  .kpi-label {
    font-size: 0.62rem;
    letter-spacing: 0.03em;
  }
  .kpi-value {
    font-size: 1.12rem !important;
  }
  .kpi-icon {
    font-size: 1.15rem;
    opacity: 0.2;
  }

  /* Barra de Busca e Filtros com Deslize Horizontal Touch */
  .filter-section {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    margin-bottom: 1.1rem;
  }
  .search-wrapper {
    min-width: 100%;
    width: 100%;
  }
  #searchInput {
    height: 42px;
  }
  .filter-buttons {
    width: 100%;
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .filter-buttons::-webkit-scrollbar {
    display: none;
  }
  .filter-btn {
    height: 36px;
    padding: 0 0.85rem;
    flex-shrink: 0;
  }

  /* Card do Contrato Adaptado ao Celular */
  .contract-card {
    padding: 1rem 0.95rem;
    border-radius: var(--radius-sm);
  }
  .card-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .card-numero {
    font-size: 0.98rem;
  }
  .card-meta-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .card-subbloco-vigencia {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
  }
  .card-aditivo-strip {
    padding: 0.45rem 0.65rem;
    font-size: 0.73rem;
  }

  /* Quadro Financeiro 2x2 com Saldo em Largura Total */
  .card-financeiro-4cols {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    padding: 0.75rem 0.85rem;
  }
  .fin-col-valor {
    font-size: 0.96rem;
  }
  .fin-progress-group {
    grid-column: 1 / -1;
    margin-top: 0.35rem;
    padding-top: 0.45rem;
    border-top: 1px dashed var(--borda);
  }

  /* Ações do Card no Celular: Empenho no Topo com 100% de largura */
  .card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding-top: 0.65rem;
  }
  .btn-action-primary {
    width: 100%;
    height: 42px;
    font-size: 0.86rem;
    justify-content: center;
    border-radius: var(--radius-sm);
  }
  .card-actions-secondary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    width: 100%;
  }
  .btn-action-secondary {
    height: 38px;
    justify-content: center;
    border-radius: var(--radius-sm);
  }
  .btn-action-delete {
    height: 36px;
    width: 100%;
    margin-left: 0;
    justify-content: center;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
  }

  /* Modais em Estilo Bottom Sheet no Celular */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    max-height: 92dvh !important;
    border-radius: 16px 16px 0 0 !important;
    margin: 0 !important;
    border-bottom: none !important;
    animation: slideUp 0.25s ease;
  }
  .modal-header {
    position: sticky;
    top: 0;
    z-index: 30;
    border-radius: 16px 16px 0 0;
    padding: 0.9rem 1.1rem;
  }
  .modal-body {
    padding: 1.1rem 1.1rem;
  }
  .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 30;
    padding: 0.75rem 1.1rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }
  .modal-super-large {
    width: 100% !important;
    height: 92dvh !important;
    border-radius: 16px 16px 0 0 !important;
  }

  /* Abas da Ficha com Rolagem Horizontal Touch */
  .ficha-tabs-nav {
    padding: 0 0.8rem;
    gap: 0.2rem;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .ficha-tabs-nav::-webkit-scrollbar {
    display: none;
  }
  .ficha-tab-btn {
    padding: 0.7rem 0.8rem;
    font-size: 0.78rem;
    flex-shrink: 0;
  }

  /* Visualizador de Anexos no Celular */
  .anexos-split-container {
    grid-template-columns: 1fr;
    height: auto;
    gap: 0.8rem;
  }
  .anexos-list-col {
    height: 260px;
  }
  .anexos-viewer-col {
    height: 380px;
  }
  .viewer-top-bar {
    padding: 0.6rem 0.8rem;
  }
  .viewer-actions {
    flex-wrap: wrap;
  }

  /* Formulários no Celular */
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  .form-row .form-group {
    min-width: 100%;
  }

  /* Central de Alertas Dropdown no Celular */
  .notif-dropdown {
    width: calc(100vw - 1.5rem);
    right: -4rem;
  }
}

@media (max-width: 420px) {
  .header-brand-divider {
    display: none;
  }
  .brand-titles .brand-sub {
    font-size: 0.58rem;
  }
  .brand-titles .brand-main {
    font-size: 1.1rem;
  }
  .brand-system h1 {
    font-size: 0.76rem;
  }
  .notif-dropdown {
    right: -2.5rem;
  }
}


/* ---------- MODALIDADES DE ADITIVO E CHIPS ---------- */
.modalidade-chips-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-top: 0.4rem;
  margin-bottom: 0.35rem;
}

@media (max-width: 640px) {
  .modalidade-chips-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.modalidade-chip {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.6rem !important;
  padding: 0.6rem 0.85rem !important;
  background: var(--subcard-bg, #1E293B) !important;
  border: 1.5px solid var(--borda, #334155) !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  user-select: none !important;
  margin: 0 !important;
  transition: all 0.2s ease !important;
}

.modalidade-chip:hover {
  border-color: #3B82F6 !important;
  background: rgba(59, 130, 246, 0.08) !important;
}

.modalidade-chip.selected,
.modalidade-chip:has(input[type="checkbox"]:checked) {
  border-color: #2563EB !important;
  background: rgba(37, 99, 235, 0.15) !important;
  box-shadow: 0 0 0 1px #2563EB !important;
}

/* Checkbox visível, estilizado e sem herdar width:100% */
.modalidade-chip input[type="checkbox"],
input[type="checkbox"].modalidade-check {
  width: 17px !important;
  min-width: 17px !important;
  max-width: 17px !important;
  height: 17px !important;
  min-height: 17px !important;
  max-height: 17px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 1.5px solid var(--borda, #475569) !important;
  border-radius: 4px !important;
  background: var(--card-bg, #0F172A) !important;
  cursor: pointer !important;
  accent-color: #2563EB !important;
  flex-shrink: 0 !important;
  box-shadow: none !important;
}

.modalidade-chip .modalidade-text {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--texto, #E2E8F0);
  white-space: nowrap;
}

.modalidade-chip .modalidade-text i {
  color: #60A5FA;
  font-size: 0.85rem;
}

.modalidade-chip.selected .modalidade-text,
.modalidade-chip:has(input[type="checkbox"]:checked) .modalidade-text {
  color: #60A5FA;
  font-weight: 700;
}

html[data-theme="claro"] .modalidade-chip {
  background: #F8FAFC !important;
  border-color: #CBD5E1 !important;
}

html[data-theme="claro"] .modalidade-chip .modalidade-text {
  color: #1E293B;
}

html[data-theme="claro"] .modalidade-chip .modalidade-text i {
  color: #0B2E59;
}

html[data-theme="claro"] .modalidade-chip.selected,
html[data-theme="claro"] .modalidade-chip:has(input[type="checkbox"]:checked) {
  background: rgba(11, 46, 89, 0.08) !important;
  border-color: #0B2E59 !important;
  box-shadow: 0 0 0 1px #0B2E59 !important;
}

html[data-theme="claro"] .modalidade-chip.selected .modalidade-text,
html[data-theme="claro"] .modalidade-chip:has(input[type="checkbox"]:checked) .modalidade-text {
  color: #0B2E59 !important;
}

/* ---------- AVISO LEI 14.133/2021 (QUANTITATIVO > 25%) ---------- */
.alerta-lei-quantitativo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 6px;
  color: #F59E0B;
  font-size: 0.78rem;
  line-height: 1.4;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

html[data-theme="escuro"] .alerta-lei-quantitativo {
  color: #FBBF24;
}

/* ---------- BADGES DE MODALIDADE DE ADITIVO ---------- */
.badge-modalidade {
  background: rgba(139, 92, 246, 0.15);
  color: #A78BFA;
  border: 1px solid rgba(139, 92, 246, 0.35);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

html[data-theme="claro"] .badge-modalidade {
  background: rgba(109, 40, 217, 0.1);
  color: #6D28D9;
  border-color: rgba(109, 40, 217, 0.3);
}

/* ---------- BOTÕES DE DOCUMENTO PDF DE EMPENHO ---------- */
.td-documento-pdf {
  white-space: nowrap;
}

.btn-pdf-act {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-pdf-view {
  background: rgba(239, 68, 68, 0.12);
  color: #F87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-pdf-view:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #FFF;
}

.btn-pdf-download {
  background: rgba(59, 130, 246, 0.12);
  color: #60A5FA;
  border-color: rgba(59, 130, 246, 0.3);
}

.btn-pdf-download:hover {
  background: rgba(59, 130, 246, 0.22);
  color: #FFF;
}

.btn-pdf-anexar {
  background: rgba(148, 163, 184, 0.12);
  color: var(--texto-claro, #94A3B8);
  border-color: var(--borda, rgba(71, 85, 105, 0.4));
}

.btn-pdf-anexar:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3B82F6;
  color: #60A5FA;
}
