/**
 * M365 Control Center - Enterprise Design System
 * High-performance dual-theme styling:
 * - Flagship Dark Mode: Ultra-modern obsidian canvas with radial ambient cones, frosted liquid glassmorphism, and neon telemetry.
 * - Flagship Light Mode: High-contrast, clean corporate aesthetic with crisp borders, deep slate typography, and 100% WCAG-compliant legibility across all views.
 */

/* =========================================================================
   DESIGN TOKENS & VARIABLES
   ========================================================================= */

:root {
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Motion Sites Dark Theme Palette (Default Flagship) */
  --bg-app: #060810;
  --bg-canvas: #060810;
  --bg-sidebar: rgba(8, 12, 22, 0.92);
  --bg-sidebar-hover: rgba(255, 255, 255, 0.05);
  --bg-sidebar-active: rgba(14, 165, 233, 0.15);
  --text-sidebar: #94a3b8;
  --text-sidebar-hover: #ffffff;
  --text-sidebar-active: #38bdf8;

  --bg-card: rgba(12, 17, 30, 0.75);
  --bg-card-header: rgba(15, 23, 42, 0.70);
  --bg-card-subtle: rgba(15, 23, 42, 0.50);
  --bg-hover: rgba(56, 189, 248, 0.06);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-highlight: rgba(255, 255, 255, 0.16);
  --border-active: rgba(56, 189, 248, 0.45);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Accent Colors */
  --color-primary: #0ea5e9;
  --color-primary-light: #38bdf8;
  --color-primary-dark: #0284c7;
  --color-success: #10b981;
  --color-success-light: #34d399;
  --color-warning: #f59e0b;
  --color-warning-light: #fbbf24;
  --color-danger: #ef4444;
  --color-danger-light: #f87171;
  --color-purple: #8b5cf6;
  --color-purple-light: #a78bfa;
  --color-teal: #14b8a6;
  --color-info: #6366f1;
  --color-cyan: #06b6d4;

  /* Dimensions & Spacing */
  --sidebar-width: 285px;
  --topbar-height: 70px;
  --card-radius: 14px;
  --pill-radius: 9999px;

  /* Shadows & Glass Highlights */
  --shadow-sm: 0 2px 8px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.6);
  --glass-highlight: inset 0 1px 0 0 rgba(255, 255, 255, 0.08);
  --glow-cyan: 0 0 20px rgba(14, 165, 233, 0.22);
}

[data-bs-theme="dark"] {
  --bg-app: #060810;
  --bg-sidebar: rgba(8, 12, 22, 0.92);
  --bg-card: rgba(12, 17, 30, 0.75);
  --bg-card-header: rgba(15, 23, 42, 0.70);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --shadow-sm: 0 2px 8px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.55);
}

[data-bs-theme="light"] {
  /* Modo Claro - Paleta Corporativa de Alto Contraste */
  --bg-app: #f8fafc;
  --bg-canvas: #f8fafc;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: #0284c7;
  --text-sidebar: #94a3b8;
  --text-sidebar-hover: #ffffff;
  --text-sidebar-active: #ffffff;

  --bg-card: #ffffff;
  --bg-card-header: #f8fafc;
  --bg-card-subtle: #f1f5f9;
  --bg-hover: rgba(2, 132, 199, 0.06);
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-highlight: #cbd5e1;
  --border-active: #0284c7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --glass-highlight: inset 0 1px 0 0 rgba(255, 255, 255, 1);
}

/* =========================================================================
   ESTRUTURA GLOBAL E BACKGROUND
   ========================================================================= */

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[data-bs-theme="dark"] body {
  background-color: #060810;
  background-image: 
    radial-gradient(1000px circle at 15% -5%, rgba(14, 165, 233, 0.09), transparent 70%),
    radial-gradient(1100px circle at 85% 15%, rgba(99, 102, 241, 0.07), transparent 70%),
    radial-gradient(900px circle at 50% 95%, rgba(16, 185, 129, 0.04), transparent 70%);
  background-attachment: fixed;
}

[data-bs-theme="light"] body {
  background-color: #f8fafc !important;
  background-image: none !important;
  color: #0f172a !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

[data-bs-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.35);
}

/* =========================================================================
   ESTRUTURA GERAL (LAYOUT)
   ========================================================================= */

.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar Desktop */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--text-sidebar);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1020;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

[data-bs-theme="light"] .app-sidebar {
  border-right: 1px solid #e2e8f0;
}

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.35);
}

.brand-link {
  transition: opacity 0.2s ease;
}

.brand-link:hover {
  opacity: 0.92;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.brand-text {
  min-width: 0;
  white-space: nowrap;
}

.brand-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: #94a3b8;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.sidebar-nav {
  padding: 1.1rem 0.85rem;
  overflow-y: auto;
  flex-grow: 1;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.sidebar-toggle-btn {
  font-size: 1.15rem;
  transition: color 0.2s ease, transform 0.2s ease;
  line-height: 1;
}

.sidebar-toggle-btn:hover {
  color: #ffffff !important;
  transform: scale(1.08);
}

.nav-section-title {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  padding: 0.75rem 0.85rem 0.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-section-title:hover {
  color: #cbd5e1;
  background-color: rgba(255, 255, 255, 0.04);
}

.nav-collapse-icon {
  font-size: 0.65rem;
  transition: transform 0.25s ease;
  opacity: 0.7;
}

.nav-section-title.collapsed .nav-collapse-icon {
  transform: rotate(-90deg);
}

/* Sidebar Nav Links */
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.95rem;
  color: var(--text-sidebar);
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 3px;
  text-decoration: none;
  position: relative;
}

.sidebar-nav .nav-link i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  opacity: 0.85;
  transition: color 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.sidebar-nav .nav-link:hover {
  background-color: var(--bg-sidebar-hover);
  color: #ffffff;
  transform: translateX(3px);
}

.sidebar-nav .nav-link:hover i {
  opacity: 1;
  color: #38bdf8;
}

.sidebar-nav .nav-link.active {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.16) 0%, rgba(14, 165, 233, 0.02) 100%);
  color: #38bdf8;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  box-shadow: inset 0 0 16px rgba(14, 165, 233, 0.12);
}

.sidebar-nav .nav-link.active i {
  opacity: 1;
  color: #38bdf8;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6));
}

/* Modo Sidebar Recolhida (Mini-Sidebar Icon-Only) */
body.sidebar-collapsed .app-sidebar {
  width: 68px;
}

body.sidebar-collapsed .app-main {
  margin-left: 68px;
}

body.sidebar-collapsed .sidebar-header {
  padding: 0;
  justify-content: center;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .brand-img-expanded,
body.sidebar-collapsed .sidebar-toggle-btn {
  display: none !important;
}

body.sidebar-collapsed .brand-icon-collapsed {
  display: flex !important;
}

body.sidebar-collapsed .nav-section-title {
  font-size: 0;
  padding: 0.4rem 0;
  margin: 0.4rem 0.5rem;
  justify-content: center;
  border-top: 1px solid var(--border-color);
}

body.sidebar-collapsed .nav-section-title span,
body.sidebar-collapsed .nav-section-title .nav-collapse-icon {
  display: none !important;
}

body.sidebar-collapsed .sidebar-nav .nav-link {
  justify-content: center;
  padding: 0.65rem 0;
  gap: 0;
  border-left: none !important;
}

body.sidebar-collapsed .sidebar-nav .nav-link span,
body.sidebar-collapsed .sidebar-nav .nav-link .badge {
  display: none !important;
}

body.sidebar-collapsed .sidebar-nav .nav-link i {
  font-size: 1.2rem;
  margin: 0;
  width: auto;
}

/* =========================================================================
   SEPARAÇÃO VISÍVEL ENTRE M365 E AD LOCKOUT NO MENU LATERAL
   ========================================================================= */
.sidebar-system-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 20px 12px 10px 12px;
  padding: 8px 0;
  position: relative;
}

