@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

:root {
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  --bg: #F7F6F2;
  --bg-card: #FFFFFF;
  --bg-sidebar: #0F1117;
  --bg-hover: #F0EEE8;
  --bg-input: #FFFFFF;

  --text-primary: #0F1117;
  --text-secondary: #6B6860;
  --text-muted: #A8A59E;
  --text-inverse: #F7F6F2;
  --text-sidebar: #C8C4BC;
  --text-sidebar-active: #FFFFFF;

  --border: rgba(15,17,23,0.1);
  --border-strong: rgba(15,17,23,0.2);

  --accent: #1A6BFA;
  --accent-light: #EBF1FF;
  --accent-dark: #0E4DB8;

  --green: #16A34A;
  --green-light: #DCFCE7;
  --amber: #D97706;
  --amber-light: #FEF3C7;
  --red: #DC2626;
  --red-light: #FEE2E2;
  --purple: #7C3AED;
  --purple-light: #EDE9FE;
  --teal: #0D9488;
  --teal-light: #CCFBF1;

  --sidebar-w: 240px;
  --header-h: 60px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);

  --transition: 150ms cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 300ms cubic-bezier(0.4,0,0.2,1);
}

[data-theme="dark"] {
  --bg: #0F1117;
  --bg-card: #1A1D27;
  --bg-sidebar: #080B10;
  --bg-hover: #22263A;
  --bg-input: #1A1D27;

  --text-primary: #F0EEE8;
  --text-secondary: #9B9790;
  --text-muted: #5C5A55;
  --text-inverse: #0F1117;
  --text-sidebar: #9B9790;
  --text-sidebar-active: #FFFFFF;

  --border: rgba(240,238,232,0.08);
  --border-strong: rgba(240,238,232,0.16);

  --accent: #4B8BFB;
  --accent-light: #1A2645;
  --accent-dark: #6BA3FC;

  --green: #22C55E;
  --green-light: #14281E;
  --amber: #F59E0B;
  --amber-light: #2A1F08;
  --red: #EF4444;
  --red-light: #2A0E0E;
  --purple: #A78BFA;
  --purple-light: #1E1535;
  --teal: #2DD4BF;
  --teal-light: #0A2420;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background var(--transition-slow), color var(--transition-slow);
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font-body); }

/* ── LAYOUT APP ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.logo-icon svg { width: 18px; height: 18px; color: white; }

.logo-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.02em;
}

.logo-tagline {
  font-size: 10px;
  color: var(--text-sidebar);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-company {
  padding: 12px 16px;
  margin: 12px 12px 0;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.08);
}

.company-label { font-size: 10px; color: var(--text-sidebar); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
.company-name { font-size: 13px; color: white; font-weight: 500; }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 20px 4px;
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-sidebar);
  font-size: 13px;
  font-weight: 400;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  border-radius: 0;
}

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

.nav-item.active {
  color: var(--text-sidebar-active);
  background: rgba(26,107,250,0.2);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-item i { font-size: 16px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}

.user-card:hover { background: rgba(255,255,255,0.05); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; color: white; font-weight: 500; truncate: true; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-sidebar); }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
  font-size: 18px;
}

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

.page-content {
  flex: 1;
  padding: 24px;
}

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── KPI CARDS ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

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

.kpi-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 20px;
}

.kpi-delta.up { color: var(--green); background: var(--green-light); }
.kpi-delta.down { color: var(--red); background: var(--red-light); }
.kpi-delta.neutral { color: var(--text-secondary); background: var(--bg-hover); }

.kpi-icon {
  position: absolute;
  right: 16px; top: 16px;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}

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

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

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

.btn-secondary:hover { background: var(--bg-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

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

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.badge-blue { background: var(--accent-light); color: var(--accent); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-amber { background: var(--amber-light); color: var(--amber); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-teal { background: var(--teal-light); color: var(--teal); }
.badge-gray { background: var(--bg-hover); color: var(--text-secondary); }

/* ── TABLES ── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 11px 12px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,107,250,0.1);
}

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6860' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

/* ── MODALS ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform var(--transition-slow);
}

.modal-overlay.open .modal { transform: translateY(0); }

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

.modal-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}

.modal-body { padding: 20px 24px; }

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── SEARCH ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,107,250,0.1);
}

.search-bar i { color: var(--text-muted); font-size: 16px; }

.search-bar input {
  flex: 1;
  border: none;
  background: none;
  padding: 9px 0;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
}

.search-bar input::placeholder { color: var(--text-muted); }

/* ── CHARTS ── */
.chart-container { position: relative; width: 100%; }

