/* ==========================================================================
   STYLE SHEET - BOVINATEC BI & EXECUTIVE DASHBOARDS
   ========================================================================== */

/* 1. RESET & BASE */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-brand);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
}

/* Brand Helpers (Manual de Marca) */
.brand-red { color: var(--primary) !important; }
.brand-black { color: var(--text-primary) !important; }
.brand-marker {
  border-left: 4px solid var(--primary);
  padding-left: var(--space-3);
}
.brand-tagline-text {
  font-family: var(--font-brand);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
}

/* 2. APP SHELL LAYOUT */
#app {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* 3. SIDEBAR (Preto Profundo com Acentos Vermelhos) */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: transform var(--transition-normal);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header {
  height: 72px;
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Brand Lockup (Logo + Wordmark + Balanças) */
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-symbol-box {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 6px rgba(227, 6, 19, 0.4));
}

.brand-symbol-box svg {
  width: 100%;
  height: 100%;
}

.brand-text-col {
  display: flex;
  flex-direction: column;
}

.brand-wordmark-bovinatec {
  font-family: var(--font-brand);
  font-weight: 900;
  font-style: italic;
  font-size: 1.18rem;
  letter-spacing: 0.02em;
  color: var(--primary);
  line-height: 1;
}

.brand-submark-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.brand-submark-rule {
  flex: 1;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.25);
}

.brand-wordmark-balancas {
  font-family: var(--font-brand);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: white;
  line-height: 1;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-sidebar-muted);
  padding: var(--space-3) var(--space-3) var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 14px;
  color: var(--text-sidebar);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  opacity: 0.75;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.nav-item:hover {
  background-color: var(--bg-sidebar-hover);
  color: white;
}

.nav-item:hover svg {
  opacity: 1;
  color: var(--primary);
  transform: translateX(2px);
}

.nav-item.active {
  background-color: var(--primary);
  color: white;
  font-weight: 700;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.nav-item.active svg {
  opacity: 1;
  stroke-width: 2.3;
}

.sidebar-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: var(--text-xs);
  font-weight: 600;
  color: white;
}

.user-role-chip {
  font-size: 10px;
  color: var(--primary);
  font-weight: 600;
}

.btn-sidebar-icon {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-sidebar-icon:hover {
  background: var(--bg-surface-raised);
  color: var(--primary);
}

#btn-toggle-sidebar {
  display: none;
}

/* 4. MAIN WRAPPER & TOPBAR */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100vw - var(--sidebar-width));
}

.topbar {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Global Filter Controls Bar */
.filter-bar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-3) var(--space-6);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.filter-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}

.company-select {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.company-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.period-pill-group {
  display: flex;
  align-items: center;
  background: var(--bg-surface-raised);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.period-pill {
  border: none;
  background: none;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.period-pill:hover {
  color: var(--text-primary);
}

.period-pill.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.date-range-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-raised);
  padding: 5px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 5. CONTENT CONTAINER */
.content-container {
  padding: var(--space-6);
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* Page Headers */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.page-title-group h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.page-title-group p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* 6. STATS & KPI GRID */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--card-accent, var(--primary));
  border-radius: 4px 0 0 4px;
}

.kpi-card.emerald { --card-accent: var(--primary); }
.kpi-card.indigo { --card-accent: var(--secondary); }
.kpi-card.warning { --card-accent: var(--warning); }
.kpi-card.purple { --card-accent: var(--purple); }
.kpi-card.danger { --card-accent: var(--danger); }
.kpi-card.info { --card-accent: var(--info); }

.kpi-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

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

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

.kpi-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 4px;
}

.kpi-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.kpi-tag.positive {
  background: var(--success-light);
  color: var(--success);
}

.kpi-tag.negative {
  background: var(--danger-light);
  color: var(--danger);
}

.kpi-tag.neutral {
  background: var(--bg-surface-raised);
  color: var(--text-secondary);
}