.sidebar-system-separator .separator-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0.8;
}

.sidebar-system-separator .separator-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.35);
  padding: 3px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.22);
  white-space: nowrap;
}

[data-bs-theme="light"] .sidebar-system-separator .separator-badge {
  color: #0284c7;
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.25);
  box-shadow: none;
}

body.sidebar-collapsed .sidebar-system-separator {
  margin: 14px 6px 6px 6px;
  padding: 4px 0;
}

body.sidebar-collapsed .sidebar-system-separator .separator-line {
  display: none;
}

body.sidebar-collapsed .sidebar-system-separator .separator-badge span {
  display: none;
}

body.sidebar-collapsed .sidebar-system-separator .separator-badge {
  padding: 4px;
}

/* =========================================================================
   TOPBAR HEADER
   ========================================================================= */

.app-main {
  flex-grow: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 991.98px) {
  .app-sidebar {
    display: none;
  }
  .app-main {
    margin-left: 0;
  }
}

.app-topbar {
  height: var(--topbar-height);
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1010;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

[data-bs-theme="light"] .app-topbar {
  background-color: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.06) !important;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-title-wrap h1 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  white-space: nowrap;
  letter-spacing: -0.025em;
}

[data-bs-theme="light"] .topbar-title-wrap h1 {
  color: #0f172a !important;
}

.topbar-title-wrap small {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: var(--font-family);
}

[data-bs-theme="light"] .topbar-title-wrap small {
  color: #475569 !important;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Metadata Chips */
.file-info-chip {
  background-color: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  backdrop-filter: blur(8px);
}

[data-bs-theme="light"] .file-info-chip {
  background-color: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
}

.file-info-chip i {
  color: var(--color-primary-light);
}

[data-bs-theme="light"] .file-info-chip i {
  color: #0284c7 !important;
}

/* User Profile Widget */
.btn-user-profile {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.3rem 0.75rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

[data-bs-theme="light"] .btn-user-profile {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

.btn-user-profile:hover,
.btn-user-profile:focus {
  background-color: var(--bg-hover);
  border-color: var(--color-primary-light);
  color: var(--text-primary);
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.18);
}

[data-bs-theme="light"] .btn-user-profile:hover,
[data-bs-theme="light"] .btn-user-profile:focus {
  background-color: #f1f5f9 !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.15) !important;
}

.user-avatar-circle {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  font-family: inherit;
  flex-shrink: 0;
}

/* Área de Conteúdo */
.app-content {
  padding: 1.5rem;
  flex-grow: 1;
}

/* Multi-Filter Toolbar dos Painéis de Detalhes */
.multi-filter-toolbar {
  background-color: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color) !important;
  border-radius: 12px;
  padding: 0.9rem 1.2rem;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all 0.2s ease;
}

[data-bs-theme="light"] .multi-filter-toolbar {
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

.multi-filter-toolbar .form-label {
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  color: var(--text-secondary);
}

[data-bs-theme="light"] .multi-filter-toolbar .form-label {
  color: #334155 !important;
}

.multi-filter-toolbar .form-select-sm,
.multi-filter-toolbar .form-control-sm {
  font-size: 0.8125rem;
  border-radius: 8px;
  background-color: rgba(10, 15, 28, 0.7);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

[data-bs-theme="light"] .multi-filter-toolbar .form-select-sm,
[data-bs-theme="light"] .multi-filter-toolbar .form-control-sm {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

.multi-filter-toolbar .form-select-sm:focus,
.multi-filter-toolbar .form-control-sm:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
  outline: none;
}

[data-bs-theme="light"] .multi-filter-toolbar .form-select-sm:focus,
[data-bs-theme="light"] .multi-filter-toolbar .form-control-sm:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18) !important;
}

/* =========================================================================
   EMPTY STATE & DROP ZONE
   ========================================================================= */

.empty-state-card {
  background-color: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: 16px;
  padding: 3.5rem 2rem;
  text-align: center;
  max-width: 650px;
  margin: 3rem auto;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  transition: all 0.2s ease;
}

[data-bs-theme="light"] .empty-state-card {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

.empty-state-card.dragover {
  border-color: var(--color-primary-light);
  background-color: rgba(14, 165, 233, 0.08);
  transform: scale(1.01);
  box-shadow: 0 0 30px rgba(14, 165, 233, 0.2);
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  background: rgba(14, 165, 233, 0.12);
  color: var(--color-primary-light);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.5rem;
  border: 1px solid rgba(14, 165, 233, 0.25);
  box-shadow: 0 0 20px rgba(14, 165, 233, 0.15);
}

[data-bs-theme="light"] .empty-state-icon {
  background: rgba(2, 132, 199, 0.1) !important;
  color: #0284c7 !important;
  border-color: rgba(2, 132, 199, 0.25) !important;
}

/* =========================================================================
   CARDS & PAINÉIS (COMMAND CENTER LOOK)
   ========================================================================= */

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow-sm), var(--glass-highlight);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
  position: relative;
  overflow: hidden;
  height: 100%;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

[data-bs-theme="light"] .kpi-card {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

/* Top Accent Line */
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--card-accent, #38bdf8), transparent 85%);
  opacity: 0.9;
  transition: height 0.2s ease, opacity 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.32);
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.5), 0 0 20px -4px rgba(14, 165, 233, 0.16), var(--glass-highlight);
}

[data-bs-theme="light"] .kpi-card:hover {
  border-color: #0284c7 !important;
  box-shadow: 0 8px 24px -4px rgba(2, 132, 199, 0.18) !important;
}

.kpi-card:hover::before {
  height: 3px;
  opacity: 1;
}

