/* ═══════════════════════════════════════
   MELIFLUX — Design System
   Tema escuro por padrão
   ═══════════════════════════════════════ */

/* === CSS Variables === */
:root {
  /* Module colors */
  --nubi-market: #cd4df7;
  --nubi-competition: #1ebcef;
  --nubi-business: #9dc85f;
  --nubi-academia: #6764ac;
  --nubi-opportunity: #d700d7;

  /* Brand / Action */
  --nubi-blue: #3da9fe;
  --nubi-blue-hover: #218ade;
  --nubi-violet: #b55df4;
  --nubi-violet-hover: #a840f4;
  --nubi-follow: #725eff;
  --nubi-purple-deep: #9051a4;

  /* Semantic */
  --nubi-positive: #8cc63f;
  --nubi-caution: #ffd300;
  --nubi-alert: #fbb03b;
  --nubi-negative: #ff4800;

  /* Scoring gauge */
  --score-very-low: #FF1400;
  --score-low: #FF6539;
  --score-medium: #FF9D00;
  --score-high: #71EB00;
  --score-very-high: #00B374;

  /* Ranking variation */
  --rank-up: #00B73D;
  --rank-down: #FF0303;

  /* Chart */
  --chart-primary: #8cc640;
  --chart-secondary: #2EC7F0;
  --chart-gray: #AFAFAF;

  /* Dark theme (default) */
  --body-bg: #131b26;
  --card-bg: #1e2530;
  --card-hover: #252E3D;
  --header-bg: #1e2530;
  --submenu-bg: #212836;
  --text-primary: #ffffff;
  --text-body: #7b89a8;
  --text-secondary: #677890;
  --text-caption: #5c6673;
  --border-color: #252e3d;
  --shadow: 2px 2px 8px #232426;
  --spinner-color: #66768E;
  --filter-btn-bg: #3a4354;
  --sidebar-bg: #171f2b;
  --sidebar-active: #1e2a38;
  --input-bg: #252e3d;

  /* Typography */
  --font-heading: 'Montserrat', sans-serif;
  --font-body: 'Roboto', sans-serif;

  /* Layout */
  --sidebar-width: 220px;
  --sidebar-minified: 70px;
  --header-height: 50px;
  --submenu-height: 40px;
}

/* === Tema claro (alternativo) === */
body.template-light {
  --body-bg: #f0f0f5;
  --card-bg: #ffffff;
  --card-hover: #f8f9fa;
  --header-bg: #ffffff;
  --submenu-bg: #f8f8fc;
  --text-primary: #2d2d2d;
  --text-body: #555555;
  --text-secondary: #888888;
  --text-caption: #aaaaaa;
  --border-color: #e8e8ee;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --spinner-color: #bbbbbb;
  --filter-btn-bg: #e0e0e0;
  --sidebar-bg: #ffffff;
  --sidebar-active: #f3f3f8;
  --input-bg: #f5f5fa;
}

body.template-light #nubi-sidebar {
  border-right-color: #e8e8ee;
  box-shadow: 1px 0 3px rgba(0,0,0,0.03);
}

body.template-light #nubi-header {
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

body.template-light .nubi-card {
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

body.template-light .nubi-table th {
  background: #f5f5fa;
}

body.template-light .score-circle {
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-body);
  background: var(--body-bg);
  overflow-x: hidden;
}

a { color: var(--nubi-blue); text-decoration: none; }
a:hover { color: var(--nubi-blue-hover); }

/* === Layout === */
#nubi-app {
  display: flex;
  height: 100vh;
}

/* === Sidebar === */
#nubi-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, color-mix(in srgb, var(--sidebar-bg), var(--body-bg) 30%) 100%);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  transition: width 0.3s ease;
}

#nubi-sidebar.minified {
  width: var(--sidebar-minified);
}

#nubi-sidebar.minified .logo-text,
#nubi-sidebar.minified .menu-label,
#nubi-sidebar.minified .menu-arrow,
#nubi-sidebar.minified .menu-items { display: none; }

