/* ════════════════════════════════════════════════════════════════════════════
   DURAND ANTISPAM FILTER — DESIGN SYSTEM CORPORATIVO
   Padrão Visual Unificado: support-intelligence • libre-percentil • cloud-portal
   Tema Padrão: Light Mode | Suporte Nativo: Dark Mode via [data-theme="dark"]
   ════════════════════════════════════════════════════════════════════════════ */

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

:root {
  /* ── Tipografia & Métricas ── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sidebar-w: 256px;
  --sidebar-collapsed-w: 72px;
  --header-h: 64px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ── Tema Light (PADRÃO CORPORATIVO DURAND) ── */
  --bg-canvas: #f1f5f9;                 /* Canvas cinza-claro */
  --bg-card: #ffffff;                   /* Cards, tabelas e modais */
  --bg-header: #ffffff;                 /* Sticky top header */
  --bg-sidebar: #0B1120;                /* Deep Navy Durand assinatura */
  --sidebar-text: #94a3b8;              /* Texto inativo da sidebar */
  --sidebar-text-hover: #e2e8f0;        /* Hover na sidebar */
  --sidebar-active-bg: rgba(59, 130, 246, 0.15); /* Item ativo */
  --sidebar-active-text: #60a5fa;
  --sidebar-border: rgba(255, 255, 255, 0.08);

  /* Textos Principais */
  --text-primary: #0f172a;              /* Slate 900 (alto contraste) */
  --text-secondary: #64748b;            /* Slate 500 (subtítulos) */
  --text-muted: #94a3b8;                /* Slate 400 (metadados) */

  /* Bordas e Sombras */
  --border: #e2e8f0;                    /* Bordas de cards e divisores */
  --border-subtle: #f8fafc;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-card: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Cores Semânticas de Ação */
  --primary: #3b82f6;                   /* Azul corporativo Durand */
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.1);
  --success: #22c55e;                   /* Verde (PASS / Ativo) */
  --success-bg: rgba(34, 197, 94, 0.1);
  --success-text: #16a34a;
  --warning: #f59e0b;                   /* Âmbar (QUARANTINE / Alerta) */
  --warning-bg: rgba(245, 158, 11, 0.1);
  --warning-text: #d97706;
  --danger: #ef4444;                    /* Vermelho (REJECT / Drop / Erro) */
  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-text: #dc2626;
  --info: #06b6d4;                      /* Ciano (LEARNING / Forense) */
  --info-bg: rgba(6, 182, 212, 0.1);
  --info-text: #0891b2;

  /* Padrão Global de Inputs (Light) */
  --input-bg: #ffffff;
  --input-text: #111827;
  --input-placeholder: #6b7280;
  --input-border: #d1d5db;
  --input-focus: #3b82f6;
  --input-focus-ring: rgba(59, 130, 246, 0.25);
}

/* ── Tema Dark ([data-theme="dark"]) ── */
[data-theme="dark"] {
  --bg-canvas: #0f172a;                 /* Slate 900 */
  --bg-card: #1e293b;                   /* Slate 800 */
  --bg-header: #1e293b;
  --bg-sidebar: #070d1a;                /* Slate 950 */
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #e2e8f0;
  --sidebar-active-bg: rgba(96, 165, 250, 0.15);
  --sidebar-active-text: #60a5fa;
  --sidebar-border: rgba(255, 255, 255, 0.06);

  --text-primary: #f1f5f9;              /* Slate 100 */
  --text-secondary: #94a3b8;            /* Slate 400 */
  --text-muted: #64748b;                /* Slate 500 */

  --border: #334155;                    /* Slate 700 */
  --border-subtle: #1e293b;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-card: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4);

  --primary: #60a5fa;
  --primary-hover: #3b82f6;
  --primary-light: rgba(96, 165, 250, 0.2);
  --success: #4ade80;
  --success-bg: rgba(34, 197, 94, 0.2);
  --success-text: #4ade80;
  --warning: #fbbf24;
  --warning-bg: rgba(245, 158, 11, 0.2);
  --warning-text: #fbbf24;
  --danger: #f87171;
  --danger-bg: rgba(239, 68, 68, 0.2);
  --danger-text: #f87171;
  --info: #22d3ee;
  --info-bg: rgba(6, 182, 212, 0.2);
  --info-text: #22d3ee;

  /* Padrão Global de Inputs (Dark) */
  --input-bg: #0f172a;
  --input-text: #f1f5f9;
  --input-placeholder: #64748b;
  --input-border: #334155;
  --input-focus: #60a5fa;
  --input-focus-ring: rgba(96, 165, 250, 0.25);
}

/* ── Base Reset & Global Styles ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition), color var(--transition);
}

/* ════════════════════════════════════════════════════════════════════════════
   1. LOGIN SPLIT-SCREEN (PADRÃO CORPORATIVO DURAND)
   ════════════════════════════════════════════════════════════════════════════ */

.login-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  position: relative;
  z-index: 100;
}

