/* =========================================================
   AMAR — Override do tema Zynix
   Paleta institucional: azul governamental + verde paraibano
   Sidebar escuro (estilo Manus) — fundo azul escuro com texto claro
   ========================================================= */

:root {
  /* Sobrescreve cores principais do Zynix */
  --primary-rgb: 30, 90, 180;      /* Azul governamental */
  --secondary-rgb: 60, 160, 90;    /* Verde paraibano */
  --warning-rgb: 217, 130, 0;
  --info-rgb: 12, 156, 252;
  --success-rgb: 16, 168, 79;
  --danger-rgb: 211, 47, 47;
  --light-rgb: 247, 248, 250;
  --dark-rgb: 12, 20, 33;
  --orange-rgb: 234, 88, 12;
  --pink-rgb: 219, 39, 119;
  --teal-rgb: 13, 148, 136;
  --purple-rgb: 102, 51, 153;
  --green-rgb: 22, 163, 74;

  /* Branding AMAR */
  --amar-gov-blue: rgb(30, 90, 180);
  --amar-gov-blue-dark: rgb(18, 60, 130);
  --amar-gov-blue-deeper: rgb(13, 42, 92);
  --amar-gov-green: rgb(60, 160, 90);
  --amar-gov-green-dark: rgb(38, 110, 62);
  --amar-gov-green-light: rgb(120, 220, 150);
  --amar-gov-amber: rgb(217, 130, 0);

  --amar-header-stripe: linear-gradient(90deg, var(--amar-gov-blue-dark) 0%, var(--amar-gov-blue) 60%, var(--amar-gov-green) 100%);
  --amar-card-shadow: 0 2px 8px rgba(18, 60, 130, 0.06);
  --amar-card-shadow-hover: 0 6px 24px rgba(18, 60, 130, 0.12);

  /* Sobrescreve menu/sidebar do Zynix */
  --menu-bg: var(--amar-gov-blue-deeper);
  --menu-prime-color: rgba(255, 255, 255, 0.78);
}

/* =========================================================
   SIDEBAR (estilo Manus — azul escuro + verde no ativo)
   ========================================================= */

[data-menu-styles="light"] .app-sidebar,
.app-sidebar {
  background: var(--amar-gov-blue-deeper) !important;
  border-right: 1px solid rgba(255,255,255,0.05) !important;
  width: 17rem !important;
}
.app-sidebar .main-sidebar-header { width: 17rem !important; }
@media (min-width: 992px) {
  .app-content,
  .main-content.app-content { margin-inline-start: 17rem !important; }
  .app-header { padding-inline-start: 17rem !important; }
  [data-nav-layout=vertical] .footer { padding-inline-start: 17rem !important; }
  html[data-toggled="close"] .app-sidebar { transform: translateX(-17rem) !important; }
  html[data-toggled="close"] .app-header { padding-inline-start: 0 !important; }
  html[data-toggled="close"] .footer { padding-inline-start: 0 !important; }
}

[data-menu-styles="light"] .main-sidebar-header,
.app-sidebar .main-sidebar-header {
  background: var(--amar-gov-blue-deeper) !important;
  border-bottom: 1px solid rgba(255,255,255,0.08) !important;
}
.app-sidebar .main-sidebar-header .header-logo span:first-child {
  color: #fff !important;
}
.app-sidebar .main-sidebar-header .header-logo span:last-child {
  color: rgba(255,255,255,0.65) !important;
}
/* Sidebar: a busca fica colada na logo (sticky), o menu vem logo abaixo */
.app-sidebar .main-sidebar {
  padding-top: 0 !important;
}

/* Itens do menu */
[data-menu-styles="light"] .app-sidebar .side-menu__item,
.app-sidebar .side-menu__item {
  color: rgba(255,255,255,0.82) !important;
  border-radius: 6px;
  margin: 2px 8px;
  padding: 0.6rem 0.9rem;
  font-weight: 500;
}
.app-sidebar .side-menu__item:hover {
  background: rgba(255,255,255,0.08) !important;
  color: #fff !important;
}
.app-sidebar .side-menu__icon {
  color: rgba(255,255,255,0.85) !important;
  font-size: 1.05rem;
}