.nubi-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--nubi-violet), var(--nubi-blue));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
  font-family: var(--font-heading);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  flex-shrink: 0;
}

.logo-icon:hover {
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(181,93,244,0.4);
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Menu */
#nubi-menu { padding: 10px 0; flex: 1; }

.menu-section { margin-bottom: 5px; }

.menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}

.menu-header:hover { background: var(--sidebar-active); }

.menu-icon { font-size: 16px; }

.menu-label {
  flex: 1;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.menu-arrow {
  color: var(--text-caption);
  font-size: 12px;
  transition: transform 0.2s;
}

.menu-section.open .menu-arrow { transform: rotate(90deg); }

/* Module accent colors */
.menu-business .menu-label { color: var(--nubi-business); }
.menu-market .menu-label { color: var(--nubi-market); }
.menu-competition .menu-label { color: var(--nubi-competition); }

.menu-items {
  display: none;
  padding: 0 0 5px 0;
}

.menu-section.open .menu-items { display: block; }

.menu-item {
  display: block;
  padding: 8px 15px 8px 42px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.menu-item:hover {
  color: var(--text-primary);
  background: var(--sidebar-active);
  padding-left: 44px;
}

.menu-item .mi {
  display: inline-block;
  width: 16px;
  font-size: 10px;
  color: var(--text-caption);
  margin-right: 4px;
}

.menu-item.active .mi {
  color: var(--text-primary);
}

/* Destaque para recursos exclusivos Meliflux — amarelo forte */
.menu-item.exclusive {
  color: #ffd300 !important;
  font-weight: 600;
}

.menu-item.exclusive:hover {
  color: #ffe44d !important;
}

.menu-item.exclusive .mi {
  color: #ffd300;
}

.menu-item.active {
  color: var(--text-primary);
  background: var(--sidebar-active);
  border-left: 3px solid var(--nubi-business);
  padding-left: 39px;
}

/* Active color by module */
.menu-section:nth-child(2) .menu-item.active { border-left-color: var(--nubi-market); }
.menu-section:nth-child(3) .menu-item.active { border-left-color: var(--nubi-competition); }

/* === Main Content === */
#nubi-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* === Header === */
#nubi-header {
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.header-btn:hover { background: var(--card-hover); }

.nubi-search {
  position: relative;
}

.nubi-search input {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 7px 12px 7px 30px;
  border-radius: 4px;
  font-size: 13px;
  width: 300px;
  outline: none;
  transition: border-color 0.2s;
}

.nubi-search input:focus { border-color: var(--nubi-blue); }
.nubi-search input::placeholder { color: var(--text-caption); }

.header-account {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

/* === SubMenu === */
#nubi-submenu {
  height: var(--submenu-height);
  background: var(--submenu-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  flex-shrink: 0;
}

.nubi-breadcrumb {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bc-module { color: var(--text-caption); }
.bc-sep { color: var(--text-caption); }
.bc-page { color: var(--text-primary); font-weight: 500; }

.submenu-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-picker-container input {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  width: 200px;
  cursor: pointer;
}

/* === Content Area === */
#nubi-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 15px;
}

#page-container { min-height: 400px; }

/* === Components === */

/* Cards — glassmorphism sutil 2026 */
.nubi-card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 15px;
  min-height: 100px;
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
  border: 1px solid rgba(255,255,255,0.04);
  backdrop-filter: blur(2px);
}

.nubi-card:hover {
  background: var(--card-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.nubi-card.no-hover:hover {
  background: var(--card-bg);
  transform: none;
  box-shadow: var(--shadow);
}

/* KPI Indicator */
.nubi-indicator {
  text-align: center;
  padding: 10px;
}

.nubi-indicator .ind-label {
  font-size: 13px;
  color: var(--text-caption);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.nubi-indicator .ind-value {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 2px;
  cursor: pointer;
  user-select: none;
}

.nubi-indicator .ind-value:active {
  transform: scale(0.97);
}

/* KPI card top border accent */
.nubi-card.nubi-indicator {
  border-top: 2px solid transparent;
  position: relative;
}

.nubi-card.nubi-indicator:hover {
  border-top-color: var(--nubi-blue);
}

.nubi-indicator .ind-variation {
  font-size: 12px;
  margin-top: 3px;
}

.ind-variation.positive { color: var(--nubi-positive); }
.ind-variation.negative { color: var(--nubi-negative); }
.ind-variation.neutral { color: var(--text-caption); }

/* Buttons */
.nubi-btn-blue {
  background: var(--nubi-blue);
  color: white;
  border: none;
  padding: 7px 16px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.nubi-btn-blue:hover { background: var(--nubi-blue-hover); }

.nubi-btn-violet {
  background: var(--nubi-violet);
  color: white;
  border: none;
  padding: 7px 16px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
}

.nubi-btn-violet:hover { background: var(--nubi-violet-hover); }

.nubi-btn-outlined {
  background: transparent;
  color: var(--nubi-blue);
  border: 1px solid var(--nubi-blue);
  padding: 5px 14px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.nubi-btn-outlined:hover { background: var(--nubi-blue); color: white; }

/* Tables */
.nubi-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.nubi-table th {
  background: var(--submenu-bg);
  color: var(--text-caption);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
}

.nubi-table th:hover { color: var(--text-primary); }
.nubi-table th.sorted { color: var(--nubi-blue); }

.nubi-table td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-body);
}

.nubi-table tbody tr:hover { background: var(--card-hover); }

/* Tabs */
.nubi-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 15px;
}

.nubi-tab {
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.nubi-tab:hover { color: var(--text-primary); }
.nubi-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--nubi-positive);
}

/* Badges */
.nubi-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.nubi-badge.positive { background: rgba(140,198,63,0.15); color: var(--nubi-positive); }
.nubi-badge.negative { background: rgba(255,72,0,0.15); color: var(--nubi-negative); }
.nubi-badge.caution { background: rgba(255,211,0,0.15); color: var(--nubi-caution); }
.nubi-badge.info { background: rgba(61,169,254,0.15); color: var(--nubi-blue); }

/* Score circles */
.score-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
}

/* Spinner */
.nubi-spinner {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 40px;
}

.nubi-spinner.active { display: flex; }

.nubi-spinner .bar {
  width: 4px;
  height: 20px;
  background: var(--spinner-color);
  border-radius: 2px;
  animation: spinner-pulse 1.2s ease-in-out infinite;
}

.nubi-spinner .bar:nth-child(1) { animation-delay: 0s; }
.nubi-spinner .bar:nth-child(2) { animation-delay: 0.1s; }
.nubi-spinner .bar:nth-child(3) { animation-delay: 0.2s; }
.nubi-spinner .bar:nth-child(4) { animation-delay: 0.3s; }
.nubi-spinner .bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes spinner-pulse {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* Grid helpers */
.nubi-grid { display: grid; gap: 15px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }
.grid-4-8 { grid-template-columns: 4fr 8fr; }

/* Typography */
.nubi-h1 { font-family: var(--font-heading); font-size: 30px; color: var(--text-primary); }
.nubi-h2 { font-family: var(--font-heading); font-size: 25px; color: var(--text-primary); }
.nubi-h3 { font-family: var(--font-heading); font-size: 20px; color: var(--text-primary); }
.nubi-title { font-family: var(--font-heading); font-size: 20px; color: var(--text-primary); }
.nubi-subtitle { font-family: var(--font-heading); font-size: 16px; color: var(--text-primary); }
.nubi-body { font-size: 14px; }
.nubi-caption { font-size: 12px; color: var(--text-caption); }
.nubi-reference { font-size: 11px; color: var(--text-caption); }

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.page-header h2 .nubi-badge {
  vertical-align: middle;
  margin-left: 8px;
}

/* Chart container */
.chart-container {
  position: relative;
  width: 100%;
  height: 300px;
}

/* Pagination */
.nubi-pagination {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
  margin-top: 15px;
}

.nubi-pagination button {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
}

.nubi-pagination button.active {
  background: var(--nubi-blue);
  color: white;
  border-color: var(--nubi-blue);
}

/* Tooltip */
.nubi-tooltip {
  position: absolute;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: 5px;
  box-shadow: var(--shadow);
  font-size: 12px;
  z-index: 1000;
  pointer-events: none;
}

/* Empty state */
.nubi-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-caption);
}

.nubi-empty h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

/* === Extra badge colors === */
.nubi-badge.badge-green { background: rgba(140,198,63,0.15); color: #8cc63f; }
.nubi-badge.badge-red { background: rgba(255,72,0,0.15); color: #ff4800; }
.nubi-badge.badge-yellow { background: rgba(255,211,0,0.15); color: #ffd300; }
.nubi-badge.badge-blue { background: rgba(61,169,254,0.15); color: #3da9fe; }
.nubi-badge.badge-gray { background: rgba(100,100,100,0.15); color: #999; }

/* === Transitions === */
.nubi-card, .menu-item, .nubi-tab, .header-btn, .nubi-btn-blue, .nubi-btn-violet, .nubi-btn-outlined {
  transition: all 0.2s ease;
}

/* === Page loading fade-in === */
#page-container {
  animation: fadeIn 0.3s ease;
}

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

/* === KPI value animation === */
.ind-value {
  transition: color 0.3s ease;
}

/* === Table row hover highlight === */
.nubi-table tbody tr {
  transition: background 0.15s ease;
}

/* === Scrollbar styling === */
#nubi-content::-webkit-scrollbar { width: 6px; }
#nubi-content::-webkit-scrollbar-track { background: var(--body-bg); }
#nubi-content::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
#nubi-content::-webkit-scrollbar-thumb:hover { background: var(--text-caption); }

#nubi-sidebar::-webkit-scrollbar { width: 4px; }
#nubi-sidebar::-webkit-scrollbar-track { background: transparent; }
#nubi-sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* === Sidebar active indicator glow === */
.menu-item.active {
  position: relative;
}

/* === Input focus glow === */
input:focus, select:focus {
  outline: none;
  border-color: var(--nubi-blue);
  box-shadow: 0 0 0 2px rgba(61,169,254,0.15);
}

/* === Button hover effects === */
.nubi-btn-blue:active, .nubi-btn-violet:active {
  transform: scale(0.97);
}

.nubi-pagination button:hover {
  background: var(--card-hover);
  color: var(--text-primary);
}

/* === Modal overlay === */
#comp-modal {
  animation: fadeIn 0.2s ease;
}

/* === Score circle pulse on high === */
.score-circle {
  transition: transform 0.2s ease;
  cursor: help;
}
.score-circle:hover {
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(255,255,255,0.2);
}

/* === Link styles === */
a.nubi-link {
  color: var(--nubi-blue);
  text-decoration: none;
  font-size: 12px;
}
a.nubi-link:hover {
  text-decoration: underline;
}

/* === Separator line === */
.nubi-separator {
  height: 1px;
  background: var(--border-color);
  margin: 15px 0;
}

/* === Highlight row === */
.nubi-table tbody tr.highlight {
  background: rgba(61,169,254,0.05);
  border-left: 3px solid var(--nubi-blue);
}

/* === Skeleton loading (shimmer effect) === */
.skeleton {
  background: linear-gradient(90deg, var(--card-bg) 25%, var(--card-hover) 37%, var(--card-bg) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: 4px;
  min-height: 10px;
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

body.template-light .skeleton {
  background: linear-gradient(90deg, #f0f0f5 25%, #e0e0e8 37%, #f0f0f5 63%);
  background-size: 400% 100%;
}

/* === Quick Actions Bar === */
.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.quick-action:hover {
  background: var(--card-hover);
  color: var(--text-primary);
  border-color: var(--nubi-blue);
}

.quick-action .qa-icon {
  font-size: 13px;
}

/* === Data freshness indicator === */
.freshness {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-caption);
}

.freshness .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nubi-positive);
  animation: pulse-dot 2s infinite;
}

/* === Number counter animation === */
@keyframes countUp {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.ind-value {
  animation: countUp 0.4s ease;
}

/* === Glassmorphism Overlay (for modals, tooltips) === */
.glass-overlay {
  background: rgba(var(--card-bg-rgb, 30,37,48), 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
}

/* === Premium hover effects === */
.nubi-card.nubi-indicator:hover .ind-value {
  color: var(--nubi-blue);
}

.nubi-table tbody tr:hover td:first-child {
  border-left: 2px solid var(--nubi-blue);
  padding-left: 10px;
}

/* === Focus ring === */
*:focus-visible {
  outline: 2px solid var(--nubi-blue);
  outline-offset: 2px;
}

/* === Smooth page transitions === */
#page-container {
  animation: pageSlide 0.3s ease;
}

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

/* === Highlight-on-hover (dim siblings) === */
.nubi-grid:hover > .nubi-card {
  opacity: 0.65;
  transition: opacity 0.2s ease;
}
.nubi-grid:hover > .nubi-card:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* === Data point pulse === */
@keyframes dataPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(140,198,64,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(140,198,64,0); }
}

.score-circle.pulse {
  animation: dataPulse 2s ease infinite;
}

/* === Table row number styling === */
.nubi-table tbody td:first-child {
  font-variant-numeric: tabular-nums;
}

/* === Zebra striping subtle === */
.nubi-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.01);
}

body.template-light .nubi-table tbody tr:nth-child(even) {
  background: rgba(0,0,0,0.015);
}

/* === Card group label === */
.card-group-label {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-caption);
  margin-bottom: 8px;
  padding-left: 2px;
}

/* === Metric comparison === */
.metric-compare {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.metric-compare .current { font-size: 22px; font-weight: 600; color: var(--text-primary); }
.metric-compare .vs { font-size: 12px; color: var(--text-caption); }
.metric-compare .previous { font-size: 14px; color: var(--text-secondary); text-decoration: line-through; }

/* === Improved button group === */
.btn-group {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.btn-group button {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  border-right: 1px solid var(--border-color);
}
.btn-group button:last-child { border-right: none; }
.btn-group button:hover { background: var(--card-hover); color: var(--text-primary); }
.btn-group button.active { background: var(--nubi-blue); color: white; }

/* === Notification dot === */
.notif-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--nubi-negative);
  border: 2px solid var(--header-bg);
}

/* === Progress bar smooth === */
.progress-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Divider with text === */
.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-caption);
  font-size: 11px;
  margin: 15px 0;
}
.divider-text::before, .divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* === Gradient text for headers === */
.nubi-gradient-text {
  background: linear-gradient(135deg, var(--nubi-business), var(--nubi-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === Subtle grid pattern background === */
#nubi-content {
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.015) 1px, transparent 0);
  background-size: 24px 24px;
}