/* ── TOAST ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-sidebar);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  animation: toastIn 0.3s ease;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }

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

/* ── AVATAR ── */
.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  color: white;
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 36px; height: 36px; font-size: 13px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; }

/* ── PROGRESS ── */
.progress {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── ANIMATIONS ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease forwards; }
.fade-in-1 { animation-delay: 0.05s; opacity: 0; }
.fade-in-2 { animation-delay: 0.1s; opacity: 0; }
.fade-in-3 { animation-delay: 0.15s; opacity: 0; }
.fade-in-4 { animation-delay: 0.2s; opacity: 0; }
.fade-in-5 { animation-delay: 0.25s; opacity: 0; }

/* ── UTILITIES ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-secondary); }
.text-right { text-align: right; }
.font-display { font-family: var(--font-display); }
.font-mono { font-family: monospace; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.w-full { width: 100%; }

/* ── v2 ADDITIONS ── */

/* Skeleton loader */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--border) 50%, var(--bg-hover) 75%);
  background-size: 1000px 100%;
  animation: shimmer 1.8s infinite;
  border-radius: var(--radius-md);
}

/* Nav badge IA gradient */
.nav-badge-ia {
  background: linear-gradient(135deg, #7C3AED, #1A6BFA) !important;
}

/* Comparison row */
.compare-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.compare-row:last-child { border-bottom: none; }
.compare-label { font-size: 12px; color: var(--text-secondary); width: 120px; flex-shrink: 0; }
.compare-bars { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.compare-bar-row { display: flex; align-items: center; gap: 8px; }
.compare-bar-wrap { flex: 1; height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; }
.compare-bar-fill { height: 100%; border-radius: 3px; }
.compare-val { font-size: 12px; font-weight: 600; width: 48px; text-align: right; flex-shrink: 0; }

/* Funil visual */
.funil-visual { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }
.funil-stage {
  display: grid;
  grid-template-columns: 130px 1fr 70px 70px;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  transition: background var(--transition);
}
.funil-stage:last-child { border-bottom: none; }
.funil-stage:hover { background: var(--bg-hover); border-radius: var(--radius-sm); padding-left: 8px; }
.funil-stage-name { font-size: 13px; font-weight: 500; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.funil-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.funil-bar-wrap { height: 24px; background: var(--bg-hover); border-radius: 4px; overflow: hidden; position: relative; }
.funil-bar-fill { height: 100%; border-radius: 4px; transition: width 1s cubic-bezier(0.4,0,0.2,1); display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; }
.funil-bar-label { font-size: 11px; color: white; font-weight: 600; white-space: nowrap; }
.funil-pct-cell { font-size: 13px; font-weight: 700; text-align: right; }
.funil-perda { font-size: 11px; color: var(--red); text-align: right; }

/* Origem cards */
.origem-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: all var(--transition);
}
.origem-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.origem-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.origem-icon-wrap { width: 40px; height: 40px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.origem-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.origem-rank { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.origem-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.origem-metric { text-align: center; padding: 6px; background: var(--bg); border-radius: var(--radius-sm); }
.origem-metric-val { font-size: 16px; font-weight: 700; font-family: var(--font-display); }
.origem-metric-lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.origem-conv { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; }

/* KPI comparativo */
.kpi-compare {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  margin-top: 4px;
}
.kpi-compare-label { color: var(--text-muted); }
.kpi-compare-val { font-weight: 600; }

/* ══════════════════════════════════════════════════════════
   v3 — POLIMENTO VISUAL PREMIUM (HubSpot / Pipedrive / Salesforce)
   ══════════════════════════════════════════════════════════ */

:root {
  /* sombras mais refinadas e em camadas */
  --shadow-sm: 0 1px 2px rgba(15,17,23,0.04), 0 1px 3px rgba(15,17,23,0.06);
  --shadow-md: 0 2px 4px rgba(15,17,23,0.04), 0 6px 16px rgba(15,17,23,0.08);
  --shadow-lg: 0 8px 24px rgba(15,17,23,0.10), 0 16px 48px rgba(15,17,23,0.10);
  --ring: 0 0 0 3px rgba(26,107,250,0.12);
}
[data-theme="dark"] {
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.6);
}

/* tipografia mais nítida e com melhor hierarquia */
html { font-size: 14.5px; }
body { letter-spacing: -0.006em; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.card-title { letter-spacing: -0.015em; }
.kpi-value, .funil-kpi-val, .metric-val { letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-label, .nav-section-label, .section-title { font-feature-settings: "ss01"; }

/* cards com micro-borda superior e transição mais suave */
.card { border-radius: 14px; transition: box-shadow var(--transition-slow), transform var(--transition-slow), border-color var(--transition); }
.card:hover { box-shadow: var(--shadow-md); }

/* sidebar — mais respiro e refinamento */
.sidebar { box-shadow: inset -1px 0 0 rgba(255,255,255,0.04); }
.sidebar-logo { padding: 22px 20px 18px; }
.logo-icon { box-shadow: 0 2px 8px rgba(26,107,250,0.4); }
.nav-item { margin: 1px 8px; padding: 9px 12px; border-radius: 8px; font-size: 13px; }
.nav-item.active { background: linear-gradient(90deg, rgba(26,107,250,0.22), rgba(26,107,250,0.08)); }
.nav-item.active::before { left: -8px; top: 8px; bottom: 8px; }
.nav-item:hover { background: rgba(255,255,255,0.06); }
.nav-section-label { padding: 12px 20px 5px; opacity: .8; }
.sidebar-company { backdrop-filter: blur(8px); }

/* topbar com leve blur e borda mais sutil */
.topbar { backdrop-filter: saturate(1.4) blur(8px); background: color-mix(in srgb, var(--bg-card) 88%, transparent); }
.topbar-title { letter-spacing: -0.02em; }

/* botões — micro-elevação e estados mais polidos */
.btn { border-radius: 8px; font-weight: 550; letter-spacing: -0.01em; }
.btn-primary { box-shadow: 0 1px 2px rgba(26,107,250,0.25); }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(26,107,250,0.35); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-icon { border-radius: 8px; }

/* KPI cards — números tabulares e hover refinado */
.kpi-card { border-radius: 14px; }
.kpi-card:hover { box-shadow: var(--shadow-md); }

/* badges mais arredondados e densos */
.badge { border-radius: 7px; font-weight: 550; padding: 3px 9px; }

/* tabelas — linhas mais legíveis */
thead th { font-size: 10.5px; letter-spacing: 0.07em; padding: 10px 12px; }
tbody td { padding: 12px; }
tbody tr { transition: background var(--transition); }

/* inputs com foco mais elegante */
.form-control:focus, .input-field:focus, .search-bar:focus-within { box-shadow: var(--ring); }
.search-bar { border-radius: 8px; }

/* scrollbar discreta (premium feel) */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* page-content com largura máxima confortável e mais respiro */
.page-content { padding: 28px 28px 40px; }

/* seções com melhor espaçamento */
.section-header { margin-bottom: 16px; margin-top: 4px; }

/* toast mais polido */
.toast { border-radius: 10px; backdrop-filter: blur(8px); }

/* medalhas / ranking — leve destaque */
.ranking-pos.gold, .rank-num.gold { filter: drop-shadow(0 1px 2px rgba(217,119,6,0.4)); }

/* animação de entrada mais suave e escalonada */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.45s cubic-bezier(.4,0,.2,1) forwards; }

/* impressão (relatórios em reunião de diretoria) */
@media print {
  .sidebar, .topbar, .btn, .btn-icon, .periodo-selector, .filter-row, .filter-bar, .export-bar, .relatorio-sidebar { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
  body { background: white !important; }
}

/* ══════════════════════════════════════════════════════════
   v4 — CAMADA DE PRODUTO (demo-ready SaaS)
   Onboarding · Tour guiado · Cenário demo · Confirmações ·
   Empty states · Microinterações premium
   ══════════════════════════════════════════════════════════ */

/* ── Botões da plataforma na topbar (Tour / Demo) ── */
.plat-launch {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all var(--transition); font-family: var(--font-body);
  border: 1px solid transparent; white-space: nowrap;
}
.plat-launch i { font-size: 15px; }
.plat-launch-demo {
  background: linear-gradient(135deg, #16A34A, #0D9488); color: #fff;
  box-shadow: 0 1px 3px rgba(22,163,74,.3);
}
.plat-launch-demo:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(22,163,74,.4); }
.plat-launch-tour {
  background: var(--bg-hover); color: var(--text-secondary); border-color: var(--border-strong);
}
.plat-launch-tour:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-light); }
@media (max-width: 760px) { .plat-launch span { display: none; } .plat-launch { padding: 7px; } }

/* Pílula "modo demonstração" no topo */
.demo-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  background: linear-gradient(135deg, rgba(22,163,74,.14), rgba(13,148,136,.14));
  color: var(--green); border: 1px solid rgba(22,163,74,.35);
}
.demo-pill .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulseDot 1.8s infinite; }
@keyframes pulseDot { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(22,163,74,.5);} 50% { opacity:.6; box-shadow: 0 0 0 5px rgba(22,163,74,0);} }