/* Item ativo — verde paraibano */
.app-sidebar .side-menu__item.active,
.app-sidebar .side-menu__item.active:hover {
  background: rgba(60, 160, 90, 0.18) !important;
  color: #fff !important;
  border-left: 3px solid var(--amar-gov-green-light) !important;
}
.app-sidebar .side-menu__item.active .side-menu__icon {
  color: var(--amar-gov-green-light) !important;
}
.app-sidebar .side-menu__item.active .side-menu__label {
  font-weight: 600;
}

/* Busca contextual da sidebar (padrão DAE adaptado) */
.sidebar-search-wrap {
  position: sticky; top: 0; z-index: 5;
  background: var(--amar-gov-blue-deeper);
}
.sidebar-search-input {
  width: 100%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 7px 32px 7px 32px;
  font-size: 13px;
  outline: none;
  transition: background .15s, border-color .15s;
}
.sidebar-search-input:focus {
  background: rgba(255,255,255,0.18);
  border-color: rgba(120,220,150,0.45);
  box-shadow: 0 0 0 2px rgba(120,220,150,0.12);
}
.sidebar-search-input::placeholder { color: rgba(255,255,255,0.65); }
.sidebar-search-input::-webkit-search-cancel-button { display:none; }
.sidebar-search-icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: rgba(255,255,255,0.7); font-size: 16px; pointer-events: none;
}
.sidebar-search-clear {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; color: rgba(255,255,255,0.6);
  cursor: pointer; padding: 2px 6px; display: none; font-size: 16px; line-height: 1;
}
.sidebar-search-clear:hover { color: #fff; }
.sidebar-search-active .sidebar-search-clear { display: inline-block; }
.main-menu li.slide.hidden-by-search,
.main-menu li.slide__category.hidden-by-search { display: none !important; }
.side-menu__label mark {
  background: rgba(255,255,255,.85);
  color: var(--amar-gov-blue-dark);
  padding: 0 2px; border-radius: 3px; font-weight: 700;
}

/* Categorias (separadores) */
[data-menu-styles="light"] .app-sidebar .slide__category,
.app-sidebar .slide__category .category-name {
  color: rgba(255,255,255,0.45) !important;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  padding: 1rem 1.25rem 0.25rem;
  font-weight: 600;
}

/* =========================================================
   HEADER & FAIXA INSTITUCIONAL
   ========================================================= */

.amar-header-stripe {
  background: var(--amar-header-stripe);
  height: 4px;
  width: 100%;
}

/* CORREÇÃO CRÍTICA: body é flex no Zynix; .page colapsava para min-content.
   Força .page a ocupar toda a largura da viewport. */
body { display: block !important; }
.page {
  display: block !important;
  width: 100% !important;
  min-width: 100% !important;
  min-height: 100vh;
}

/* Header principal — estilo só */
.amar-header {
  background: #fff !important;
  border-bottom: 1px solid #e9eef5 !important;
  box-shadow: 0 1px 4px rgba(18,60,130,0.04);
  height: 64px !important;
  display: flex !important;
  align-items: center !important;
}

/* Toggle do sidebar em DESKTOP (Zynix só faz em mobile por padrão) */
@media (min-width: 992px) {
  html[data-toggled="close"] .app-sidebar {
    transform: translateX(-15rem);
    transition: transform 0.25s ease;
  }
  html[data-toggled="close"] .app-header {
    padding-inline-start: 0 !important;
    transition: padding 0.25s ease;
  }
  html[data-toggled="close"] .main-content {
    padding-inline-start: 0 !important;
    margin-inline-start: 0 !important;
    transition: padding 0.25s ease, margin 0.25s ease;
  }
  .app-sidebar { transition: transform 0.25s ease; }
  .app-header  { transition: padding 0.25s ease; }
  .main-content { transition: padding 0.25s ease, margin 0.25s ease; }
}

/* =========================================================
   ABAS (nav-tabs) — design melhorado, mais visível
   ========================================================= */
.nav-tabs {
  border-bottom: 2px solid #e9eef5;
  gap: 4px;
  margin-bottom: 0 !important;
}
.nav-tabs .nav-link,
.nav-tabs .nav-item .nav-link {
  border: none !important;
  border-radius: 8px 8px 0 0 !important;
  background: #f3f6fb !important;
  color: #5a6778 !important;
  font-weight: 600;
  padding: 0.75rem 1.25rem !important;
  margin-right: 2px;
  border-bottom: 3px solid transparent !important;
  transition: all 0.18s ease;
  position: relative;
  top: 1px;
}
.nav-tabs .nav-link:hover {
  background: #e8edf5 !important;
  color: var(--amar-gov-blue) !important;
  border-bottom-color: var(--amar-gov-blue-light, var(--amar-gov-blue)) !important;
}
.nav-tabs .nav-link.active,
.nav-tabs .nav-item .nav-link.active {
  background: #fff !important;
  color: var(--amar-gov-blue-dark) !important;
  border: 1px solid #e9eef5 !important;
  border-bottom: 3px solid var(--amar-gov-blue) !important;
  font-weight: 700;
  box-shadow: 0 -2px 8px rgba(18,60,130,0.05);
}
.tab-content {
  background: #fff;
  border: 1px solid #e9eef5;
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 1.5rem;
}
.amar-header .main-header-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 64px;
  padding: 0 1.5rem;
}