body.template-light #nubi-content {
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.02) 1px, transparent 0);
}

/* === Card border glow on focus/active === */
.nubi-card:focus-within {
  border-color: rgba(61,169,254,0.3);
  box-shadow: 0 0 0 3px rgba(61,169,254,0.08);
}

/* === Improved badge styling === */
.nubi-badge {
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* === Better table header === */
.nubi-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* === Avatar ring === */
.header-account > div:first-child {
  box-shadow: 0 0 0 2px var(--border-color);
}

/* === Improved scrollbar for content === */
#nubi-content {
  scroll-behavior: smooth;
}

/* === Responsive === */

/* Tablet */
@media (max-width: 1200px) {
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .nubi-search input { width: 200px; }
}

/* Mobile */
@media (max-width: 768px) {
  #nubi-sidebar {
    position: fixed;
    left: -260px;
    z-index: 1000;
    height: 100vh;
    width: 260px;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    transition: left 0.3s ease;
  }
  #nubi-sidebar.mobile-open { left: 0; }

  /* Overlay quando sidebar aberta */
  #nubi-sidebar.mobile-open::after {
    content: '';
    position: fixed;
    top: 0;
    left: 260px;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: -1;
  }

  #nubi-main { width: 100%; }

  .nubi-search input { width: 120px; font-size: 12px; }
  .nubi-search svg { display: none; }

  .header-account span { display: none; }
  .nubi-caption.hide-mobile { display: none; }
  #nubi-submenu { flex-wrap: wrap; height: auto; padding: 8px 10px; gap: 5px; }
  .submenu-actions { width: 100%; justify-content: space-between; }
  .date-picker-container input { width: 130px; }

  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: 1fr 1fr; }
  .grid-4-8 { grid-template-columns: 1fr; }

  #nubi-content { padding: 10px; }

  .page-header { flex-direction: column; align-items: flex-start; gap: 5px; }
  .page-header h2 { font-size: 18px; }

  .nubi-table { font-size: 11px; }
  .nubi-table th, .nubi-table td { padding: 6px 8px; }

  .nubi-indicator .ind-value { font-size: 18px; }
}