@media (min-width: 1024px) {
  .login-wrapper {
    grid-template-columns: 380px 1fr;
  }
}

@media (min-width: 1280px) {
  .login-wrapper {
    grid-template-columns: 440px 1fr;
  }
}

/* Coluna de Marca (Esquerda) */
.login-sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .login-sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
    background-color: #0B1120;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
  }
}

.sidebar-bg-decoration {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  pointer-events: none;
}

.blob-top {
  position: absolute;
  top: -20%;
  left: -20%;
  width: 80%;
  height: 50%;
  background-color: rgba(37, 99, 235, 0.25);
  filter: blur(100px);
  border-radius: 9999px;
}

.blob-bottom {
  position: absolute;
  bottom: -20%;
  right: -20%;
  width: 80%;
  height: 50%;
  background-color: rgba(30, 58, 138, 0.3);
  filter: blur(100px);
  border-radius: 9999px;
}

.login-sidebar-content {
  position: relative;
  z-index: 10;
}

.login-brand-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3.5rem;
}

.login-brand-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
  flex-shrink: 0;
}

.login-brand-icon svg {
  width: 28px;
  height: 28px;
}

.login-brand-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.login-brand-subtitle {
  font-size: 0.8rem;
  color: #60a5fa;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 2px;
}

.login-features-list {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.login-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.login-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.08);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.login-feature-icon svg {
  width: 18px;
  height: 18px;
}

.login-feature-text h3 {
  font-weight: 600;
  color: #f1f5f9;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.login-feature-text p {
  font-size: 0.825rem;
  color: #94a3b8;
  line-height: 1.4;
}

.login-sidebar-footer {
  position: relative;
  z-index: 10;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Área de Formulário (Direita) */
.login-main {
  background-color: var(--bg-canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  position: relative;
  min-height: 100vh;
  overflow-y: auto;
}

.login-top-actions {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  animation: durandSlideUp 250ms ease;
}

.login-header {
  margin-bottom: 2rem;
  text-align: left;
}

.login-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.login-header p.subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.login-error-banner {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger-text);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   2. FORM CONTROLS & INPUT STANDARDS (CLOUD-PORTAL / DURAND GLOBAL)
   ════════════════════════════════════════════════════════════════════════════ */

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input-field,
.custom-select {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  background-color: var(--input-bg);
  color: var(--input-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  font-family: inherit;
}

.input-field::placeholder {
  color: var(--input-placeholder);
}

.input-field:focus,
.custom-select:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}

/* ════════════════════════════════════════════════════════════════════════════
   3. BUTTONS (RITUAL DE AÇÕES DURAND)
   ════════════════════════════════════════════════════════════════════════════ */

.btn,
.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.2;
  font-family: inherit;
  box-sizing: border-box;
}

.btn svg,
.btn-primary svg,
.btn-secondary svg,
.btn-danger svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: var(--border-subtle);
  border-color: var(--text-muted);
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ════════════════════════════════════════════════════════════════════════════
   4. APPLICATION SHELL & LAYOUT (SIDEBAR + TOP HEADER + CONTENT)
   ════════════════════════════════════════════════════════════════════════════ */

.app-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-canvas);
}

/* Sidebar Fixa Deep Navy */
.sidebar {
  width: var(--sidebar-w);
  background-color: var(--bg-sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: transform var(--transition);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}

.sidebar-logo {
  height: var(--header-h);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.875rem;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.sidebar-logo-icon svg {
  width: 20px;
  height: 20px;
}

.sidebar-logo-text {
  font-weight: 700;
  font-size: 1.05rem;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.sidebar-logo-text span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.65rem 0.875rem;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  user-select: none;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text-hover);
}

.nav-item.active {
  background-color: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left-color: var(--primary);
  font-weight: 600;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background-color: var(--danger);
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  line-height: 1.2;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #64748b;
}

.sidebar-footer-info {
  display: flex;
  flex-direction: column;
}

.sidebar-footer-host {
  color: #94a3b8;
  font-weight: 600;
}

.app-version-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.3);
  letter-spacing: 0.04em;
  text-transform: none;
  vertical-align: middle;
}

[data-theme="light"] .app-version-badge {
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.22);
}

.sidebar-version-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-top: 0.5rem;
  margin-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  color: #64748b;
}

/* Área Principal (Main Canvas) */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}

/* Sticky Top Header */
.top-header {
  height: var(--header-h);
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition), border-color var(--transition);
}

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

.header-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.header-breadcrumbs .crumb-active {
  font-weight: 600;
  color: var(--text-primary);
}

.header-breadcrumbs .crumb-sep {
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Daemon Status Telemetry Pills */
.daemon-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.daemon-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--bg-canvas);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.daemon-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success);
}

.daemon-dot.warn {
  background-color: var(--warning);
}

.daemon-dot.err {
  background-color: var(--danger);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.theme-toggle-btn:hover {
  background-color: var(--border-subtle);
  border-color: var(--primary);
  color: var(--primary);
}

.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
}