/* Botão de toggle do sidebar */
.amar-sidebar-toggle {
  background: #f3f6fb !important;
  color: var(--amar-gov-blue-dark) !important;
  border: 1px solid #dde3ec !important;
  width: 38px;
  height: 38px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  padding: 0 !important;
}
.amar-sidebar-toggle:hover {
  background: #e8edf5 !important;
  color: var(--amar-gov-blue) !important;
}

/* Logo do Paraíba no header (logo-paraiba2.png — versão horizontal) */
.amar-header-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 4px;
  background: transparent;
  flex-shrink: 0;
  transition: background .15s ease;
}
.amar-header-logo {
  height: 48px !important;
  width: auto !important;
  background: transparent !important;
  object-fit: contain;
  display: inline-block !important;
  flex-shrink: 0;
}

.amar-header-titles strong {
  display: block;
  color: var(--amar-gov-blue-dark);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.15;
}
.amar-header-titles .small {
  color: #5a6778;
  font-size: 0.78rem;
  line-height: 1.2;
}

/* Botões do header (notificação, fullscreen) */
.amar-header-btn {
  background: transparent !important;
  border: 1px solid transparent !important;
  color: #4b5870 !important;
  width: 38px;
  height: 38px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  padding: 0 !important;
  margin-left: 0.35rem;
  position: relative;
  border-radius: 8px;
}
.amar-header-btn:hover {
  background: #f3f6fb !important;
  color: var(--amar-gov-blue) !important;
  border-color: #dde3ec !important;
}

.amar-notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: var(--amar-gov-amber);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
  border: 2px solid #fff;
}

.amar-notif-dropdown {
  min-width: 320px;
  max-width: 380px;
  border: 1px solid #e9eef5 !important;
  box-shadow: 0 8px 32px rgba(18,60,130,0.10) !important;
  border-radius: 10px !important;
}

/* Perfil no header */
.amar-header-profile {
  background: transparent !important;
  border: 1px solid transparent !important;
  display: inline-flex !important;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.6rem 0.3rem 0.3rem !important;
  color: #2f3a55 !important;
  border-radius: 8px;
}
.amar-header-profile:hover {
  background: #f3f6fb !important;
  border-color: #dde3ec !important;
}
.amar-header-profile::after {
  margin-left: 0.4rem;
  color: #8c95a6;
}
.amar-avatar {
  background: var(--amar-gov-blue);
  color: #fff;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.amar-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(18,60,130,0.15);
}

/* Thumbs de paciente em listas */
.amar-paciente-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #e9eef5;
  margin-right: 8px;
  display: inline-block;
  vertical-align: middle;
  background: #f3f6fb;
}
.amar-paciente-thumb-letra {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--amar-gov-blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  margin-right: 8px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
/* Avatar grande circular para detalhe do paciente */
.amar-paciente-foto-grande {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(18,60,130,0.18);
  background: #f3f6fb;
}
.amar-profile-info {
  text-align: left;
  line-height: 1.15;
}
.amar-profile-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--amar-gov-blue-dark);
}
.amar-profile-role {
  font-size: 0.72rem;
  color: #6c757d;
}