/* Small mobile */
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: 1fr; }
  .nubi-search { display: none; }
  .header-right .nubi-caption { display: none; }
}

/* === Toast notification === */
.nubi-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--nubi-positive);
  border-radius: 6px;
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  z-index: 10000;
  animation: slideInRight 0.3s ease;
  max-width: 350px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nubi-toast .toast-icon { font-size: 20px; }
.nubi-toast .toast-text { font-size: 12px; color: var(--text-primary); }
.nubi-toast .toast-sub { font-size: 10px; color: var(--text-caption); margin-top: 2px; }
.nubi-toast .toast-close {
  cursor: pointer;
  color: var(--text-caption);
  font-size: 16px;
  margin-left: auto;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* === Status indicator dot === */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot 2s infinite;
}

.status-dot.online { background: var(--nubi-positive); }
.status-dot.offline { background: var(--nubi-negative); animation: none; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* === Command Palette (Ctrl+K) === */
#command-palette {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  animation: fadeIn 0.15s ease;
}

#command-palette.open { display: flex; }

#command-palette .cp-box {
  width: 560px;
  max-width: 90vw;
  max-height: 400px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
  overflow: hidden;
  animation: pageSlide 0.2s ease;
}

#command-palette .cp-input {
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 16px;
  font-family: var(--font-body);
  outline: none;
}