.kpi-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: var(--space-3);
}

.kpi-icon-wrapper.emerald { background: var(--primary-light); color: var(--primary); }
.kpi-icon-wrapper.indigo { background: var(--secondary-light); color: var(--secondary); }
.kpi-icon-wrapper.warning { background: var(--warning-light); color: var(--warning); }
.kpi-icon-wrapper.purple { background: var(--purple-light); color: var(--purple); }
.kpi-icon-wrapper.danger { background: var(--danger-light); color: var(--danger); }
.kpi-icon-wrapper.info { background: var(--info-light); color: var(--info); }

/* 7. CHARTS & GRIDS */
.charts-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.charts-grid-3 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chart-title-group {
  display: flex;
  flex-direction: column;
}

.chart-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-subtitle {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.chart-canvas-container {
  position: relative;
  width: 100%;
  min-height: 280px;
  flex: 1;
}

/* 8. CARDS & TABLES */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--text-sm);
}

.data-table th {
  background: var(--bg-surface-raised);
  padding: 10px 16px;
  font-weight: 600;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

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

.data-table tbody tr:hover {
  background-color: var(--bg-surface-hover);
}

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

.text-right { text-align: right; }
.text-center { text-align: center; }

/* Badges & Chips */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-danger { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-border); }
.badge-info { background: var(--info-light); color: var(--info); border: 1px solid var(--info-border); }
.badge-purple { background: var(--purple-light); color: var(--purple); border: 1px solid var(--purple-border); }
.badge-neutral { background: var(--bg-surface-raised); color: var(--text-secondary); border: 1px solid var(--border-medium); }

/* Status Dot */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-light);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--success);
  box-shadow: 0 0 0 2px var(--success-light);
}

/* 9. BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

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

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-raised);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 5px 10px;
  font-size: var(--text-xs);
}

/* 10. SPINNER & LOADING */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-medium);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-4);
  gap: var(--space-3);
  color: var(--text-secondary);
}

/* 11. PROGRESS BARS / FUNNELS */
.funnel-item {
  margin-bottom: var(--space-3);
}

.funnel-header {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  font-weight: 600;
  margin-bottom: 4px;
}

.funnel-bar-bg {
  height: 10px;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.funnel-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* 12. TOAST NOTIFICATIONS */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-sidebar);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }

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

/* 13. RESPONSIVE BREAKPOINTS */
@media (max-width: 1024px) {
  .charts-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }

  #btn-toggle-sidebar {
    display: flex;
  }

  .main-wrapper {
    margin-left: 0;
    width: 100vw;
  }

  .charts-grid-2 {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    height: auto;
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .topbar-left {
    width: 100%;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .content-container {
    padding: var(--space-4);
  }
}

/* 14. PRINT STYLES */
@media print {
  .sidebar, .topbar, .filter-bar, .header-actions, #toast-container {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .card, .kpi-card, .chart-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    break-inside: avoid;
  }
}

/* 15. AUTH & LOGIN STYLES */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at 50% 20%, #FEF2F2, var(--bg-app) 70%);
  padding: var(--space-4);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.02);
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.auth-logo-box {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-lg);
  background: #0A0A0A;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-4);
  box-shadow: 0 8px 20px rgba(227, 6, 19, 0.35);
  border: 2px solid var(--primary);
}

.auth-title-bovinatec {
  font-family: var(--font-brand);
  font-size: 1.6rem;
  font-weight: 900;
  font-style: italic;
  color: var(--primary);
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.auth-title-balancas {
  font-family: var(--font-brand);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--text-primary);
  margin-top: 2px;
}

.auth-tagline {
  font-family: var(--font-brand);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.form-group {
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-sidebar-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  color: hsl(352, 85%, 65%);
}

/* ==========================================================================
   PERSONAS ENHANCEMENTS: RICARDO (DONO) & CAMILA (GERENTE)
   ========================================================================== */

/* 1. Interactive KPI Cards (Drill-Down Cues) */
.kpi-card.interactive {
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.kpi-card.interactive:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.04);
}