/* Mapeamento de Accents nos KPI Cards */
.kpi-card.accent-primary, .kpi-card.blue { --card-accent: #38bdf8; }
.kpi-card.accent-success, .kpi-card.green { --card-accent: #10b981; }
.kpi-card.accent-warning, .kpi-card.orange { --card-accent: #f59e0b; }
.kpi-card.accent-danger,  .kpi-card.red    { --card-accent: #ef4444; }
.kpi-card.accent-purple,  .kpi-card.indigo { --card-accent: #8b5cf6; }
.kpi-card.accent-teal,    .kpi-card.cyan   { --card-accent: #06b6d4; }

.kpi-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

[data-bs-theme="light"] .kpi-title {
  color: #475569 !important;
}

.kpi-value {
  font-size: 2.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #ffffff;
  line-height: 1.1;
  margin-bottom: 0.35rem;
  letter-spacing: -0.035em;
}

[data-bs-theme="light"] .kpi-value {
  color: #0f172a !important;
}

.kpi-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 400;
}

[data-bs-theme="light"] .kpi-subtitle {
  color: #64748b !important;
}

.kpi-icon-watermark {
  position: absolute;
  right: 1.1rem;
  bottom: 0.85rem;
  font-size: 2.8rem;
  opacity: 0.04;
  pointer-events: none;
  transform: rotate(-10deg) scale(1.05);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.kpi-card:hover .kpi-icon-watermark {
  opacity: 0.08;
  transform: rotate(0deg) scale(1.15);
}

[data-bs-theme="light"] .kpi-icon-watermark {
  opacity: 0.04 !important;
}

/* Micro-containers de Ícones com Brilho */
.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.kpi-icon.blue { background: rgba(14, 165, 233, 0.14); color: #38bdf8; border-color: rgba(14, 165, 233, 0.25); box-shadow: 0 0 14px rgba(14, 165, 233, 0.15); }
.kpi-icon.green { background: rgba(16, 185, 129, 0.14); color: #34d399; border-color: rgba(16, 185, 129, 0.25); box-shadow: 0 0 14px rgba(16, 185, 129, 0.15); }
.kpi-icon.orange { background: rgba(245, 158, 11, 0.14); color: #fbbf24; border-color: rgba(245, 158, 11, 0.25); box-shadow: 0 0 14px rgba(245, 158, 11, 0.15); }
.kpi-icon.red { background: rgba(239, 68, 68, 0.14); color: #f87171; border-color: rgba(239, 68, 68, 0.25); box-shadow: 0 0 14px rgba(239, 68, 68, 0.15); }
.kpi-icon.cyan { background: rgba(6, 182, 212, 0.14); color: #22d3ee; border-color: rgba(6, 182, 212, 0.25); box-shadow: 0 0 14px rgba(6, 182, 212, 0.15); }
.kpi-icon.indigo { background: rgba(99, 102, 241, 0.14); color: #818cf8; border-color: rgba(99, 102, 241, 0.25); box-shadow: 0 0 14px rgba(99, 102, 241, 0.15); }

[data-bs-theme="light"] .kpi-icon.blue { background: rgba(2, 132, 199, 0.1) !important; color: #0284c7 !important; border-color: rgba(2, 132, 199, 0.25) !important; box-shadow: none !important; }
[data-bs-theme="light"] .kpi-icon.green { background: rgba(16, 185, 129, 0.1) !important; color: #059669 !important; border-color: rgba(16, 185, 129, 0.25) !important; box-shadow: none !important; }
[data-bs-theme="light"] .kpi-icon.orange { background: rgba(245, 158, 11, 0.1) !important; color: #d97706 !important; border-color: rgba(245, 158, 11, 0.25) !important; box-shadow: none !important; }
[data-bs-theme="light"] .kpi-icon.red { background: rgba(239, 68, 68, 0.1) !important; color: #dc2626 !important; border-color: rgba(239, 68, 68, 0.25) !important; box-shadow: none !important; }
[data-bs-theme="light"] .kpi-icon.cyan { background: rgba(6, 182, 212, 0.1) !important; color: #0891b2 !important; border-color: rgba(6, 182, 212, 0.25) !important; box-shadow: none !important; }
[data-bs-theme="light"] .kpi-icon.indigo { background: rgba(99, 102, 241, 0.1) !important; color: #4f46e5 !important; border-color: rgba(99, 102, 241, 0.25) !important; box-shadow: none !important; }

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

[data-bs-theme="light"] .kpi-sub {
  color: #64748b !important;
}

/* KPI Cards Interativos */
.kpi-card.interactive-card {
  cursor: pointer;
  user-select: none;
}

.kpi-card.interactive-card:hover {
  transform: translateY(-3px);
  border-color: #38bdf8 !important;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(14, 165, 233, 0.25) !important;
}

[data-bs-theme="light"] .kpi-card.interactive-card:hover {
  border-color: #0284c7 !important;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.2) !important;
}

.kpi-card.active-filter-card {
  border-color: #ef4444 !important;
  background: linear-gradient(145deg, rgba(239, 68, 68, 0.15), var(--bg-card)) !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.35) !important;
}

/* =========================================================================
   RISK SUMMARY CARDS
   ========================================================================= */

.risk-card {
  border-radius: var(--card-radius);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  box-shadow: var(--shadow-sm), var(--glass-highlight);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

[data-bs-theme="light"] .risk-card {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}

.risk-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.risk-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
}

.risk-card.risk-critical::before { background: var(--color-danger); }
.risk-card.risk-warning::before  { background: var(--color-warning); }
.risk-card.risk-normal::before   { background: var(--color-success); }

.risk-icon-wrap {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.risk-critical .risk-icon-wrap {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.2);
}

.risk-warning .risk-icon-wrap {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.2);
}

.risk-normal .risk-icon-wrap {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.2);
}

[data-bs-theme="light"] .risk-card h3,
[data-bs-theme="light"] .risk-card .h4 {
  color: #0f172a !important;
}

[data-bs-theme="light"] .risk-card .text-secondary {
  color: #475569 !important;
}

/* =========================================================================
   PAINÉIS DE GRÁFICOS E TABELAS
   ========================================================================= */

.chart-panel, .table-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm), var(--glass-highlight);
  margin-bottom: 1.5rem;
  overflow: hidden;
  scroll-margin-top: 85px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

[data-bs-theme="light"] .chart-panel,
[data-bs-theme="light"] .table-panel {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.panel-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-card-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

[data-bs-theme="light"] .panel-header {
  background-color: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  letter-spacing: -0.015em;
}

[data-bs-theme="light"] .panel-title {
  color: #0f172a !important;
}

.panel-title i {
  color: #38bdf8;
}

[data-bs-theme="light"] .panel-title i {
  color: #0284c7 !important;
}

.panel-body {
  padding: 1.4rem;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 320px;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
}

.chart-wrapper-lg {
  position: relative;
  width: 100%;
  height: 320px;
}

/* =========================================================================
   DATATABLES ESTILIZAÇÃO & REFINAMENTO EDITORIAL
   ========================================================================= */

.dt-container {
  padding: 0.5rem 0;
}

.table {
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
  margin-bottom: 0;
}

.table > :not(caption) > * > * {
  background-color: transparent !important;
  border-bottom-color: rgba(255, 255, 255, 0.05) !important;
  padding: 0.8rem 0.95rem;
  font-size: 0.85rem;
  vertical-align: middle;
}

[data-bs-theme="light"] .table > :not(caption) > * > * {
  color: #0f172a !important;
  border-bottom-color: #e2e8f0 !important;
}

.table-hover > tbody > tr:hover > * {
  background-color: rgba(56, 189, 248, 0.04) !important;
}

[data-bs-theme="light"] .table-hover > tbody > tr:hover > * {
  background-color: rgba(2, 132, 199, 0.04) !important;
}

thead th {
  font-size: 0.7rem !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary) !important;
  font-weight: 700 !important;
  background-color: var(--bg-card-header) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
  padding: 0.85rem 0.95rem !important;
}

[data-bs-theme="light"] thead th {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

.dt-search input {
  background-color: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

[data-bs-theme="light"] .dt-search input {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

.dt-search input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
  outline: none;
}

[data-bs-theme="light"] .dt-search input:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18) !important;
}

.dt-length select {
  background-color: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.4rem 1.8rem 0.4rem 0.75rem;
  font-size: 0.85rem;
  backdrop-filter: blur(8px);
}

[data-bs-theme="light"] .dt-length select {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

/* Responsividade e Redimensionamento Dinâmico para Tabela de Usuários */
#tableUsers {
  width: 100% !important;
}

#tableUsers th,
#tableUsers td {
  padding: 0.5rem 0.6rem !important;
  font-size: 0.8125rem !important;
  vertical-align: middle;
}

#tableUsers thead th {
  font-size: 0.72rem !important;
  padding: 0.65rem 0.6rem !important;
  white-space: nowrap !important;
  letter-spacing: 0.05em;
}

#tableUsers .badge {
  font-size: 0.72rem !important;
  padding: 0.3rem 0.5rem !important;
}

/* Suporte a rolagem horizontal suave */
.table-responsive {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
  background: transparent;
}

.table-responsive::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

[data-bs-theme="light"] .table-responsive::-webkit-scrollbar-thumb {
  background-color: #cbd5e1 !important;
}

/* =========================================================================
   DATATABLES — EXPORT BUTTONS & LAYOUT
   ========================================================================= */

.dt-layout-start {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
}

div.dt-buttons {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: wrap;
}

div.dt-buttons > .dt-button,
div.dt-buttons > .buttons-html5,
div.dt-buttons > .buttons-print,
div.dt-buttons a.dt-button,
div.dt-buttons button.dt-button,
div.dt-buttons .btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 0.4rem 0.85rem !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  opacity: 1 !important;
  visibility: visible !important;
  line-height: 1.4 !important;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  backdrop-filter: blur(8px);
}

[data-bs-theme="dark"] div.dt-buttons .btn,
[data-bs-theme="dark"] div.dt-buttons button,
[data-bs-theme="dark"] div.dt-buttons .dt-button {
  background-color: rgba(30, 41, 59, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #f8fafc !important;
}

[data-bs-theme="dark"] div.dt-buttons .btn:hover,
[data-bs-theme="dark"] div.dt-buttons button:hover,
[data-bs-theme="dark"] div.dt-buttons .dt-button:hover {
  background-color: #0284c7 !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4) !important;
}

[data-bs-theme="light"] div.dt-buttons .btn,
[data-bs-theme="light"] div.dt-buttons button,
[data-bs-theme="light"] div.dt-buttons .dt-button {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

[data-bs-theme="light"] div.dt-buttons .btn:hover,
[data-bs-theme="light"] div.dt-buttons button:hover,
[data-bs-theme="light"] div.dt-buttons .dt-button:hover {
  background-color: #0284c7 !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25) !important;
}

/* Page Length Selector */
.page-length-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

[data-bs-theme="light"] .page-length-control {
  color: #475569 !important;
}

.page-length-control select {
  padding: 0.25rem 0.6rem;
  font-size: 0.82rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
}

[data-bs-theme="light"] .page-length-control select {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

/* =========================================================================
   LEAFLET GEO MAP
   ========================================================================= */

#authGeoMap {
  height: 380px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.95) !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(12px) !important;
}

[data-bs-theme="light"] .leaflet-popup-content-wrapper {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.95) !important;
}

[data-bs-theme="light"] .leaflet-popup-tip {
  background: #ffffff !important;
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  line-height: 1.4 !important;
  color: #f8fafc !important;
  font-family: var(--font-family) !important;
}

[data-bs-theme="light"] .leaflet-popup-content {
  color: #0f172a !important;
}

/* =========================================================================
   LOADING OVERLAY
   ========================================================================= */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(6, 9, 17, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

[data-bs-theme="light"] .loading-overlay {
  background-color: rgba(248, 250, 252, 0.85) !important;
}

.loading-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 2.8rem 2.4rem;
  text-align: center;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(14, 165, 233, 0.2);
  backdrop-filter: blur(20px);
}

[data-bs-theme="light"] .loading-box {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12) !important;
  color: #0f172a !important;
}

/* =========================================================================
   CYBER BADGES & TELEMETRY PILLS
   ========================================================================= */

.severity-pill {
  padding: 0.28rem 0.7rem;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: 0.02em;
}

.severity-pill.green {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

[data-bs-theme="light"] .severity-pill.green {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #059669 !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  box-shadow: none !important;
}

.severity-pill.orange {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

[data-bs-theme="light"] .severity-pill.orange {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #d97706 !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  box-shadow: none !important;
}

.severity-pill.red {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

[data-bs-theme="light"] .severity-pill.red {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #dc2626 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  box-shadow: none !important;
}

.badge-type {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-notebook {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

[data-bs-theme="light"] .badge-notebook {
  background: rgba(2, 132, 199, 0.1) !important;
  color: #0284c7 !important;
  border-color: rgba(2, 132, 199, 0.3) !important;
}

.badge-desktop {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

[data-bs-theme="light"] .badge-desktop {
  background: rgba(139, 92, 246, 0.1) !important;
  color: #7c3aed !important;
  border-color: rgba(139, 92, 246, 0.3) !important;
}

.badge-wifi {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.35);
}

[data-bs-theme="light"] .badge-wifi {
  background: rgba(6, 182, 212, 0.1) !important;
  color: #0891b2 !important;
  border-color: rgba(6, 182, 212, 0.3) !important;
}

.badge-servidores, .badge-outros {
  background: rgba(100, 116, 139, 0.18);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

[data-bs-theme="light"] .badge-servidores,
[data-bs-theme="light"] .badge-outros {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border-color: #cbd5e1 !important;
}

.badge-vendor {
  font-size: 0.72rem;
  padding: 0.22rem 0.5rem;
  border-radius: 6px;
  font-weight: 600;
}

.badge-vendor-apple {
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

[data-bs-theme="light"] .badge-vendor-apple {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border-color: #cbd5e1 !important;
}

.badge-vendor-samsung {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.35);
}

[data-bs-theme="light"] .badge-vendor-samsung {
  background: rgba(2, 132, 199, 0.1) !important;
  color: #0284c7 !important;
  border-color: rgba(2, 132, 199, 0.3) !important;
}

.badge-vendor-motorola {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

[data-bs-theme="light"] .badge-vendor-motorola {
  background: rgba(16, 185, 129, 0.1) !important;
  color: #059669 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.badge-vendor-private {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

[data-bs-theme="light"] .badge-vendor-private {
  background: rgba(245, 158, 11, 0.1) !important;
  color: #d97706 !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

.badge-mac {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  color: #cbd5e1;
}

[data-bs-theme="light"] .badge-mac {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

.ou-tag {
  font-size: 0.75rem;
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.12);
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  display: inline-block;
  border: 1px solid rgba(14, 165, 233, 0.25);
  font-family: var(--font-mono);
}

[data-bs-theme="light"] .ou-tag {
  color: #0284c7 !important;
  background: rgba(2, 132, 199, 0.08) !important;
  border-color: rgba(2, 132, 199, 0.25) !important;
}

.threshold-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

[data-bs-theme="light"] .threshold-legend {
  color: #475569 !important;
}

.threshold-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.threshold-dot.green { background-color: #10b981; box-shadow: 0 0 6px #10b981; }
.threshold-dot.orange { background-color: #f59e0b; box-shadow: 0 0 6px #f59e0b; }
.threshold-dot.red { background-color: #ef4444; box-shadow: 0 0 6px #ef4444; }

.live-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  display: inline-block;
  margin-right: 6px;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.table-row-multi-device {
  background-color: rgba(239, 68, 68, 0.05) !important;
  box-shadow: inset 2px 0 0 rgba(239, 68, 68, 0.6) !important;
}

/* =========================================================================
   SOC & AD LOCKOUT COMPONENTES
   ========================================================================= */

.soc-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm), var(--glass-highlight);
  backdrop-filter: blur(20px);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-bs-theme="light"] .soc-card {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.soc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(56, 189, 248, 0.3);
}

[data-bs-theme="light"] .soc-card:hover {
  border-color: #0284c7 !important;
}

.filter-select, .filter-input {
  background-color: rgba(15, 23, 42, 0.65) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  font-size: 0.85rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

[data-bs-theme="light"] .filter-select,
[data-bs-theme="light"] .filter-input {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

.filter-select:focus, .filter-input:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22) !important;
}

[data-bs-theme="light"] .filter-select:focus,
[data-bs-theme="light"] .filter-input:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18) !important;
}

.btn-group-custom .btn {
  background-color: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

[data-bs-theme="light"] .btn-group-custom .btn {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
}

.btn-group-custom .btn.active, .btn-group-custom .btn:hover {
  background-color: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.35);
}

[data-bs-theme="light"] .btn-group-custom .btn.active {
  background-color: #0284c7 !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
}

/* =========================================================================
   GERENCIAMENTO DE USUARIOS - GRID DE ACOES PADRONIZADO E UNIFORME
   ========================================================================= */

.ad-actions-cell {
  width: 570px !important;
  min-width: 570px !important;
  max-width: 570px !important;
  padding: 6px 8px !important;
}

.ad-actions-grid {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
  margin: 0 auto !important;
  width: 554px !important;
}

/* Slot 1: Desligado / Protegido (98px) */
.ad-actions-grid .ad-col-status {
  width: 98px !important;
  min-width: 98px !important;
  max-width: 98px !important;
  flex: 0 0 98px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Slot 2: Habilitar (88px) */
.ad-actions-grid .ad-col-enable {
  width: 88px !important;
  min-width: 88px !important;
  max-width: 88px !important;
  flex: 0 0 88px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Slot 3: Backup/Excecao (130px) */
.ad-actions-grid .ad-col-backup {
  width: 130px !important;
  min-width: 130px !important;
  max-width: 130px !important;
  flex: 0 0 130px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding-left: 4px !important;
}

/* Slot 4: Desbloquear (108px) */
.ad-actions-grid .ad-col-unlock {
  width: 108px !important;
  min-width: 108px !important;
  max-width: 108px !important;
  flex: 0 0 108px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Slot 5: Alterar Senha (118px) */
.ad-actions-grid .ad-col-pwd {
  width: 118px !important;
  min-width: 118px !important;
  max-width: 118px !important;
  flex: 0 0 118px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Botoes e Badges de Acao Padronizados */
.ad-actions-grid .btn-ad-action,
.ad-actions-grid .badge-ad-action {
  height: 28px !important;
  line-height: 26px !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  padding: 0 8px !important;
  width: 100% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  transition: all 0.15s ease-in-out !important;
}

.ad-actions-grid .badge-ad-protected {
  background-color: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
  cursor: default !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

[data-bs-theme="dark"] .ad-actions-grid .badge-ad-protected {
  background-color: rgba(245, 158, 11, 0.2) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
}

[data-bs-theme="light"] .ad-actions-grid .badge-ad-protected {
  background-color: rgba(245, 158, 11, 0.12) !important;
  color: #b45309 !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  box-shadow: none !important;
}

.ad-actions-grid .form-check-input {
  cursor: pointer;
}

.ad-actions-grid .form-check-label {
  cursor: pointer;
  font-size: 0.75rem !important;
}

/* =========================================================================
   BOOTSTRAP OVERRIDES (MODAIS, DROPDOWNS E BOTÕES)
   ========================================================================= */

/* Dropdowns */
.dropdown-menu {
  background-color: rgba(11, 16, 28, 0.94) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(20px) !important;
  padding: 0.5rem !important;
}

[data-bs-theme="light"] .dropdown-menu {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
}

.dropdown-item {
  color: #cbd5e1 !important;
  border-radius: 8px !important;
  font-size: 0.85rem !important;
  padding: 0.5rem 0.85rem !important;
  transition: all 0.15s ease !important;
}

[data-bs-theme="light"] .dropdown-item {
  color: #1e293b !important;
}

.dropdown-item:hover, .dropdown-item:focus {
  background-color: rgba(56, 189, 248, 0.12) !important;
  color: #38bdf8 !important;
}

[data-bs-theme="light"] .dropdown-item:hover,
[data-bs-theme="light"] .dropdown-item:focus {
  background-color: #f1f5f9 !important;
  color: #0284c7 !important;
}

.dropdown-item.active {
  background-color: rgba(14, 165, 233, 0.22) !important;
  color: #38bdf8 !important;
  font-weight: 600 !important;
}

[data-bs-theme="light"] .dropdown-item.active {
  background-color: rgba(2, 132, 199, 0.12) !important;
  color: #0284c7 !important;
  font-weight: 600 !important;
}

.dropdown-divider {
  border-top-color: rgba(255, 255, 255, 0.08) !important;
}

[data-bs-theme="light"] .dropdown-divider {
  border-top-color: #e2e8f0 !important;
}

.dropdown-header {
  font-size: 0.68rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  color: #64748b !important;
  font-weight: 700 !important;
  padding: 0.5rem 0.85rem 0.25rem !important;
}

/* Modals */
.modal-content {
  background-color: rgba(11, 16, 28, 0.94) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 18px !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 40px rgba(14, 165, 233, 0.15) !important;
  backdrop-filter: blur(24px) !important;
}

[data-bs-theme="light"] .modal-content {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12) !important;
  color: #0f172a !important;
}

.modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding: 1.25rem 1.5rem !important;
}

[data-bs-theme="light"] .modal-header {
  border-color: #e2e8f0 !important;
}

.modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding: 1rem 1.5rem !important;
}

[data-bs-theme="light"] .modal-footer {
  border-color: #e2e8f0 !important;
}

.modal-title {
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
  color: #ffffff !important;
}

[data-bs-theme="light"] .modal-title {
  color: #0f172a !important;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%) !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35) !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%) !important;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5) !important;
  transform: translateY(-1px);
}

.btn-outline-primary {
  border-color: rgba(56, 189, 248, 0.4) !important;
  color: #38bdf8 !important;
  background: rgba(14, 165, 233, 0.08) !important;
  backdrop-filter: blur(8px);
  border-radius: 8px !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-bs-theme="light"] .btn-outline-primary {
  border-color: #0284c7 !important;
  color: #0284c7 !important;
  background: rgba(2, 132, 199, 0.06) !important;
}

.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
  background: #0284c7 !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.35) !important;
  transform: translateY(-1px);
}

.btn-outline-secondary {
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #94a3b8 !important;
  background: rgba(255, 255, 255, 0.03) !important;
  backdrop-filter: blur(8px);
  border-radius: 8px !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-bs-theme="light"] .btn-outline-secondary {
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  background-color: #ffffff !important;
}

.btn-outline-secondary:hover, .btn-outline-secondary:focus {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

[data-bs-theme="light"] .btn-outline-secondary:hover,
[data-bs-theme="light"] .btn-outline-secondary:focus {
  background-color: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}

/* Offcanvas Mobile */
.offcanvas {
  background-color: rgba(8, 12, 22, 0.96) !important;
  border-right: 1px solid var(--border-color) !important;
  backdrop-filter: blur(24px) !important;
}

[data-bs-theme="light"] .offcanvas {
  background-color: #ffffff !important;
  border-right: 1px solid #e2e8f0 !important;
}

.offcanvas-header {
  border-bottom: 1px solid var(--border-color) !important;
}

/* =========================================================================
   UTILITÁRIOS ADICIONAIS DE CORES E BADGES
   ========================================================================= */

.text-purple { color: #a78bfa !important; }
[data-bs-theme="light"] .text-purple { color: #7c3aed !important; }
.bg-purple { background-color: #8b5cf6 !important; color: #ffffff !important; }
.bg-purple-subtle { background-color: rgba(139, 92, 246, 0.15) !important; color: #c084fc !important; border: 1px solid rgba(139, 92, 246, 0.3); }
[data-bs-theme="light"] .bg-purple-subtle { background-color: rgba(139, 92, 246, 0.12) !important; color: #6d28d9 !important; border-color: rgba(139, 92, 246, 0.25) !important; }
.accent-purple { border: 1px solid rgba(139, 92, 246, 0.35) !important; }
.fs-8 { font-size: 0.65rem !important; }

/* =========================================================================
   DATATABLES PAGINAÇÃO & INFO (DUAL-THEME)
   ========================================================================= */
.dt-info, .dataTables_info {
  font-size: 0.8125rem;
  color: var(--text-secondary) !important;
  padding-top: 0.5rem;
}
[data-bs-theme="light"] .dt-info,
[data-bs-theme="light"] .dataTables_info {
  color: #475569 !important;
}

.dt-paging .pagination,
.dataTables_paginate .pagination {
  margin-bottom: 0;
  gap: 4px;
}

.dt-paging .page-item .page-link,
.dataTables_paginate .page-item .page-link {
  font-size: 0.8125rem;
  border-radius: 8px !important;
  padding: 0.35rem 0.75rem;
  transition: all 0.2s ease;
}

[data-bs-theme="dark"] .dt-paging .page-item .page-link,
[data-bs-theme="dark"] .dataTables_paginate .page-item .page-link {
  background-color: rgba(15, 23, 42, 0.6) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #94a3b8 !important;
}

[data-bs-theme="dark"] .dt-paging .page-item.active .page-link,
[data-bs-theme="dark"] .dataTables_paginate .page-item.active .page-link {
  background-color: #0284c7 !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
}

[data-bs-theme="dark"] .dt-paging .page-item:not(.active):not(.disabled) .page-link:hover,
[data-bs-theme="dark"] .dataTables_paginate .page-item:not(.active):not(.disabled) .page-link:hover {
  background-color: rgba(56, 189, 248, 0.15) !important;
  color: #38bdf8 !important;
}

[data-bs-theme="light"] .dt-paging .page-item .page-link,
[data-bs-theme="light"] .dataTables_paginate .page-item .page-link {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

[data-bs-theme="light"] .dt-paging .page-item.active .page-link,
[data-bs-theme="light"] .dataTables_paginate .page-item.active .page-link {
  background-color: #0284c7 !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
}

[data-bs-theme="light"] .dt-paging .page-item:not(.active):not(.disabled) .page-link:hover,
[data-bs-theme="light"] .dataTables_paginate .page-item:not(.active):not(.disabled) .page-link:hover {
  background-color: #f1f5f9 !important;
  color: #0284c7 !important;
}

/* =========================================================================
   BOOTSTRAP CARDS & LIST GROUPS (DUAL-THEME)
   ========================================================================= */
[data-bs-theme="light"] .card {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

[data-bs-theme="light"] .card-header {
  background-color: #f8fafc !important;
  border-bottom-color: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-bs-theme="light"] .card-footer {
  background-color: #f8fafc !important;
  border-top-color: #e2e8f0 !important;
  color: #475569 !important;
}

[data-bs-theme="dark"] .card {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

[data-bs-theme="dark"] .card-header {
  background-color: var(--bg-card-header) !important;
  border-bottom-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

[data-bs-theme="light"] .list-group-item {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-bs-theme="dark"] .list-group-item {
  background-color: transparent !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* =========================================================================
   TIPOGRAFIA & LABELS NO MODO CLARO
   ========================================================================= */
[data-bs-theme="light"] .text-secondary {
  color: #475569 !important;
}

[data-bs-theme="light"] .text-muted {
  color: #64748b !important;
}

[data-bs-theme="light"] .form-label {
  color: #334155 !important;
}

[data-bs-theme="light"] .table-light,
[data-bs-theme="light"] .table-light > th,
[data-bs-theme="light"] .table-light > td {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] .table-light > th,
[data-bs-theme="dark"] .table-light > td {
  background-color: rgba(30, 41, 59, 0.5) !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-bs-theme="light"] .table-active,
[data-bs-theme="light"] .table-active > th,
[data-bs-theme="light"] .table-active > td {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

[data-bs-theme="dark"] .table-active,
[data-bs-theme="dark"] .table-active > th,
[data-bs-theme="dark"] .table-active > td {
  background-color: rgba(56, 189, 248, 0.08) !important;
  color: #e2e8f0 !important;
}

/* Alerts no Modo Claro */
[data-bs-theme="light"] .alert-info {
  background-color: #f0f9ff !important;
  border-color: #bae6fd !important;
  color: #0369a1 !important;
}

[data-bs-theme="light"] .alert-warning {
  background-color: #fefce8 !important;
  border-color: #fef08a !important;
  color: #854d0e !important;
}

[data-bs-theme="light"] .alert-danger {
  background-color: #fef2f2 !important;
  border-color: #fecaca !important;
  color: #991b1b !important;
}

[data-bs-theme="light"] .alert-success {
  background-color: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
  color: #166534 !important;
}

/* =========================================================================
   EXECUTIVE HERO SECTION (COCKPIT DE COMANDO)
   ========================================================================= */
.executive-hero-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.75) 0%, rgba(10, 15, 29, 0.85) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 1.5rem 1.85rem;
  box-shadow: var(--shadow-sm), var(--glass-highlight);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.executive-hero-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 420px;
  height: 100%;
  background: radial-gradient(circle at 100% 0%, rgba(14, 165, 233, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

[data-bs-theme="light"] .executive-hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03) !important;
}

[data-bs-theme="light"] .executive-hero-card::after {
  background: radial-gradient(circle at 100% 0%, rgba(2, 132, 199, 0.08) 0%, transparent 70%) !important;
}

.status-indicator-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #34d399;
}

[data-bs-theme="light"] .status-indicator-badge {
  background: #ecfdf5 !important;
  border: 1px solid #a7f3d0 !important;
  color: #047857 !important;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.hero-main-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

[data-bs-theme="light"] .hero-main-title {
  color: #0f172a !important;
}

.hero-description {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 720px;
}

[data-bs-theme="light"] .hero-description {
  color: #475569 !important;
}

.btn-hero-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 1.15rem;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
}

.btn-hero-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.45);
}

.hero-cta-badge {
  background-color: #ef4444;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  margin-left: 0.4rem;
}

.btn-hero-outline {
  background: rgba(15, 23, 42, 0.5);
  color: var(--text-secondary) !important;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.btn-hero-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary) !important;
  border-color: rgba(255, 255, 255, 0.2);
}

[data-bs-theme="light"] .btn-hero-outline {
  background: #ffffff !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

[data-bs-theme="light"] .btn-hero-outline:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}

/* =========================================================================
   KPI CARDS V2 (SOPHISTICATED, NO WATERMARK, NO NEON TOP LINE)
   ========================================================================= */
.kpi-card-v2 {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-sm), var(--glass-highlight);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.kpi-card-v2:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: var(--shadow-md), 0 0 16px -4px rgba(14, 165, 233, 0.12);
}

[data-bs-theme="light"] .kpi-card-v2 {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03) !important;
}

[data-bs-theme="light"] .kpi-card-v2:hover {
  border-color: #0284c7 !important;
  box-shadow: 0 8px 24px -4px rgba(2, 132, 199, 0.16) !important;
}

.kpi-card-v2.risk-interactive {
  cursor: pointer;
}

.kpi-card-v2.risk-interactive:hover {
  border-color: rgba(239, 68, 68, 0.5) !important;
  box-shadow: 0 8px 24px -4px rgba(239, 68, 68, 0.2) !important;
}

.kpi-header-v2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.kpi-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.kpi-tag.risk {
  color: #f87171;
}

[data-bs-theme="light"] .kpi-tag {
  color: #475569 !important;
}

[data-bs-theme="light"] .kpi-tag.risk {
  color: #dc2626 !important;
}

.kpi-icon-pill {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.kpi-icon-pill.primary { background: rgba(14, 165, 233, 0.14); color: #38bdf8; }
.kpi-icon-pill.purple  { background: rgba(139, 92, 246, 0.14); color: #a78bfa; }
.kpi-icon-pill.teal    { background: rgba(20, 184, 166, 0.14); color: #2dd4bf; }
.kpi-icon-pill.danger  { background: rgba(239, 68, 68, 0.14); color: #f87171; }
.kpi-icon-pill.warning { background: rgba(245, 158, 11, 0.14); color: #fbbf24; }

[data-bs-theme="light"] .kpi-icon-pill.primary { background: #e0f2fe !important; color: #0284c7 !important; }
[data-bs-theme="light"] .kpi-icon-pill.purple  { background: #f3e8ff !important; color: #7c3aed !important; }
[data-bs-theme="light"] .kpi-icon-pill.teal    { background: #ccfbf1 !important; color: #0d9488 !important; }
[data-bs-theme="light"] .kpi-icon-pill.danger  { background: #fee2e2 !important; color: #dc2626 !important; }

.kpi-metric-wrap {
  margin-bottom: 0.75rem;
}

.kpi-metric-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

[data-bs-theme="light"] .kpi-metric-label {
  color: #475569 !important;
}

.kpi-value-v2 {
  font-size: 2.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.kpi-value-v2.danger {
  color: #ef4444 !important;
}

[data-bs-theme="light"] .kpi-value-v2 {
  color: #0f172a !important;
}

[data-bs-theme="light"] .kpi-value-v2.danger {
  color: #dc2626 !important;
}

.kpi-footer-v2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle);
}

[data-bs-theme="light"] .kpi-footer-v2 {
  border-top-color: #f1f5f9 !important;
}

.kpi-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
}

.kpi-pill.success { background: rgba(16, 185, 129, 0.14); color: #34d399; }
.kpi-pill.primary { background: rgba(14, 165, 233, 0.14); color: #38bdf8; }
.kpi-pill.teal    { background: rgba(20, 184, 166, 0.14); color: #2dd4bf; }
.kpi-pill.warning { background: rgba(245, 158, 11, 0.14); color: #fbbf24; }
.kpi-pill.danger  { background: rgba(239, 68, 68, 0.14); color: #f87171; }

[data-bs-theme="light"] .kpi-pill.success { background: #d1fae5 !important; color: #065f46 !important; }
[data-bs-theme="light"] .kpi-pill.primary { background: #e0f2fe !important; color: #0369a1 !important; }
[data-bs-theme="light"] .kpi-pill.teal    { background: #ccfbf1 !important; color: #0f766e !important; }
[data-bs-theme="light"] .kpi-pill.warning { background: #fef3c7 !important; color: #92400e !important; }
[data-bs-theme="light"] .kpi-pill.danger  { background: #fee2e2 !important; color: #991b1b !important; }

.kpi-pill-muted {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.2rem 0.35rem;
}

[data-bs-theme="light"] .kpi-pill-muted {
  color: #64748b !important;
}

.kpi-pill-subtle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 0.2rem 0.35rem;
}

[data-bs-theme="light"] .kpi-pill-subtle {
  color: #475569 !important;
}

/* Subtítulos de painéis e novos estilos de cabeçalho */
.panel-subtitle {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 0.15rem;
}

[data-bs-theme="light"] .panel-subtitle {
  color: #64748b !important;
}

/* Leaderboard Lists */
.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.leaderboard-list .list-group-item {
  border-radius: 8px !important;
  margin-bottom: 4px;
  padding: 0.65rem 0.85rem !important;
  border: 1px solid transparent !important;
  background-color: transparent !important;
  transition: all 0.2s ease;
}

.leaderboard-list .list-group-item:hover {
  background-color: var(--bg-hover) !important;
  border-color: var(--border-subtle) !important;
}

[data-bs-theme="light"] .leaderboard-list .list-group-item:hover {
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}

/* Topbar Breadcrumb */
.topbar-breadcrumb {
  font-size: 0.875rem;
}

.topbar-view-title {
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

[data-bs-theme="light"] .topbar-view-title {
  color: #0f172a !important;
}


/* HUD STATUS CHIP (DISTILLED) */
.hud-status-chip {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}
[data-bs-theme="light"] .hud-status-chip {
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}


/* =========================================================================
   MOBILE & VIEWPORT ADAPTATION (390px & 360px FOCUS) - IMPECCABLE ADAPT
   ========================================================================= */

/* 1. Global Viewport & Horizontal Overflow Prevention */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

.app-wrapper, .app-main, .app-content {
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
}

/* 2. Responsive Adaptation: Tablets and Mobile (<= 768px) */
@media (max-width: 768px) {
  .app-content {
    padding: 1rem 0.85rem !important;
  }

  .app-topbar {
    padding: 0 0.85rem !important;
  }

  /* Touch Target Enhancement */
  .btn, .dropdown-toggle {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .executive-hero-card {
    padding: 1.25rem 1rem !important;
  }

  .hero-main-title {
    font-size: 1.25rem !important;
  }

  .kpi-card-v2 {
    padding: 1.1rem 1rem !important;
  }

  .chart-container {
    height: 260px !important;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--card-radius);
  }

  /* Offcanvas Menu Touch Optimization */
  #sidebarOffcanvas {
    width: min(300px, 85vw) !important;
  }

  #sidebarOffcanvas .nav-link {
    min-height: 48px;
    padding: 0.75rem 1rem !important;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
  }
}

/* 3. Dedicated Narrow Mobile Adaptation (<= 480px: 390px iPhone & 360px Android) */
@media (max-width: 480px) {
  .app-content {
    padding: 0.75rem 0.65rem !important;
  }

  .app-topbar {
    padding: 0 0.65rem !important;
    height: auto !important;
    min-height: 58px;
  }

  /* Compact Topbar on Narrow Screens */
  .topbar-left {
    gap: 0.4rem !important;
  }

  .topbar-right {
    gap: 0.35rem !important;
  }

  #btnPeriodFilter {
    padding: 0.35rem 0.6rem !important;
    font-size: 0.78rem !important;
    min-height: 42px;
  }

  #btnPeriodFilter #periodFilterLabel {
    max-width: 95px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #themeToggleBtn {
    min-width: 42px;
    min-height: 42px;
    padding: 0.35rem 0.55rem !important;
  }

  /* Hero Section Stacking & Thumb Ergonomics */
  .executive-hero-card {
    padding: 1rem 0.85rem !important;
    border-radius: 12px !important;
  }

  .hud-status-chip {
    font-size: 0.72rem !important;
    padding: 0.25rem 0.6rem !important;
    gap: 0.35rem !important;
  }

  .hero-main-title {
    font-size: 1.15rem !important;
    line-height: 1.35 !important;
  }

  .hero-description {
    font-size: 0.8rem !important;
    line-height: 1.4 !important;
  }

  .hero-action-box {
    width: 100% !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    margin-top: 0.5rem;
  }

  .hero-action-box .btn {
    width: 100% !important;
    min-height: 46px !important; /* Full thumb-friendly touch area */
    justify-content: center !important;
    font-size: 0.875rem !important;
  }

  /* KPI Cards Narrow Mobile Optimization */
  .kpi-card-v2 {
    padding: 1rem 0.85rem !important;
    border-radius: 12px !important;
  }

  .kpi-value-v2 {
    font-size: 1.85rem !important;
    letter-spacing: -0.02em !important;
  }

  .kpi-footer-v2 {
    font-size: 0.72rem !important;
    gap: 0.25rem !important;
    flex-wrap: wrap !important;
  }

  /* Panel Headers & Tables */
  .panel-header {
    padding: 0.85rem 1rem !important;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.5rem;
  }

  .panel-title {
    font-size: 0.95rem !important;
  }

  .panel-subtitle {
    font-size: 0.75rem !important;
  }

  .chart-container {
    height: 240px !important;
  }

  .leaderboard-list .list-group-item {
    padding: 0.55rem 0.65rem !important;
    font-size: 0.8rem !important;
  }
}


/* =========================================================================
   FINAL POLISH & FINESSE (IMPECCABLE POLISH)
   ========================================================================= */

/* 1. Global Focus-Visible & Selection Polish */
:focus-visible {
  outline: 2px solid #0ea5e9 !important;
  outline-offset: 2px !important;
}

::selection {
  background: rgba(14, 165, 233, 0.35) !important;
  color: #f8fafc !important;
}

/* 2. Refined Primary CTA & Ghost Buttons */
.btn-hero-primary {
  background: #0ea5e9 !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 8px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  padding: 0.55rem 1.15rem !important;
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.3), 0 2px 6px rgba(2, 132, 199, 0.35) !important;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: inline-flex;
  align-items: center;
}

.btn-hero-primary:hover {
  background: #0284c7 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 0 24px rgba(14, 165, 233, 0.45), 0 4px 12px rgba(2, 132, 199, 0.45) !important;
}

.btn-hero-primary:active {
  transform: translateY(0) !important;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.25) !important;
}

.btn-hero-outline {
  background: rgba(15, 23, 42, 0.6) !important;
  color: #94a3b8 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  padding: 0.55rem 1rem !important;
  transition: all 0.18s ease !important;
  display: inline-flex;
  align-items: center;
}

.btn-hero-outline:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #f8fafc !important;
  border-color: rgba(14, 165, 233, 0.35) !important;
  transform: translateY(-1px) !important;
}

.btn-hero-outline:active {
  transform: translateY(0) !important;
}

[data-bs-theme="light"] .btn-hero-primary {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0369a1 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3) !important;
}

[data-bs-theme="light"] .btn-hero-primary:hover {
  background: #0369a1 !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4) !important;
}

[data-bs-theme="light"] .btn-hero-outline {
  background: #ffffff !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

[data-bs-theme="light"] .btn-hero-outline:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #0284c7 !important;
}

/* 3. Subtle Elevation on KPI Cards */
.kpi-card-v2 {
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.18s ease, box-shadow 0.18s ease !important;
}

.kpi-card-v2:hover {
  transform: translateY(-2px) !important;
  border-color: rgba(14, 165, 233, 0.35) !important;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.4), 0 0 16px -2px rgba(14, 165, 233, 0.12) !important;
}

.kpi-card-v2.risk-interactive:hover {
  border-color: rgba(239, 68, 68, 0.45) !important;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.4), 0 0 16px -2px rgba(239, 68, 68, 0.18) !important;
}

/* 4. Leaderboard Row Micro-Hover */
.leaderboard-list .list-group-item {
  border-radius: 6px !important;
  transition: background-color 0.15s ease, border-color 0.15s ease !important;
}

.leaderboard-list .list-group-item:hover {
  background-color: rgba(14, 165, 233, 0.05) !important;
  border-color: rgba(14, 165, 233, 0.15) !important;
}

[data-bs-theme="light"] .leaderboard-list .list-group-item:hover {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

/* =========================================================================
   LEAFLET MAP & POPUP CONTRAST ENHANCEMENT (AAA DARK/LIGHT)
   ========================================================================= */
.leaflet-control-attribution {
  display: none !important;
}

.leaflet-popup-content-wrapper {
  background: #0b1120 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 12px !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8) !important;
  backdrop-filter: blur(12px) !important;
}

.leaflet-popup-tip {
  background: #0b1120 !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  line-height: 1.45 !important;
  color: #f8fafc !important;
  font-family: var(--font-family) !important;
}

.geo-popup-title {
  color: #38bdf8 !important;
}

.geo-popup-count-line {
  color: #e2e8f0 !important;
}

.geo-popup-count {
  color: #ffffff !important;
  font-weight: 700 !important;
}

.geo-popup-label {
  color: #cbd5e1 !important;
}

.geo-popup-meta {
  color: #94a3b8 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.16) !important;
}

.geo-popup-metric {
  color: #cbd5e1 !important;
}

[data-bs-theme=light] .leaflet-popup-content-wrapper {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

[data-bs-theme=light] .leaflet-popup-tip {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
}

[data-bs-theme=light] .leaflet-popup-content {
  color: #0f172a !important;
}

[data-bs-theme=light] .geo-popup-title {
  color: #0284c7 !important;
}

[data-bs-theme=light] .geo-popup-count-line {
  color: #1e293b !important;
}

[data-bs-theme=light] .geo-popup-count {
  color: #0f172a !important;
}

[data-bs-theme=light] .geo-popup-label {
  color: #334155 !important;
}

[data-bs-theme=light] .geo-popup-meta {
  color: #64748b !important;
  border-top: 1px solid #e2e8f0 !important;
}

[data-bs-theme=light] .geo-popup-metric {
  color: #334155 !important;
}