#command-palette .cp-input::placeholder { color: var(--text-caption); }

#command-palette .cp-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
}

#command-palette .cp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

#command-palette .cp-item:hover,
#command-palette .cp-item.selected {
  background: var(--card-hover);
}

#command-palette .cp-item .cp-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

#command-palette .cp-item .cp-icon.business { background: rgba(157,200,95,0.15); color: var(--nubi-business); }
#command-palette .cp-item .cp-icon.market { background: rgba(205,77,247,0.15); color: var(--nubi-market); }
#command-palette .cp-item .cp-icon.competition { background: rgba(30,188,239,0.15); color: var(--nubi-competition); }
#command-palette .cp-item .cp-icon.action { background: rgba(61,169,254,0.15); color: var(--nubi-blue); }

#command-palette .cp-item .cp-text {
  flex: 1;
}

#command-palette .cp-item .cp-title {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

#command-palette .cp-item .cp-desc {
  font-size: 11px;
  color: var(--text-caption);
  margin-top: 1px;
}

#command-palette .cp-item .cp-shortcut {
  font-size: 10px;
  color: var(--text-caption);
  background: var(--input-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

#command-palette .cp-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--border-color);
  font-size: 10px;
  color: var(--text-caption);
  display: flex;
  gap: 12px;
}