.kpi-card.interactive.emerald:hover { border-color: hsla(158, 64%, 40%, 0.4); }
.kpi-card.interactive.indigo:hover { border-color: hsla(224, 76%, 48%, 0.4); }
.kpi-card.interactive.purple:hover { border-color: hsla(265, 75%, 58%, 0.4); }
.kpi-card.interactive.warning:hover { border-color: hsla(36, 95%, 48%, 0.4); }

.kpi-drilldown-hint {
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  margin-top: 4px;
  opacity: 0.9;
  transition: transform var(--transition-fast);
}

.kpi-card.interactive:hover .kpi-drilldown-hint {
  transform: translateX(3px);
}

/* 2. Trend Badges (% Comparativo Automático) */
.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  line-height: 1.2;
}

.trend-badge.positive {
  background: hsla(158, 64%, 40%, 0.12);
  color: hsl(158, 70%, 32%);
}

.trend-badge.negative {
  background: hsla(352, 85%, 54%, 0.12);
  color: hsl(352, 85%, 46%);
}

.trend-badge.neutral {
  background: hsla(215, 16%, 47%, 0.1);
  color: var(--text-secondary);
}

/* 3. Quick Health Summary Banner (Ricardo 10-Second Check) */
.quick-health-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.health-pill-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.health-pill-card:hover {
  border-color: var(--border-medium);
}

.health-pill-info {
  display: flex;
  flex-direction: column;
}

.health-pill-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.health-pill-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.health-pill-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

/* 4. Live Synchronization Pill */
.sync-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: hsla(158, 64%, 40%, 0.1);
  border: 1px solid hsla(158, 64%, 40%, 0.25);
  color: hsl(158, 70%, 32%);
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.sync-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 0 2px hsla(158, 64%, 40%, 0.3);
  animation: pulseSync 2.5s infinite;
}

@keyframes pulseSync {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 8px var(--success); }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* 5. Mobile Bottom Navigation Bar (Ricardo on Smartphone) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-medium);
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  flex: 1;
  text-align: center;
}

.mobile-nav-btn svg {
  width: 20px;
  height: 20px;
}

.mobile-nav-btn.active {
  color: var(--primary);
}

.mobile-nav-btn.active svg {
  stroke: var(--primary);
  stroke-width: 2.3;
}

/* Responsive adjustments for Mobile */
@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
  }
  
  .main-wrapper {
    padding-bottom: 74px; /* Space for bottom nav */
  }
  
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  
  .quick-health-banner {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  
  .header-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 8px;
  }
  
  .header-actions .btn {
    flex: 1;
    font-size: 0.75rem;
    padding: 8px 4px;
  }

  .kpi-value {
    font-size: 1.35rem;
  }

  .kpi-tag {
    font-size: 10px;
  }
}

/* ==========================================================================
   UX & CSS IMPROVEMENTS (Inspired by modern app guidelines)
   ========================================================================== */

/* 1. Skeleton Loading (Pulse) */
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.skeleton-box {
  background-color: var(--bg-surface-hover);
  border-radius: var(--radius-md);
  color: transparent !important;
  pointer-events: none;
  min-height: 1lh;
}
.skeleton-box * {
  visibility: hidden;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 2. Modern Spinner (.loader) */
.loader {
  border: 3px solid var(--border-light);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 3. Colorized Shadows (Glow Effects) */
.shadow-primary {
  box-shadow: 0 4px 14px var(--primary-glow, rgba(227, 6, 19, 0.25));
}

.shadow-success {
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.2);
}

.shadow-warning {
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.2);
}

/* 4. Subtle Gradients */
.bg-gradient-primary {
  background: linear-gradient(135deg, var(--primary), #b3000b);
  color: #ffffff;
}

.bg-gradient-card {
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-surface-raised));
}