/* ── Overlay genérico (onboarding, demo, confirm) ── */
.plat-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(8,11,16,.62); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity var(--transition-slow);
}
.plat-overlay.open { opacity: 1; pointer-events: all; }
.plat-dialog {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow-lg); width: 100%; max-width: 540px;
  transform: translateY(16px) scale(.98); transition: transform var(--transition-slow);
  overflow: hidden;
}
.plat-overlay.open .plat-dialog { transform: translateY(0) scale(1); }

/* Onboarding / boas-vindas */
.plat-hero {
  position: relative; padding: 32px 32px 26px; overflow: hidden;
  background:
    radial-gradient(700px 240px at 0% 0%, rgba(26,107,250,.18), transparent 60%),
    radial-gradient(600px 240px at 100% 0%, rgba(124,58,237,.14), transparent 60%),
    var(--bg-sidebar);
}
.plat-hero-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px; color: #fff;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); margin-bottom: 16px;
}
.plat-hero h2 { font-family: var(--font-display); color: #fff; font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-bottom: 8px; }
.plat-hero h2 span { color: #4B8BFB; }
.plat-hero p { color: rgba(255,255,255,.62); font-size: 14px; line-height: 1.6; max-width: 420px; }
.plat-body { padding: 24px 32px 28px; }
.plat-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.plat-stat { text-align: center; padding: 14px 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.plat-stat-val { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.plat-stat-lbl { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 5px; }
.plat-actions { display: flex; gap: 10px; }
.plat-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: var(--font-body); border: 1px solid transparent; transition: all var(--transition);
}
.plat-btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(26,107,250,.3); }
.plat-btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(26,107,250,.4); }
.plat-btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border-strong); flex: 0 0 auto; }
.plat-btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Confirm dialog ── */
.confirm-dialog { max-width: 420px; }
.confirm-head { display: flex; gap: 14px; padding: 24px 24px 8px; }
.confirm-ico { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.confirm-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.confirm-msg { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }
.confirm-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 24px 22px; }