#command-palette .cp-footer kbd {
  background: var(--input-bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 10px;
}

/* === Onboarding Tour === */
.tour-highlight {
  position: relative;
  z-index: 10001;
  box-shadow: 0 0 0 4px var(--nubi-blue), 0 0 0 8px rgba(61,169,254,0.2);
  border-radius: 8px;
}

.tour-tooltip {
  position: fixed;
  z-index: 10002;
  background: var(--card-bg);
  border: 1px solid var(--nubi-blue);
  border-radius: 10px;
  padding: 16px 20px;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  animation: fadeIn 0.3s ease;
}

.tour-tooltip .tour-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.tour-tooltip .tour-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.tour-tooltip .tour-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tour-tooltip .tour-step {
  font-size: 11px;
  color: var(--text-caption);
}

.tour-tooltip .tour-next {
  background: var(--nubi-blue);
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}

.tour-tooltip .tour-skip {
  background: none;
  border: none;
  color: var(--text-caption);
  font-size: 11px;
  cursor: pointer;
}

/* === Keyboard shortcut hint === */
.shortcut-hint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--text-caption);
  margin-left: auto;
}

.shortcut-hint kbd {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  padding: 0 4px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 9px;
  line-height: 16px;
}

/* === Notification pulse === */
@keyframes notifPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.notif-pulse {
  animation: notifPulse 1.5s ease infinite;
}