/* Conteúdo encosta no header.
   Zynix usa .app-content { margin-block-start: 4.25rem (68px) } em desktop
   como offset para o header fixed. O .amar-header foi reduzido para 64px,
   então o offset correto é 64px. Também zeramos qualquer padding-top que
   o .main-content possa adicionar para não duplicar o espaço. */
@media (min-width: 992px) {
  .main-content.app-content,
  .app-content {
    margin-block-start: 74px !important;
    padding-block-start: 0 !important;
    padding-top: 0 !important;
  }
  .main-content > .container-fluid {
    padding-top: 0 !important;
  }
}
.page-header-breadcrumb {
  margin-top: 0 !important;
  margin-bottom: .35rem !important;
  padding-top: .3rem !important;
  padding-bottom: .15rem !important;
}

/* =========================================================
   TELA DE LOGIN
   ========================================================= */

.amar-login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 991px) {
  .amar-login-shell { grid-template-columns: 1fr; }
  .amar-login-side { display: none !important; }
}

.amar-login-side {
  background: linear-gradient(135deg, var(--amar-gov-blue-deeper) 0%, var(--amar-gov-blue) 55%, var(--amar-gov-green-dark) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem 3.5rem;
  position: relative;
  overflow: hidden;
}
.amar-login-side::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255,255,255,0.10), transparent 50%),
              radial-gradient(circle at 20% 80%, rgba(60,160,90,0.18), transparent 50%);
  pointer-events: none;
}
.amar-login-side > * { position: relative; z-index: 1; }

.amar-login-side h1 {
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  color: #fff;
}
.amar-login-title-img {
  max-width: 320px;
  width: 100%;
  height: auto;
  margin: 0 0 1.5rem;
  display: block;
}
.amar-login-side .lead {
  font-size: 1.05rem;
  opacity: 0.95;
  max-width: 34rem;
  font-weight: 400;
  line-height: 1.55;
  color: #fff;
}
.amar-login-side .gov-logos {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  font-size: 0.85rem;
  opacity: 0.85;
  color: #fff;
}

/* Logo principal — bem maior */
.amar-login-logo-block {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}
.amar-login-logo-img {
  height: 150px;
  width: auto;
  background: transparent;
}
.amar-login-logo-text .pretitle {
  font-size: 1.05rem;
  opacity: 0.95;
  letter-spacing: 0.04em;
  font-weight: 600;
  text-transform: uppercase;
}
.amar-login-logo-text .org-title {
  font-weight: 700;
  font-size: 1.55rem;
  line-height: 1.2;
  margin-top: 6px;
  color: #fff;
}

.amar-login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  background: #f7fafc;
}
.amar-login-card {
  width: 100%;
  max-width: 28rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(18, 60, 130, 0.10);
  padding: 2.5rem;
}
.amar-card-logo {
  width: 220px;
  height: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto 1.25rem;
}

.amar-login-card h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--amar-gov-blue-dark);
  margin-bottom: 0.5rem;
}
.amar-login-card .text-muted {
  color: #5a6778 !important;
  font-size: 0.95rem;
}

/* Olho do toggle de senha — visível! */
#toggle-pwd {
  background: #f4f6f9 !important;
  color: var(--amar-gov-blue) !important;
  border: 1px solid #dde3ec !important;
  border-left: none !important;
}
#toggle-pwd:hover {
  background: #e8edf5 !important;
  color: var(--amar-gov-blue-dark) !important;
}
#toggle-pwd i {
  color: var(--amar-gov-blue) !important;
  font-size: 1.05rem !important;
}

/* Botões claros (btn-light) — texto escuro pra ficar legível */
.btn-light,
.btn.btn-light,
.btn-sm.btn-light {
  color: var(--amar-gov-blue-dark) !important;
  background-color: #f3f6fb !important;
  border: 1px solid #dde3ec !important;
}
.btn-light:hover,
.btn.btn-light:hover,
.btn-sm.btn-light:hover {
  background-color: #e8edf5 !important;
  color: var(--amar-gov-blue) !important;
  border-color: #c7cfdb !important;
}
.btn-light i, .btn.btn-light i { color: inherit !important; }