/* ── Tour guiado (spotlight) ── */
#tour-scrim { position: fixed; inset: 0; z-index: 500; pointer-events: none; opacity: 0; transition: opacity .35s ease; }
#tour-scrim.on { opacity: 1; pointer-events: all; }
#tour-hole {
  position: absolute; border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(8,11,16,.72); transition: all .45s cubic-bezier(.4,0,.2,1);
  border: 2px solid var(--accent); pointer-events: none;
}
.tour-pop {
  position: fixed; z-index: 501; width: 340px; max-width: calc(100vw - 32px);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 20px; transition: all .4s cubic-bezier(.4,0,.2,1);
}
.tour-step-badge { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.tour-pop h3 { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; letter-spacing: -.01em; }
.tour-pop p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.tour-value { margin-top: 12px; padding: 10px 12px; background: var(--accent-light); border-radius: 10px; font-size: 12.5px; color: var(--accent-dark); display: flex; gap: 8px; align-items: flex-start; }
.tour-value i { margin-top: 1px; }
.tour-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.tour-dots { display: flex; gap: 5px; }
.tour-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); transition: all var(--transition); }
.tour-dot.active { background: var(--accent); width: 18px; border-radius: 3px; }
.tour-btns { display: flex; gap: 6px; }

/* ── Empty states ── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-ico {
  width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center; font-size: 32px;
  background: var(--accent-light); color: var(--accent);
}
.empty-state h3 { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--text-secondary); max-width: 320px; margin: 0 auto 18px; line-height: 1.55; }

/* ── Success burst (confirmação visual) ── */
.success-toast { border-left-width: 3px; }
@keyframes checkPop { 0% { transform: scale(0); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
.check-pop { animation: checkPop .4s cubic-bezier(.4,0,.2,1); }

/* ── Microinterações em cards/linhas ── */
.kpi-card, .card { will-change: transform; }
.kpi-card:hover .kpi-icon { transform: scale(1.08) rotate(-3deg); }
.kpi-icon { transition: transform var(--transition); }
tbody tr { transition: background var(--transition), box-shadow var(--transition); }
.ranking-row, .link-card, .origem-card { transition: all var(--transition); }
.link-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

/* contagem animada */
.count-up { font-variant-numeric: tabular-nums; }

/* entrada escalonada extra */
.fade-in-6 { animation-delay: .3s; opacity: 0; }
.fade-in-7 { animation-delay: .35s; opacity: 0; }

/* nav badge "novo" */
.nav-badge-new { background: linear-gradient(135deg,#16A34A,#0D9488) !important; }

/* ── Banner executivo (relatórios / captação) ── */
.exec-banner {
  position: relative; overflow: hidden; border-radius: 16px; padding: 22px 26px; margin-bottom: 20px;
  background:
    radial-gradient(600px 200px at 100% 0%, rgba(26,107,250,.12), transparent 65%),
    linear-gradient(135deg, var(--bg-sidebar), #161a24);
  border: 1px solid var(--border);
}
.exec-banner h1 { font-family: var(--font-display); color: #fff; font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.exec-banner .sub { color: rgba(255,255,255,.55); font-size: 13px; margin-top: 3px; }
.exec-banner .meta { color: rgba(255,255,255,.4); font-size: 11px; margin-top: 10px; display: flex; gap: 16px; flex-wrap: wrap; }
.exec-banner .meta b { color: rgba(255,255,255,.75); font-weight: 600; }

/* highlight chips */
.hl-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px; font-size: 12px; font-weight: 600; }