/* === Ribbon badge (new feature) === */
.ribbon {
  position: absolute;
  top: 8px;
  right: -6px;
  background: var(--nubi-blue);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px 2px 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ribbon::before {
  content: '';
  position: absolute;
  bottom: -4px;
  right: 0;
  border-width: 4px 6px 0 0;
  border-style: solid;
  border-color: var(--nubi-blue-hover) transparent;
}

/* === Confetti (celebration) === */
@keyframes confettiFall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti-piece {
  position: fixed;
  width: 8px;
  height: 8px;
  top: -10px;
  z-index: 10003;
  animation: confettiFall 3s ease-in forwards;
}

/* === Scroll to top button === */
#scroll-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--nubi-blue);
  color: white;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(61,169,254,0.3);
  z-index: 100;
  transition: all 0.3s ease;
}

#scroll-top:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(61,169,254,0.4);
}

#scroll-top.visible {
  display: flex;
}

/* === Timestamp live === */
.live-timestamp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-caption);
}

.live-timestamp .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--nubi-positive);
  animation: pulse-dot 2s ease infinite;
}

/* === Tab counter badge === */
.tab-badge {
  display: inline-block;
  background: var(--nubi-blue);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 4px;
  vertical-align: middle;
}

/* === Empty state with illustration === */
.nubi-empty svg {
  margin-bottom: 15px;
  opacity: 0.5;
}

/* === Compact mode (more data, less spacing) === */
body.compact-mode .nubi-card { padding: 10px; min-height: 70px; }
body.compact-mode .nubi-indicator .ind-value { font-size: 18px; }
body.compact-mode .nubi-table td { padding: 6px 8px; font-size: 11px; }
body.compact-mode .nubi-grid { gap: 8px; }

/* === Fullscreen chart === */
.chart-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: var(--body-bg);
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.chart-fullscreen .close-fs {
  position: absolute;
  top: 15px;
  right: 15px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

/* === Copy to clipboard feedback === */
.copy-feedback {
  position: fixed;
  bottom: 60px;
  right: 20px;
  background: var(--nubi-positive);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

/* === Sidebar section divider === */
.menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 8px 15px;
}

/* === Print === */
@media print {
  #nubi-sidebar, #nubi-header, #nubi-submenu, .nubi-btn-blue, .nubi-btn-violet, .nubi-btn-outlined { display: none; }
  #nubi-main { width: 100%; }
  #nubi-content { padding: 0; }
  .nubi-card { box-shadow: none; border: 1px solid #ddd; }
}