/* Botões outline com cores legíveis */
.btn-outline-secondary {
  color: var(--amar-gov-blue-dark) !important;
  border-color: #c7cfdb !important;
  background-color: #fff !important;
}
.btn-outline-secondary:hover,
.btn-outline-secondary.active,
.btn-outline-secondary:active {
  color: #fff !important;
  background-color: var(--amar-gov-blue) !important;
  border-color: var(--amar-gov-blue) !important;
}
.btn-outline-primary {
  color: var(--amar-gov-blue) !important;
  border-color: var(--amar-gov-blue) !important;
  background-color: transparent !important;
}
.btn-outline-primary:hover,
.btn-outline-primary.active {
  color: #fff !important;
  background-color: var(--amar-gov-blue) !important;
}

/* Botão primário do login */
.btn-amar-primary {
  background: var(--amar-gov-blue) !important;
  border-color: var(--amar-gov-blue) !important;
  color: #fff !important;
  font-weight: 600;
}
.btn-amar-primary:hover {
  background: var(--amar-gov-blue-dark) !important;
  border-color: var(--amar-gov-blue-dark) !important;
  color: #fff !important;
}
.btn-amar-secondary {
  background: var(--amar-gov-green) !important;
  border-color: var(--amar-gov-green) !important;
  color: #fff !important;
}
.btn-amar-secondary:hover {
  background: var(--amar-gov-green-dark) !important;
  border-color: var(--amar-gov-green-dark) !important;
  color: #fff !important;
}

/* =========================================================
   BADGES (corrigidos — antes ficavam invisíveis)
   ========================================================= */

.badge-amar-success,
.badge.bg-amar-success {
  background-color: rgba(60, 160, 90, 0.15) !important;
  color: var(--amar-gov-green-dark) !important;
  font-weight: 600;
  padding: 0.35em 0.65em;
}
.badge-amar-warning,
.badge.bg-amar-warning {
  background-color: rgba(217, 130, 0, 0.16) !important;
  color: #8a5c00 !important;
  font-weight: 600;
  padding: 0.35em 0.65em;
}
.badge-amar-danger,
.badge.bg-amar-danger {
  background-color: rgba(211, 47, 47, 0.14) !important;
  color: #8a1e1e !important;
  font-weight: 600;
  padding: 0.35em 0.65em;
}
.badge-amar-info,
.badge.bg-amar-info {
  background-color: rgba(30, 90, 180, 0.12) !important;
  color: var(--amar-gov-blue-dark) !important;
  font-weight: 600;
  padding: 0.35em 0.65em;
}
.badge-amar-neutral,
.badge.bg-amar-neutral {
  background-color: #eef1f6 !important;
  color: #475569 !important;
  font-weight: 600;
  padding: 0.35em 0.65em;
}

/* Badge sólido (para contador de notificações no header) */
.badge.amar-notif-badge {
  background-color: var(--amar-gov-amber) !important;
  color: #fff !important;
  font-size: 0.65rem !important;
  position: absolute;
  top: 4px;
  right: 0;
  padding: 0.25em 0.45em;
  border-radius: 999px;
}

/* =========================================================
   BARRA DE FILTROS (padrão das listas)
   ========================================================= */