/* Language Switcher */
.lang-selector {
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

/* Operator Badge & Logout */
.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-logout {
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: all var(--transition);
}

.btn-logout:hover {
  background-color: var(--danger-bg);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--danger-text);
}

.btn-logout svg {
  width: 14px;
  height: 14px;
}

/* Content Canvas */
.content-canvas {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

/* ════════════════════════════════════════════════════════════════════════════
   5. STATS GRID & METRIC CARDS
   ════════════════════════════════════════════════════════════════════════════ */

.stat-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1200px) {
  .stat-grid, .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .stat-grid, .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 120px;
  transition: box-shadow var(--transition), transform var(--transition);
  box-sizing: border-box;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

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

.stat-header .stat-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 22px;
  height: 22px;
}

.stat-icon.blue   { background-color: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background-color: var(--success-bg);    color: var(--success); }
.stat-icon.amber  { background-color: var(--warning-bg);    color: var(--warning); }
.stat-icon.cyan   { background-color: var(--info-bg);       color: var(--info); }
.stat-icon.rose   { background-color: var(--danger-bg);     color: var(--danger); }

.stat-details {
  flex: 1;
}

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

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin: 0.25rem 0;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.stat-subtext,
.stat-footer {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════════════════════════
   6. APP CARDS & TOOLBARS
   ════════════════════════════════════════════════════════════════════════════ */

.glass-card,
.app-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: background-color var(--transition), border-color var(--transition);
  box-sizing: border-box;
}

[data-theme="dark"] .glass-card {
  background-color: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: rgba(255, 255, 255, 0.08);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.filter-bar .input-field,
.filter-bar .custom-select {
  flex: 1 1 180px;
  min-width: 150px;
}

.filter-bar .btn,
.filter-bar .btn-primary,
.filter-bar button {
  flex: 0 0 auto;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.card-desc {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   7. TECHNICAL TABLES & STATUS BADGES
   ════════════════════════════════════════════════════════════════════════════ */

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background-color: var(--bg-canvas);
  border-bottom: 2px solid var(--border);
}

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

.data-table tr:hover td {
  background-color: var(--primary-light);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* Badges em Pílula (Rounded-Full) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.badge-pass {
  background-color: var(--success-bg);
  color: var(--success-text);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-quarantine {
  background-color: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-reject {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-learning {
  background-color: var(--info-bg);
  color: var(--info-text);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-info {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ════════════════════════════════════════════════════════════════════════════
   8. TOAST NOTIFICATION SYSTEM (ANTI-ALERT)
   ════════════════════════════════════════════════════════════════════════════ */

.durand-toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.durand-toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 440px;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-lg);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  animation: durandSlideIn 200ms ease;
  transition: opacity 200ms ease, transform 200ms ease;
}

.durand-toast.toast-success { background-color: #16a34a; }
.durand-toast.toast-error   { background-color: #dc2626; }
.durand-toast.toast-warning { background-color: #d97706; }
.durand-toast.toast-info    { background-color: #2563eb; }

.durand-toast.fade-out {
  opacity: 0;
  transform: translateX(30px);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-icon svg {
  width: 100%;
  height: 100%;
}

/* ════════════════════════════════════════════════════════════════════════════
   9. HIGH-FIDELITY MODALS (ANTI-CONFIRM & DETALHES FORENSES)
   ════════════════════════════════════════════════════════════════════════════ */

.modal-overlay,
.modal-backdrop-durand {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background-color: rgba(11, 17, 32, 0.75) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999 !important;
  padding: 1.5rem;
  overflow-y: auto;
  box-sizing: border-box;
  animation: durandFadeIn 150ms ease;
}

.modal-overlay.active,
.modal-overlay.show,
.modal-backdrop-durand.active {
  display: flex !important;
}

.modal-content,
.modal-box-durand {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: durandSlideUp 200ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  padding: 1.75rem;
  gap: 1.25rem;
  position: relative;
  color: var(--text-primary);
  box-sizing: border-box;
}

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

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-icon-badge.badge-danger {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.modal-icon-badge.badge-primary {
  background-color: var(--primary-light);
  color: var(--primary);
}

.modal-icon-badge svg {
  width: 20px;
  height: 20px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin: 0;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

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

.modal-close-btn svg {
  width: 20px;
  height: 20px;
}

.modal-body,
.modal-body-durand {
  flex: 1;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.modal-body-durand.text-center {
  text-align: center;
}

.modal-desc {
  font-size: 0.925rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-footer,
.modal-footer-durand {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   10. TAB NAVIGATION & RESPONSIVE RULES
   ════════════════════════════════════════════════════════════════════════════ */

.tab-pane,
.tab-content {
  width: 100%;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Animações */
@keyframes durandFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes durandSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes durandSlideIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: durandSpin 0.6s linear infinite;
}

/* Mobile Responsiveness */
@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }
}