.amar-filter-bar {
  background: #f7fafc;
  border: 1px solid #e9eef5;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.amar-filter-bar .filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  align-items: end;
}
.amar-filter-bar label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #6c757d;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}
.amar-filter-bar .form-control,
.amar-filter-bar .form-select {
  border: 1px solid #dde3ec;
  background: #fff;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}
.amar-filter-bar .form-control:focus,
.amar-filter-bar .form-select:focus {
  border-color: var(--amar-gov-blue);
  box-shadow: 0 0 0 3px rgba(30,90,180,0.12);
}
.amar-filter-bar .filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

/* =========================================================
   CARDS E KPIS
   ========================================================= */

.card-amar {
  border: 1px solid rgba(18, 60, 130, 0.08);
  box-shadow: var(--amar-card-shadow);
  transition: box-shadow 200ms cubic-bezier(0.23, 1, 0.32, 1),
              transform 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
.card-amar:hover {
  box-shadow: var(--amar-card-shadow-hover);
  transform: translateY(-1px);
}

.kpi-card {
  padding: 1.25rem 1.5rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(18, 60, 130, 0.08);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 130px;
}
.kpi-card .kpi-label {
  font-size: 0.8rem;
  color: #6c757d;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-card .kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--amar-gov-blue-dark);
  line-height: 1.1;
  margin: 0.4rem 0;
}
.kpi-card .kpi-trend {
  font-size: 0.85rem;
  font-weight: 500;
}
.kpi-card .kpi-trend.up { color: var(--amar-gov-green-dark); }
.kpi-card .kpi-trend.down { color: #8a1e1e; }

/* =========================================================
   FOOTER & BANNERS
   ========================================================= */

.amar-footer {
  font-size: 0.85rem;
  color: #5a6778;
  padding: 1.25rem 0;
  border-top: 1px solid rgba(18, 60, 130, 0.08);
  background: #fff;
  margin-top: auto;
  margin-inline-start: 15rem;
  transition: margin 0.25s ease;
}

html[data-toggled="close"] .amar-footer { margin-inline-start: 0 !important; }

@media (max-width: 991.98px) {
  .amar-footer { margin-inline-start: 0; }
}

.amar-lgpd-banner {
  background: rgba(217, 130, 0, 0.08);
  border-bottom: 1px solid rgba(217, 130, 0, 0.20);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  color: #8a5c00;
  text-align: center;
}

/* =========================================================
   MODO ESCURO — paleta AMAR dark
   ========================================================= */

[data-theme-mode="dark"] body,
[data-theme-mode="dark"] {
  background-color: #0d1525 !important;
  color: #d8dee8 !important;
}

[data-theme-mode="dark"] .page,
[data-theme-mode="dark"] .app-content,
[data-theme-mode="dark"] .main-content {
  background-color: #0d1525 !important;
  color: #d8dee8 !important;
}

[data-theme-mode="dark"] .amar-header {
  background: #11192c !important;
  border-bottom: 1px solid #1c2540 !important;
}
/* Logo Paraíba precisa de fundo claro quando o header está escuro */
[data-theme-mode="dark"] .amar-header-logo-wrap {
  background: #ffffff !important;
  padding: 4px 10px !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,.15);
}
[data-theme-mode="dark"] .amar-header-titles strong { color: #fff !important; }
[data-theme-mode="dark"] .amar-header-titles .small { color: #94a3b8 !important; }
[data-theme-mode="dark"] .amar-sidebar-toggle {
  background: #1c2540 !important;
  color: #fff !important;
  border-color: #2a3454 !important;
}
[data-theme-mode="dark"] .amar-sidebar-toggle:hover {
  background: #283155 !important;
}
[data-theme-mode="dark"] .amar-header-btn {
  color: #cbd5e1 !important;
}
[data-theme-mode="dark"] .amar-header-btn:hover {
  background: #1c2540 !important;
  color: #fff !important;
  border-color: #2a3454 !important;
}
[data-theme-mode="dark"] .amar-header-profile {
  color: #fff !important;
}
[data-theme-mode="dark"] .amar-header-profile:hover {
  background: #1c2540 !important;
  border-color: #2a3454 !important;
}
[data-theme-mode="dark"] .amar-profile-name { color: #fff !important; }
[data-theme-mode="dark"] .amar-profile-role { color: #94a3b8 !important; }

/* Sidebar dark — ainda mais escuro */
[data-theme-mode="dark"] .app-sidebar,
[data-theme-mode="dark"] .app-sidebar .main-sidebar-header {
  background: #070d1a !important;
  border-color: #1a2238 !important;
}

/* Cards */
[data-theme-mode="dark"] .card,
[data-theme-mode="dark"] .card-amar,
[data-theme-mode="dark"] .kpi-card {
  background-color: #11192c !important;
  border-color: #1c2540 !important;
  color: #d8dee8 !important;
}
[data-theme-mode="dark"] .card-header {
  background-color: #1a2238 !important;
  border-bottom-color: #25304f !important;
  color: #fff !important;
}
[data-theme-mode="dark"] .kpi-card .kpi-label { color: #94a3b8 !important; }
[data-theme-mode="dark"] .kpi-card .kpi-value { color: #fff !important; }

/* Tables */
[data-theme-mode="dark"] .table,
[data-theme-mode="dark"] .table > :not(caption) > * > * {
  --bs-table-color: #d8dee8;
  --bs-table-bg: transparent;
  --bs-table-border-color: #1c2540;
  --bs-table-striped-bg: #11192c;
  --bs-table-hover-bg: #1a2238;
  color: #d8dee8;
  border-color: #1c2540 !important;
}
[data-theme-mode="dark"] .table thead.bg-light,
[data-theme-mode="dark"] .table thead {
  background-color: #1c2540 !important;
  color: #fff !important;
}
[data-theme-mode="dark"] .table-light,
[data-theme-mode="dark"] .table-hover tbody tr:hover > * {
  background-color: #1a2238 !important;
  color: #fff !important;
}

/* Filter bar */
[data-theme-mode="dark"] .amar-filter-bar {
  background: #11192c !important;
  border-color: #1c2540 !important;
}
[data-theme-mode="dark"] .amar-filter-bar label { color: #94a3b8 !important; }
[data-theme-mode="dark"] .amar-filter-bar .form-control,
[data-theme-mode="dark"] .amar-filter-bar .form-select,
[data-theme-mode="dark"] .form-control,
[data-theme-mode="dark"] .form-select {
  background-color: #0d1525 !important;
  color: #fff !important;
  border-color: #1c2540 !important;
}
[data-theme-mode="dark"] .form-control::placeholder { color: #6c7a93 !important; }

/* Botões secundários no dark */
[data-theme-mode="dark"] .btn-light {
  background: #1c2540 !important;
  color: #fff !important;
  border-color: #2a3454 !important;
}
[data-theme-mode="dark"] .btn-light:hover {
  background: #283155 !important;
}

/* Dropdown menus */
[data-theme-mode="dark"] .dropdown-menu {
  background-color: #11192c !important;
  border-color: #1c2540 !important;
}
[data-theme-mode="dark"] .dropdown-item {
  color: #d8dee8 !important;
}
[data-theme-mode="dark"] .dropdown-item:hover {
  background-color: #1c2540 !important;
  color: #fff !important;
}
[data-theme-mode="dark"] .dropdown-divider { border-color: #1c2540 !important; }

/* Footer */
[data-theme-mode="dark"] .amar-footer {
  background: #0a1120 !important;
  color: #94a3b8 !important;
  border-top: 1px solid #1c2540 !important;
}

/* Modais */
[data-theme-mode="dark"] .modal-content {
  background-color: #11192c !important;
  color: #d8dee8 !important;
  border: 1px solid #1c2540 !important;
}
[data-theme-mode="dark"] .modal-header,
[data-theme-mode="dark"] .modal-footer {
  border-color: #1c2540 !important;
}
[data-theme-mode="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(1.4); }

/* Page title */
[data-theme-mode="dark"] .page-title { color: #fff !important; }
[data-theme-mode="dark"] .page-header-breadcrumb .text-muted { color: #94a3b8 !important; }

/* Texto auxiliar */
[data-theme-mode="dark"] .text-muted { color: #94a3b8 !important; }
[data-theme-mode="dark"] .bg-light { background-color: #1a2238 !important; }

/* Tabs */
[data-theme-mode="dark"] .nav-tabs {
  border-bottom-color: #1c2540;
}
[data-theme-mode="dark"] .nav-tabs .nav-link {
  color: #94a3b8 !important;
}
[data-theme-mode="dark"] .nav-tabs .nav-link.active {
  background-color: #11192c !important;
  border-color: #1c2540 #1c2540 #11192c !important;
  color: #fff !important;
}
[data-theme-mode="dark"] .tab-content {
  background-color: #11192c !important;
  border-color: #1c2540 !important;
}

/* Alerts */
[data-theme-mode="dark"] .alert-primary {
  background-color: rgba(30,90,180,0.18) !important;
  color: #cfdfff !important;
  border-color: rgba(30,90,180,0.35) !important;
}
[data-theme-mode="dark"] .alert-danger {
  background-color: rgba(211,47,47,0.16) !important;
  color: #ffd2d2 !important;
  border-color: rgba(211,47,47,0.30) !important;
}

/* ==========================================================================
   AMAR — Autocomplete (componente global para drops grandes)
   ========================================================================== */
.amar-ac { position: relative; }
.amar-ac-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 1050;
    background: #fff; border: 1px solid #dde3ec; border-radius: 6px;
    box-shadow: 0 8px 24px rgba(18,60,130,0.12);
    max-height: 320px; overflow-y: auto;
    margin-top: 4px; display: none;
}
.amar-ac-dropdown.show { display: block; }
.amar-ac-item {
    padding: 0.5rem 0.85rem; cursor: pointer;
    border-bottom: 1px solid #f1f4f9;
}
.amar-ac-item:last-child { border-bottom: none; }
.amar-ac-item:hover, .amar-ac-item.amar-ac-active {
    background: #f3f6fb; color: var(--amar-gov-blue-dark, #0c2c64);
}
.amar-ac-item small { color: #6c757d; display: block; }
.amar-ac-empty { padding: 1rem; text-align: center; color: #6c757d; }

[data-theme-mode="dark"] .amar-ac-dropdown {
    background-color: #11192c !important;
    border-color: #1c2540 !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
[data-theme-mode="dark"] .amar-ac-item {
    border-bottom-color: #1c2540 !important;
    color: #d8dee8;
}
[data-theme-mode="dark"] .amar-ac-item:hover,
[data-theme-mode="dark"] .amar-ac-item.amar-ac-active {
    background-color: #1a2238 !important;
    color: #fff !important;
}
[data-theme-mode="dark"] .amar-ac-item small { color: #94a3b8 !important; }
[data-theme-mode="dark"] .amar-ac-empty { color: #94a3b8; }

/* =========================================================
   ASSISTENTE IA — override de cores para identidade AMAR
   ========================================================= */

/* Botão do header */
.assistente-ia-header-btn {
    background: linear-gradient(135deg, var(--amar-gov-blue) 0%, var(--amar-gov-blue-deeper) 100%) !important;
    align-self: center !important;
    margin-right: 8px !important;
    height: 36px !important;
}
.assistente-ia-header-btn:hover {
    box-shadow: 0 4px 12px rgba(13, 42, 92, 0.35) !important;
}
.assistente-ia-header-btn svg { color: #fff; }

/* Painel — header gradient AMAR */
.assistente-ia-header {
    background: linear-gradient(135deg, var(--amar-gov-blue) 0%, var(--amar-gov-blue-deeper) 100%) !important;
    color: #fff !important;
}
.assistente-ia-header h3,
.assistente-ia-header .assistente-ia-status,
.assistente-ia-header .assistente-ia-close,
.assistente-ia-header .assistente-ia-close svg {
    color: #fff !important;
}
.assistente-ia-header .assistente-ia-status { opacity: .9; }

/* Bolhas de mensagem do usuário (alinhamento à direita) — azul AMAR */
.assistente-ia-panel .message.user .message-content,
.assistente-ia-panel .chat-message.user,
.assistente-ia-panel .message-user {
    background: linear-gradient(135deg, var(--amar-gov-blue) 0%, var(--amar-gov-blue-deeper) 100%) !important;
    color: #fff !important;
}

/* Botões de quick-actions / suggestions */
.assistente-ia-panel .quick-action-btn,
.assistente-ia-panel .suggestion-btn {
    border-color: var(--amar-gov-blue) !important;
    color: var(--amar-gov-blue-dark) !important;
}
.assistente-ia-panel .quick-action-btn:hover,
.assistente-ia-panel .suggestion-btn:hover {
    background: var(--amar-gov-blue) !important;
    color: #fff !important;
}

/* Botão de enviar (avião) */
.assistente-ia-send-btn {
    background: var(--amar-gov-blue) !important;
}
.assistente-ia-send-btn:hover {
    background: var(--amar-gov-blue-dark) !important;
}

/* Ícone microfone gravando */
.assistente-ia-voice-btn.recording {
    background: var(--amar-gov-blue-dark) !important;
}

/* Avatar do assistente (círculo do header do painel) */
.assistente-ia-avatar {
    background: rgba(255, 255, 255, 0.18) !important;
}

/* Mensagens do assistente (à esquerda) — fundo claro com borda AMAR */
.assistente-ia-panel .message.assistant .message-content,
.assistente-ia-panel .chat-message.assistant,
.assistente-ia-panel .message-assistant {
    background: #f1f5fb !important;
    color: var(--amar-gov-blue-deeper) !important;
    border-left: 3px solid var(--amar-gov-blue) !important;
}
