/* ============================================================
   Kharoo — Design System v3.0
   Brand: #6e159b (Roxo escuro) | #c374eb (Roxo claro) | #2d302f (Preto / Grafite) | #ffffff (Branco)
   Light UI — Modern Premium SaaS aesthetic
   ============================================================ */

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

/* ─── DESIGN TOKENS ─────────────────────────────────────── */
:root {
  /* Brand palette Kharoo */
  --brand-purple:        #6e159b;
  --brand-purple-light:  #c374eb;
  --brand-purple-dark:   #58107c;
  --brand-purple-hover:  #58107c;
  --brand-purple-glow:   rgba(110, 21, 155, 0.25);
  --brand-dark:          #2d302f;
  --brand-dark-deep:     #1d1f1e;
  --brand-white:         #ffffff;
  --brand-gradient:      linear-gradient(135deg, #6e159b 0%, #c374eb 100%);

  /* Legacy/alias variables mapped to Kharoo palette */
  --brand-lime:          #c374eb;
  --brand-lime-dark:     #b05bdc;
  --brand-green:         #6e159b;

  /* Primary interactive (Kharoo purple) */
  --primary:             #6e159b;
  --primary-hover:       #58107c;
  --primary-light:       #8c22c5;
  --primary-subtle:      #faf5ff;
  --primary-border:      #e9d5ff;

  /* Semantic colours */
  --success:           #16a34a;
  --success-subtle:    #f0fdf4;
  --warning:           #d97706;
  --warning-subtle:    #fffbeb;
  --danger:            #dc2626;
  --danger-subtle:     #fef2f2;
  --info:              #0891b2;
  --info-subtle:       #ecfeff;

  /* Neutral surface system */
  --background:        #f6f8fa;
  --surface:           #ffffff;
  --surface-alt:       #f1f5f9;
  --surface-hover:     #f8fafc;

  /* Borders */
  --border:            #e2e8f0;
  --border-subtle:     #f1f5f9;
  --border-strong:     #cbd5e1;

  /* Typography */
  --text-main:         #0f172a;
  --text-secondary:    #334155;
  --text-muted:        #64748b;
  --text-dim:          #94a3b8;
  --text-inverse:      #ffffff;

  /* Shadows */
  --shadow-xs:  0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-sm:  0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.04);
  --shadow-md:  0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg:  0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-xl:  0 20px 25px -5px rgb(0 0 0 / 0.09), 0 8px 10px -6px rgb(0 0 0 / 0.04);

  /* Radii */
  --radius-xs:  4px;
  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-full: 9999px;

  /* Sidebar Kharoo (harmonized charcoal #1d1f1e with purple glow) */
  --sidebar-bg:        #1d1f1e;
  --sidebar-border:    rgba(255,255,255,0.08);
  --sidebar-text:      #9ca3af;
  --sidebar-text-hover:#ffffff;
  --sidebar-active-bg: rgba(195,116,235,0.14);
  --sidebar-active-text:#c374eb;

  /* Transitions */
  --transition-fast:   120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base:   180ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   250ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--background);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ─── SCROLLBARS ─────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ─── APP SHELL ──────────────────────────────────────────── */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ─── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  width: 256px;
  min-width: 256px;
  background-color: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
  z-index: 40;
  overflow: hidden;
}

.sidebar-header {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--brand-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  color: #ffffff;
  flex-shrink: 0;
  letter-spacing: -0.03em;
  box-shadow: 0 2px 8px var(--brand-purple-glow);
}

.brand-name {
  line-height: 1.15;
}

.brand-name-primary {
  font-size: 0.85rem;
  font-weight: 700;
  color: #e6edf3;
  letter-spacing: 0.04em;
}

.brand-name-sub {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--sidebar-text);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Tenant selector */
.tenant-selector {
  margin: 10px 10px 4px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background var(--transition-fast);
  gap: 8px;
  flex-shrink: 0;
}
.tenant-selector:hover { background: rgba(255,255,255,0.07); }

.tenant-selector-info { overflow: hidden; flex: 1; }
.tenant-org-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #c9d1d9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tenant-org-meta {
  font-size: 0.75rem;
  color: var(--sidebar-text);
  margin-top: 1px;
}
.tenant-chevron {
  color: var(--sidebar-text);
  flex-shrink: 0;
}

/* Nav — sidebar-nav styles are defined in ui-v4.css (loaded after this file) */

.nav-section-title {
  padding: 14px 10px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  margin: 1px 0;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
  position: relative;
}

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

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

.nav-item.active svg { color: var(--sidebar-active-text); }

.nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.8;
}
.nav-item:hover svg, .nav-item.active svg { opacity: 1; }

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.12);
  color: #c9d1d9;
}

/* Sidebar footer (user) */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--brand-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #c9d1d9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.65rem;
  color: var(--sidebar-text);
}

.btn-logout {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--sidebar-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}
.btn-logout:hover {
  background: rgba(220,38,38,0.15);
  color: #fca5a5;
  border-color: rgba(220,38,38,0.3);
}
.btn-logout svg { width: 14px; height: 14px; }

/* ─── MAIN AREA ──────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--background);
  min-width: 0;
}

/* ─── TOPBAR ─────────────────────────────────────────────── */
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 600;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  flex: 1;
  min-width: 280px;
  max-width: 520px;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.search-box:hover { border-color: var(--border-strong); }
.search-box svg { width: 14px; height: 14px; flex-shrink: 0; }
.search-box kbd {
  margin-left: auto;
  font-size: 0.65rem;
  background: #fff;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
}

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

/* ─── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
  font-family: inherit;
  line-height: 1.25;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn:focus-visible,
.btn-icon:focus-visible,
.filter-tab:focus-visible,
.tab-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(110,21,155,0.35);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-alt); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-alt); color: var(--text-main); }

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-ai {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #ffffff;
  border-color: transparent;
}
.btn-ai:hover:not(:disabled) { opacity: 0.9; box-shadow: 0 2px 8px rgba(109,40,217,0.35); }

.btn-sm {
  padding: 7px 14px;
  font-size: 0.86rem;
  border-radius: var(--radius-sm);
}
.btn-sm svg { width: 14px; height: 14px; }

.btn-xs {
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: var(--radius-xs);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
  font-size: 0.8rem;
}
.btn-icon:hover { background: var(--surface-alt); color: var(--text-main); }
.btn-icon svg { width: 14px; height: 14px; }

/* ─── CONTENT AREA ───────────────────────────────────────── */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* ─── PAGE HEADER ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 3px;
}

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

/* ─── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 20px;
  margin-bottom: 16px;
}

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

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

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

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  position: relative;
  overflow: hidden;
}

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

.kpi-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

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

.kpi-icon-green  { background: var(--success-subtle); color: var(--success); }
.kpi-icon-blue   { background: #eff6ff; color: #2563eb; }
.kpi-icon-amber  { background: var(--warning-subtle); color: var(--warning); }
.kpi-icon-red    { background: var(--danger-subtle); color: var(--danger); }
.kpi-icon-purple { background: #f5f3ff; color: #7c3aed; }
.kpi-icon-teal   { background: #f0fdfa; color: #0d9488; }

.kpi-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  line-height: 1;
}

.kpi-delta {
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
}
.kpi-delta.up   { color: var(--success); }
.kpi-delta.down { color: var(--danger); }

/* ─── FILTER BAR ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.filter-tab {
  padding: 6px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
  border: none;
  background: transparent;
  font-family: inherit;
}
.filter-tab.active {
  background: var(--surface);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}
.filter-tab:hover:not(.active) { color: var(--text-secondary); }

.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
  transition: border-color var(--transition-fast);
}
.search-input:focus-within { border-color: var(--primary-light); }
.search-input svg { width: 14px; height: 14px; flex-shrink: 0; }
.search-input input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.82rem;
  color: var(--text-main);
  font-family: inherit;
  width: 200px;
}

.filter-select {
  padding: 6px 10px;
  font-size: 0.78rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}
.filter-select:focus { border-color: var(--primary-light); }

/* ─── TABLES ─────────────────────────────────────────────── */
.table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: var(--shadow-xs);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  position: relative;
}

/* Tables auto-size columns by content — content wins over header */
.table-container table {
  table-layout: auto;
  width: 100%;
}

/* Headers: flexible and responsive — allow wrapping if title is long so it NEVER steals space from content */
.table-container th {
  white-space: normal;
  line-height: 1.25;
  vertical-align: bottom;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  padding: 10px 14px;
}

/* Table cells: comfortable line-height, no aggressive word splitting */
.table-container td {
  overflow-wrap: break-word;
  word-break: normal;
  padding: 12px 14px;
  vertical-align: middle;
}

/* Text-heavy columns: give them ample, generous breathing room so names sit on 1-2 lines without squeezing */
.table-container td.col-name,
.table-container td.col-title,
.table-container td.col-text,
.table-container td.col-primary,
.table-container td.col-course,
.table-container th.col-name,
.table-container th.col-title,
.table-container th.col-primary,
.table-container th.col-course {
  min-width: 250px;
}

.table-container td.col-name-lg,
.table-container th.col-name-lg {
  min-width: 280px;
}

.table-container td.col-name-xl,
.table-container th.col-name-xl {
  min-width: 320px;
}

/* Numeric / badge / action columns stay compact */
.table-container td.col-num,
.table-container td.col-badge {
  white-space: nowrap;
  width: 1px;
}

.table-container td.col-actions {
  white-space: nowrap;
  text-align: right;
  min-width: 160px;
}

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

.table-container::-webkit-scrollbar-track {
  background: var(--surface-alt);
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  transition: background var(--transition-fast);
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

thead { background: var(--surface-alt); }

th {
  padding: 12px 16px;
  font-size: 0.80rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

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

tbody tr {
  transition: background var(--transition-fast);
}
tbody tr:hover td {
  background: var(--surface-hover);
}

/* Table cell helpers */
.cell-primary {
  font-weight: 600;
  color: var(--text-main);
}
.cell-link {
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}
.cell-link:hover { text-decoration: underline; }

.table-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
tr:hover .table-actions { opacity: 1; }

/* ─── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  white-space: nowrap;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge svg { width: 10px; height: 10px; }

/* Semantic badge colours */
.badge-default    { background: var(--surface-alt); color: var(--text-muted); }
.badge-primary    { background: var(--primary-subtle); color: var(--primary); border: 1px solid var(--primary-border); }
.badge-success    { background: var(--success-subtle); color: var(--success); }
.badge-warning    { background: var(--warning-subtle); color: var(--warning); }
.badge-danger     { background: var(--danger-subtle); color: var(--danger); }
.badge-info       { background: var(--info-subtle); color: var(--info); }
.badge-purple     { background: #f5f3ff; color: #7c3aed; }

/* Status badges */
.badge-lead       { background: #f1f5f9; color: #475569; }
.badge-prospect   { background: #eff6ff; color: #1d4ed8; }
.badge-customer   { background: var(--success-subtle); color: var(--success); }
.badge-inactive   { background: #f1f5f9; color: #94a3b8; }
.badge-lost       { background: var(--danger-subtle); color: var(--danger); }
.badge-won        { background: var(--success-subtle); color: var(--success); }

/* Temperature badges */
.badge-hot  { background: #fef2f2; color: #b91c1c; }
.badge-warm { background: #fffbeb; color: #b45309; }
.badge-cold { background: #f0f9ff; color: #0369a1; }

/* SLA badge */
.badge-sla  { background: #fee2e2; color: #991b1b; font-weight: 700; }

/* ─── KANBAN (TRELLO-STYLE EXPERIENCE) ──────────────────── */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 4px 20px 4px;
  min-height: calc(100vh - 190px);
  align-items: flex-start;
}

.kanban-column {
  width: 320px;
  min-width: 320px;
  max-width: 320px;
  flex: 0 0 320px;
  background: #f1f3f5;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.kanban-col-header {
  padding: 12px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: transparent;
  border-radius: 12px 12px 0 0;
}

.kanban-col-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-col-count {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(0,0,0,0.06);
  color: var(--text-secondary);
}

.kanban-cards {
  padding: 8px 10px 10px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 40px;
}

.kanban-card {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  padding: 13px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-fast);
  user-select: none;
  position: relative;
}

.kanban-card:hover {
  box-shadow: 0 6px 14px rgba(0,0,0,0.09);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.kanban-card:active { cursor: grabbing; }

.kanban-card.dragging {
  opacity: 0.45;
  box-shadow: var(--shadow-lg);
  transform: scale(0.98);
}

.kanban-column.drag-over {
  background: var(--primary-subtle);
  border-color: var(--primary);
}

/* Kanban Collapsed Column (Trello-style spine) */
.kanban-column-collapsed {
  transition: all 0.25s ease;
}
.kanban-column-collapsed:hover {
  filter: brightness(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Kanban Inline Quick Composer */
.kanban-add-card-btn {
  margin: 0 10px 10px;
  padding: 8px 12px;
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 150ms ease;
  font-family: inherit;
}
.kanban-add-card-btn:hover {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.kanban-inline-composer {
  margin: 0 10px 10px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: modalIn 150ms ease;
}

.kanban-add-stage-col {
  width: 280px;
  min-width: 280px;
  padding: 16px;
  background: rgba(0,0,0,0.02);
  border: 2px dashed var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  cursor: pointer;
  transition: all 150ms ease;
  color: var(--text-muted);
}
.kanban-add-stage-col:hover {
  background: rgba(0,0,0,0.04);
  border-color: var(--primary);
  color: var(--primary);
}

/* ─── TOOLTIP POPOVERS & VALUE BREAKDOWNS ───────────────── */
.tooltip-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}

.tooltip-trigger:hover .tooltip-content,
.tooltip-trigger:focus-within .tooltip-content {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.tooltip-content {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 250px;
  max-width: 320px;
  background: #0f172a;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  line-height: 1.45;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.35);
  z-index: 1000;
  transform: translateY(4px);
  transition: all 160ms cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
}

.tooltip-content::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 14px;
  width: 8px;
  height: 8px;
  background: #0f172a;
  transform: rotate(45deg);
}

.tooltip-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--brand-lime);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tooltip-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 0.76rem;
  gap: 8px;
}
.tooltip-item:last-child {
  border-bottom: none;
}

/* ─── TIMELINE ───────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 12px;
  bottom: 0;
  left: 13px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -32px;
  top: 2px;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
  z-index: 1;
}
.timeline-dot svg { width: 12px; height: 12px; color: var(--text-muted); }
.timeline-dot.dot-primary { border-color: var(--primary-border); }
.timeline-dot.dot-primary svg { color: var(--primary); }
.timeline-dot.dot-success { border-color: #bbf7d0; }
.timeline-dot.dot-success svg { color: var(--success); }
.timeline-dot.dot-warning { border-color: #fed7aa; }
.timeline-dot.dot-warning svg { color: var(--warning); }
.timeline-dot.dot-danger  { border-color: #fecaca; }
.timeline-dot.dot-danger  svg { color: var(--danger); }
.timeline-dot.dot-purple  { border-color: #ddd6fe; }
.timeline-dot.dot-purple  svg { color: #7c3aed; }

.timeline-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: var(--shadow-xs);
}

.timeline-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── DRAWERS ────────────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.4);
  backdrop-filter: blur(2px);
  z-index: 105;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}
.drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 680px;
  max-width: 95vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  z-index: 110;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}

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

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.drawer-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-title svg { width: 18px; height: 18px; color: var(--text-muted); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ─── MODALS ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
  padding: 20px;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  animation: modalIn var(--transition-base) cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.modal-card > form,
form.modal-card-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@keyframes modalIn {
  from { transform: scale(0.97) translateY(8px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);   opacity: 1; }
}

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

.modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  background: var(--surface);
}

/* ─── TABS ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  gap: 0;
}

.tab-btn {
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  font-family: inherit;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn svg { width: 13px; height: 13px; }
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── FORM ELEMENTS ──────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-row {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  line-height: 1.5;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(110,21,155,0.15);
}

.form-input::placeholder { color: var(--text-dim); }
.form-textarea { resize: vertical; min-height: 80px; }

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── ALERTS & NOTICES ───────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-subtle); color: #15803d; border-color: #bbf7d0; }
.alert-warning  { background: var(--warning-subtle);  color: #92400e; border-color: #fde68a; }
.alert-danger   { background: var(--danger-subtle);   color: #991b1b; border-color: #fecaca; }
.alert-info     { background: var(--info-subtle);     color: #075985; border-color: #bae6fd; }

/* ─── TOASTS ─────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 180ms cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: all;
  max-width: 380px;
  border: 1px solid transparent;
}
.toast svg { width: 15px; height: 15px; flex-shrink: 0; }

.toast-success { background: #052e16; color: #86efac; border-color: #166534; }
.toast-error   { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
.toast-info    { background: #0c1a2e; color: #93c5fd; border-color: #1e3a5f; }
.toast-default { background: var(--brand-dark); color: #e6edf3; border-color: #1e293b; }

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

/* ─── EMPTY STATE ────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}
.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--text-dim);
}
.empty-state-icon svg { width: 26px; height: 26px; }
.empty-state-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}
.empty-state-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ─── SKELETON LOADING ───────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  display: block;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── PROGRESS BARS ──────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--surface-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── DATA GRID / STAT ROW ───────────────────────────────── */
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
  font-size: 0.82rem;
}
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--text-muted); flex: 1; }
.stat-value { font-weight: 700; color: var(--text-main); }

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

/* ─── AVATAR ─────────────────────────────────────────────── */
.avatar {
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--surface-alt);
  color: var(--text-secondary);
}
.avatar-sm { width: 28px; height: 28px; font-size: 0.65rem; }
.avatar-md { width: 36px; height: 36px; font-size: 0.75rem; }
.avatar-lg { width: 44px; height: 44px; font-size: 0.85rem; }

/* ─── FUNNEL BARS ────────────────────────────────────────── */
.funnel-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.funnel-label {
  width: 130px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
}
.funnel-track {
  flex: 1;
  height: 8px;
  background: var(--surface-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.funnel-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.8s cubic-bezier(0.16,1,0.3,1);
}
.funnel-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 40px;
  text-align: right;
  flex-shrink: 0;
}

/* ─── QUICK CREATE MENU ──────────────────────────────────── */
.quick-create-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 220px;
  box-shadow: var(--shadow-lg);
  z-index: 700;
  padding: 6px;
  display: none;
}
.quick-create-menu.open { display: block; }

.quick-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.quick-menu-item:hover { background: var(--surface-alt); color: var(--text-main); }
.quick-menu-item svg { width: 14px; height: 14px; color: var(--text-muted); }

/* ─── AUTH SCREEN ────────────────────────────────────────── */
.auth-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #181919 0%, #2f1040 50%, #150a1d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 400px;
  padding: 28px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.07);
}

/* ─── SECTION CARDS (2-col grids) ────────────────────────── */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.three-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* ─── PRODUCT GRID ───────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 14px;
  margin-top: 16px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.product-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ─── SEGMENT TAGS ───────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ─── REDUCED MOTION ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .content-area { padding: 14px 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 14px; }
  .search-box { min-width: 160px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
}

/* ─── UTILITY ANIMATIONS ─────────────────────────────────── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ─── TOOLTIP BASE ───────────────────────────────────────── */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-main);
  color: #fff;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  max-width: 280px;
  white-space: normal;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 9999;
  line-height: 1.4;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ─── INFO ICON BUTTON ───────────────────────────────────── */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  cursor: help;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  vertical-align: middle;
  margin-left: 4px;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.info-icon:hover { background: var(--primary-subtle); color: var(--primary); border-color: var(--primary); }

/* ─── BADGE EXTRA VARIANTS ───────────────────────────────── */
.badge-info   { background: #e0f2fe; color: #0369a1; }
.badge-orange { background: #fff7ed; color: #c2410c; }

/* ══════════════════════════════════════════════════════════
   Kharoo v3.0 — Extensões de Design (Sightline / Leadline-inspired)
   ══════════════════════════════════════════════════════════ */

/* ─── KPI CARDS v3 — com accent-border colorida no topo ─── */
.kpi-card-v3 {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  position: relative;
  overflow: hidden;
}
.kpi-card-v3::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--kpi-accent, var(--primary));
}
.kpi-card-v3:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.kpi-card-v3.accent-green  { --kpi-accent: var(--success); }
.kpi-card-v3.accent-blue   { --kpi-accent: #2563eb; }
.kpi-card-v3.accent-amber  { --kpi-accent: var(--warning); }
.kpi-card-v3.accent-red    { --kpi-accent: var(--danger); }
.kpi-card-v3.accent-purple { --kpi-accent: #7c3aed; }
.kpi-card-v3.accent-lime   { --kpi-accent: var(--brand-lime-dark); }

.kpi-v3-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kpi-v3-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.04em;
  line-height: 1;
}
.kpi-v3-value .kpi-v3-unit {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0;
}
.kpi-v3-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}
.kpi-v3-trend.up   { color: var(--success); background: var(--success-subtle); }
.kpi-v3-trend.down { color: var(--danger);  background: var(--danger-subtle); }
.kpi-v3-trend.neutral { color: var(--text-muted); background: var(--surface-alt); }
.kpi-v3-trend svg  { width: 12px; height: 12px; }

.kpi-v3-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* ─── HERO PROFILE — Avatar grande + background gradient ── */
.profile-hero {
  background: linear-gradient(135deg, #1d1f1e 0%, #2f1040 60%, #170720 100%);
  padding: 28px 28px 20px;
  position: relative;
  overflow: hidden;
}
.profile-hero::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(195,116,235,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.profile-hero-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  flex-shrink: 0;
  border: 3px solid rgba(195,116,235,0.3);
  box-shadow: 0 0 0 6px rgba(195,116,235,0.12);
}
.profile-hero-name {
  font-size: 1.45rem;
  font-weight: 800;
  color: #f0fdf4;
  letter-spacing: -0.03em;
}
.profile-hero-sub {
  font-size: 0.84rem;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
}

/* Métricas inline no hero do perfil 360 */
.profile-metrics-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 20px;
}
.profile-metric-cell {
  padding: 14px 0;
  border-right: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}
.profile-metric-cell:last-child { border-right: none; }
.profile-metric-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: #f0fdf4;
  letter-spacing: -0.03em;
}
.profile-metric-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* ─── ACTION PILLS — painel operacional de alertas ─────── */
.action-pills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}
.action-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 82px;
}
.action-pill::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--pill-color, var(--primary));
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.action-pill:hover {
  border-color: var(--pill-color, var(--primary));
  background: var(--surface-alt);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.action-pill:hover::before { opacity: 1; }
.action-pill.has-items { border-color: var(--pill-color, var(--warning)); }
.action-pill.has-items::before { opacity: 1; }

.action-pill-number {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--text-muted);
}
.action-pill.has-items .action-pill-number {
  color: var(--pill-color, var(--warning));
}
.action-pill-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ─── REVENUE CHART BAR ─────────────────────────────────── */
.revenue-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding: 0 4px 0;
}
.rev-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
  justify-content: flex-end;
  cursor: pointer;
  position: relative;
}
.rev-bar-col:hover .rev-bar-bars { opacity: 0.8; }
.rev-bar-value-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}
.rev-bar-bars {
  width: 100%;
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: calc(100% - 30px);
  transition: opacity var(--transition-fast);
}
.rev-bar-gross {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, rgba(110,21,155,0.2) 0%, rgba(110,21,155,0.06) 100%);
  border: 1px solid rgba(110,21,155,0.3);
  border-bottom: none;
  min-height: 4px;
  transition: height 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.rev-bar-net {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #6e159b 0%, #58107c 100%);
  min-height: 4px;
  transition: height 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.rev-bar-month-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  padding-top: 4px;
}
.rev-chart-legend {
  display: flex;
  gap: 16px;
  padding: 8px 4px 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.rev-chart-legend-dot {
  width: 10px; height: 10px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

/* ─── PIPELINE FUNNEL v3 ────────────────────────────────── */
.pipeline-stage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.pipeline-stage-row:hover { background: var(--surface-alt); }
.pipeline-stage-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pipeline-stage-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pipeline-stage-bar-wrap {
  width: 90px;
  flex-shrink: 0;
}
.pipeline-stage-stats {
  text-align: right;
  flex-shrink: 0;
  min-width: 90px;
}
.pipeline-stage-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}
.pipeline-stage-value {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
}

/* ─── CHANNEL SOURCE ITEM ───────────────────────────────── */
.channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}
.channel-item:hover { background: var(--surface-alt); }
.channel-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}
.channel-icon svg { width: 14px; height: 14px; }
.channel-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  flex: 1;
}
.channel-bar-mini {
  width: 70px;
  height: 5px;
  background: var(--surface-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.channel-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.channel-count-badge {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--primary-border);
  white-space: nowrap;
}

/* ─── ACTIVITY FEED (Timeline simplificada) ─────────────── */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.activity-feed-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  align-items: flex-start;
}
.activity-feed-item:last-child { border-bottom: none; }
.activity-feed-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.activity-feed-icon svg { width: 14px; height: 14px; }
.activity-feed-body { flex: 1; min-width: 0; }
.activity-feed-main {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.activity-feed-main strong { color: var(--text-main); font-weight: 700; }
.activity-feed-time {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 3px;
  font-weight: 500;
}

/* ─── REACTIVATION CARD ─────────────────────────────────── */
.reactivation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 6px;
}
.reactivation-item:last-child { margin-bottom: 0; }
.reactivation-item:hover {
  border-color: var(--primary);
  background: var(--primary-subtle);
  transform: translateX(2px);
}
.reactivation-item-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--danger-subtle);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid rgba(220,38,38,0.2);
}
.reactivation-item-info { flex: 1; min-width: 0; }
.reactivation-item-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reactivation-item-detail {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}
.reactivation-item-meta { text-align: right; flex-shrink: 0; }
.reactivation-item-date {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--danger);
}
.reactivation-item-value {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ─── TOP PRODUCT ROW ───────────────────────────────────── */
.product-rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.product-rank-row:last-child { border-bottom: none; }
.product-rank-num {
  width: 22px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}
.product-rank-info { flex: 1; min-width: 0; }
.product-rank-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-rank-subs {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}
.product-rank-bar { width: 60px; flex-shrink: 0; }
.product-rank-revenue {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--success);
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── PILL NAV ───────────────────────────────────────────── */
.pill-nav {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}
.pill-nav-btn,
.pill-nav-item {
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  outline: none;
}
.pill-nav-btn svg,
.pill-nav-item svg { width: 14px; height: 14px; }
.pill-nav-btn.active,
.pill-nav-item.active {
  background: var(--surface);
  color: var(--text-main);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
}
.pill-nav-btn:hover:not(.active),
.pill-nav-item:hover:not(.active) {
  color: var(--text-main);
  background: rgba(0,0,0,0.03);
}

/* ─── DASHBOARD GREETING BANNER ─────────────────────────── */
.dash-greeting-bar {
  background: linear-gradient(135deg, #1d1f1e 0%, #2f1040 100%);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  position: relative;
  overflow: visible;
  z-index: 50;
  border: 1px solid rgba(195,116,235,0.18);
}
.dash-greeting-bar::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(195,116,235,0.10) 0%, transparent 70%);
  pointer-events: none;
}
.dash-greeting-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}
.dash-greeting-sub {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  margin-top: 3px;
  font-weight: 500;
}
.dash-greeting-period {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--brand-purple-light);
  background: rgba(195,116,235,0.12);
  border: 1px solid rgba(195,116,235,0.25);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* ─── REVENUE STATUS PILLS ───────────────────────────────── */
.rev-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}
.rev-status-pill svg { width: 10px; height: 10px; }
.rev-status-paid     { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.rev-status-pending  { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.rev-status-partial  { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.rev-status-refunded { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* ─── kpi-icon-orange ────────────────────────────────────── */
.kpi-icon-orange { background: #fff7ed; color: #c2410c; }

/* ─── Responsive overrides for v3 ───────────────────────── */
@media (max-width: 1100px) {
  .profile-metrics-bar { grid-template-columns: repeat(2, 1fr); }
  .action-pills-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .profile-hero { padding: 20px 16px 14px; }
  .profile-metrics-bar { grid-template-columns: repeat(2, 1fr); }
  .action-pills-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-card-v3 .kpi-v3-value { font-size: 1.4rem; }
  .dash-greeting-bar { flex-direction: column; align-items: flex-start; }
  .pipeline-stage-bar-wrap { display: none; }
}

/* ─── KANBAN FORECAST BAR & V3 CARDS (Leadline Pattern) ──── */
.kanban-forecast-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.kanban-forecast-metrics {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.forecast-metric-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.forecast-metric-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.forecast-metric-label svg {
  width: 12px;
  height: 12px;
}

.forecast-metric-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  font-family: 'Inter', sans-serif;
}

.forecast-metric-val.highlight {
  color: var(--primary);
}

.forecast-metric-val.accent {
  color: #10b981;
}

.kanban-col-prob-pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ─── PRODUCT CATALOG CARDS V3 (CampusOS / Eduvex Pattern) ── */
.product-card-v3 {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.product-card-v3 > * { min-width: 0; max-width: 100%; }

.product-card-v3:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-purple-light);
}

.product-card-v3::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-purple), var(--brand-purple-light));
  opacity: 0.85;
}

.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.product-card-meta {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.product-card-v3 .card-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.deletion-control { display: inline-flex; border-radius: var(--radius-sm); }
.deletion-control:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.deletion-control button:disabled { opacity: 0.45; cursor: not-allowed; }

.product-card-category {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(110, 21, 155, 0.08);
  color: var(--primary);
  border: 1px solid rgba(110, 21, 155, 0.2);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.product-card-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  max-width: 100%;
}

.product-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
  line-height: 1.35;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.product-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-price-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 8px;
  flex-wrap: wrap;
}

.product-card-price-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.product-card-price-val {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.product-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.35fr) 30px;
  align-items: stretch;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  gap: 5px;
}

.product-card-actions > .btn {
  min-width: 0;
  width: 100%;
  padding-inline: 4px;
  gap: 3px;
  font-size: 0.72rem;
}
.product-card-actions > .btn span { min-width: 0; overflow-wrap: anywhere; white-space: normal; }
.product-card-actions > .btn svg { flex-shrink: 0; width: 13px; height: 13px; }
.catalog-tabs { margin-bottom: 20px; width: fit-content; max-width: 100%; flex-wrap: wrap; }
.catalog-tabs .pill-nav-item { white-space: normal; min-width: 0; }
.filter-tabs.catalog-category-filters { margin-bottom: 16px; max-width: 100%; flex-wrap: wrap; }
.catalog-category-filters .filter-tab { white-space: normal; overflow-wrap: anywhere; min-width: 0; }
#prodHeaderActions { flex-wrap: wrap; max-width: 100%; }
#prodHeaderActions .btn { min-width: 0; white-space: normal; }
#prodHeaderActions .btn span { min-width: 0; overflow-wrap: anywhere; }
#cohortModal .modal-body, #productModal .modal-body, #cartaoModal .modal-body { min-width: 0; }
#cohortModal .form-group, #productModal .form-group, #cartaoModal .form-group { min-width: 0; }
.cohort-wizard-progress { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 16px; }
.cohort-wizard-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.cohort-wizard-actions .btn { min-width: 0; white-space: normal; }
.cohort-wizard-actions .btn span { min-width: 0; overflow-wrap: anywhere; }
#cohortModal .modal-header .modal-title { min-width: 0; overflow-wrap: anywhere; }
#cohortModal .modal-header .btn-icon { flex-shrink: 0; }
.cohort-details { min-width: 0; border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin: 8px 0 12px; }
.cohort-details legend { max-width: 100%; font-size: 0.82rem; font-weight: 700; color: var(--text-muted); }
@media (max-width: 540px) {
  #cohortModal .form-row-2, #productModal .form-row-2, #cartaoModal .form-row-2 { grid-template-columns: minmax(0, 1fr); }
}

/* ─── CONTACT DIRECTORY AVATAR (Uiverse / Sightline Pattern) ─ */
.contact-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  flex-shrink: 0;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.contact-avatar.avatar-promoter {
  border-color: #22c55e;
  background: linear-gradient(135deg, #14532d 0%, #052e16 100%);
  color: #86efac;
}

.contact-avatar.avatar-lead {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #1e3a8a 0%, #172554 100%);
  color: #93c5fd;
}

.contact-avatar.avatar-customer {
  border-color: var(--brand-purple-light);
  background: linear-gradient(135deg, #2e1040 0%, #1a0824 100%);
  color: var(--brand-purple-light);
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.contact-name {
  font-size: 0.90rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  word-break: normal;
  overflow-wrap: break-word;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.contact-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
  word-break: normal;
  overflow-wrap: break-word;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

/* ─── KPI v3 ICON CONTAINER (used in productsView cohort/product dashboards) ─── */
.kpi-v3-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-v3-icon svg { width: 20px; height: 20px; }

.kpi-v3-icon.icon-blue   { background: #eff6ff; color: #2563eb; }
.kpi-v3-icon.icon-green  { background: var(--success-subtle); color: var(--success); }
.kpi-v3-icon.icon-amber  { background: var(--warning-subtle); color: var(--warning); }
.kpi-v3-icon.icon-red    { background: var(--danger-subtle); color: var(--danger); }
.kpi-v3-icon.icon-purple { background: #f5f3ff; color: #7c3aed; }
.kpi-v3-icon.icon-teal   { background: #f0fdfa; color: #0d9488; }
.kpi-v3-icon.icon-orange { background: #fff7ed; color: #c2410c; }

/* ─── CUSTOM STATUS DROPDOWN (No emojis, Lucide icons only) ──── */
.status-dropdown-wrap {
  position: relative;
  display: inline-block;
}

.status-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.status-badge-btn:hover {
  background: var(--surface-alt);
  border-color: var(--primary);
}
.status-badge-btn svg {
  width: 13px;
  height: 13px;
}

.status-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0,0,0,0.18);
  z-index: 1050;
  min-width: 200px;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
}

.status-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.status-dropdown-item:hover {
  background: var(--surface-alt);
}
.status-dropdown-item.active {
  background: var(--surface-alt);
  color: var(--primary);
  font-weight: 700;
}
.status-dropdown-item svg {
  width: 14px;
  height: 14px;
}
.status-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.status-dropdown-header {
  padding: 6px 12px 2px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* ─── DASHBOARD: Contactos Recentes ─────────────────────────────────────── */
.lead-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.05));
}
.lead-row:last-child { border-bottom: none; }
.lead-row:hover { background: var(--surface-alt); }

.lead-row-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #0a8a2c 100%);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.lead-row-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-row-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* TURMAS: Coluna Curso/Formação — sem truncagem */
.course-name-cell {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
  word-break: normal;
  overflow-wrap: break-word;
  white-space: normal;
  display: block;
  overflow: visible;
  text-overflow: unset;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
}

/* ═══════════════════════════════════════════════════════════════════════
   META ADS STYLE DATE RANGE PICKER (DARK THEME KHAROO)
   ═══════════════════════════════════════════════════════════════════════ */
.meta-date-picker-wrap {
  position: relative;
  display: inline-block;
}

/* ── Filtro de Segmento Comercial (B2C / B2B / Todos) ─────────────────── */
.segment-filter-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  box-shadow: var(--shadow-xs);
}
.segment-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 650;
  border-radius: calc(var(--radius-md) - 3px);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  white-space: nowrap;
}
.segment-filter-btn:hover {
  color: var(--text-main);
  background: var(--surface-alt);
}
.segment-filter-btn.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(110, 21, 155, 0.35);
}

/* ── Barra de Filtros Ativos ─────────────────────────────────────────── */
.active-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: -4px 0 14px;
  padding: 9px 16px;
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  font-size: 0.76rem;
}
.active-filter-label {
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.66rem;
  margin-right: 2px;
}
.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.active-filter-clear {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding: 4px 12px;
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 0.73rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  font-family: inherit;
}
.active-filter-clear:hover {
  background: var(--primary-border);
  color: var(--primary-hover);
}

.meta-date-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 14px;
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  box-shadow: var(--shadow-xs);
  user-select: none;
}

.meta-date-trigger-btn:hover {
  background: var(--surface-alt);
  border-color: var(--primary-light);
  color: #ffffff;
}

.meta-date-trigger-btn.active,
.meta-date-picker-wrap.is-open .meta-date-trigger-btn {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(110, 21, 155, 0.25);
}

.meta-date-icon {
  width: 15px;
  height: 15px;
  color: var(--primary-light);
  flex-shrink: 0;
}

.meta-date-label {
  white-space: nowrap;
}

.meta-date-arrow {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.meta-date-picker-wrap.is-open .meta-date-arrow {
  transform: rotate(180deg);
}

/* POPOVER DROPDOWN */
.meta-date-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 630px;
  max-width: 95vw;
  background: #141720;
  border: 1px solid #282f3d;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: metaPopoverIn 0.16s ease-out;
}

@keyframes metaPopoverIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.meta-date-body {
  display: flex;
  min-height: 350px;
}

/* COLUNA ESQUERDA: ATALHOS RÁPIDOS */
.meta-date-sidebar {
  width: 220px;
  border-right: 1px solid #242a38;
  padding: 12px 8px;
  background: #11131a;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 380px;
  flex-shrink: 0;
}

.meta-date-sidebar-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #798397;
  padding: 6px 12px 8px;
}

.meta-date-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-date-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: #bfc6d4;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.14s ease;
  font-family: inherit;
}

.meta-date-option:hover {
  background: #1e2330;
  color: #ffffff;
}

.meta-date-option.active {
  background: rgba(110, 21, 155, 0.22);
  color: #ffffff;
  font-weight: 700;
}

.meta-date-radio {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid #545c70;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.meta-date-option.active .meta-date-radio {
  border-color: #a855f7;
}

.meta-date-option.active .meta-date-radio::after {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a855f7;
}

/* COLUNA DIREITA: CALENDÁRIO */
.meta-date-calendar-pane {
  flex: 1;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  background: #141720;
}

.meta-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.meta-cal-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: capitalize;
}

.meta-cal-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #2b3242;
  background: #1b202c;
  color: #bfc6d4;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.14s;
}

.meta-cal-nav-btn:hover {
  background: #252c3d;
  color: #ffffff;
  border-color: #3d465c;
}

.meta-cal-nav-btn svg {
  width: 14px;
  height: 14px;
}

.meta-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.74rem;
  font-weight: 700;
  color: #727b8f;
  margin-bottom: 6px;
}

.meta-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 3px;
}

.meta-cal-day {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.81rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  color: #d1d6e0;
  position: relative;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}

.meta-cal-day:hover:not(.empty):not(.range-bound) {
  background: #262c3c;
  color: #ffffff;
}

.meta-cal-day.empty {
  color: #3e4556;
  cursor: default;
  pointer-events: none;
}

.meta-cal-day.today::before {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #a855f7;
}

.meta-cal-day.range-start {
  background: #0066f5 !important;
  color: #ffffff !important;
  font-weight: 700;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.meta-cal-day.range-end {
  background: #0066f5 !important;
  color: #ffffff !important;
  font-weight: 700;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.meta-cal-day.range-start.range-end {
  border-radius: 6px !important;
}

.meta-cal-day.in-range {
  background: rgba(0, 102, 245, 0.22) !important;
  color: #ffffff !important;
  border-radius: 0;
}

/* INPUTS MANUAIS DE DATA */
.meta-cal-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #232938;
}

.meta-cal-input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.meta-cal-input-label {
  font-size: 0.70rem;
  font-weight: 700;
  color: #798397;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.meta-cal-input {
  background: #11131a;
  border: 1px solid #282f3e;
  border-radius: 6px;
  padding: 6px 10px;
  color: #ffffff;
  font-size: 0.80rem;
  font-family: inherit;
  outline: none;
  width: 100%;
}

.meta-cal-input:focus {
  border-color: #a855f7;
}

/* FOOTER DO POPOVER */
.meta-date-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 20px;
  border-top: 1px solid #232938;
  background: #0f1117;
}

.meta-date-tz {
  font-size: 0.74rem;
  color: #727b8f;
}

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

/* ═══════════════════════════════════════════════════════════════════════
   KHAROO DARK THEME (Tema Escuro Oficial & Suporte a Sistema Windows/Mac)
   ═══════════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  /* Brand palette Kharoo no tema escuro */
  --brand-purple:        #8c22c5;
  --brand-purple-light:  #c374eb;
  --brand-purple-dark:   #6e159b;
  --brand-purple-hover:  #a83ee4;
  --brand-purple-glow:   rgba(168, 85, 247, 0.35);
  --brand-dark:          #f8fafc;
  --brand-dark-deep:     #090a0f;
  --brand-white:         #ffffff;
  --brand-gradient:      linear-gradient(135deg, #7c18af 0%, #b85fdf 100%);

  /* Primary interactive */
  --primary:             #9224cf;
  --primary-hover:       #a83ee4;
  --primary-light:       #c374eb;
  --primary-subtle:      rgba(146, 36, 207, 0.18);
  --primary-border:      rgba(195, 116, 235, 0.3);

  /* Semantic colours adaptadas para contraste em fundo escuro */
  --success:           #4ade80;
  --success-subtle:    rgba(74, 222, 128, 0.18);
  --warning:           #fbbf24;
  --warning-subtle:    rgba(251, 191, 36, 0.18);
  --danger:            #f87171;
  --danger-subtle:     rgba(248, 113, 113, 0.18);
  --info:              #22d3ee;
  --info-subtle:       rgba(34, 211, 238, 0.18);

  /* Neutral surface system (Dark) */
  --background:        #0c0e14;
  --surface:           #141721;
  --surface-alt:       #1a1e2b;
  --surface-hover:     #222838;

  /* Borders */
  --border:            #262c3c;
  --border-subtle:     #1d222f;
  --border-strong:     #343c50;

  /* Typography */
  --text-main:         #f8fafc;
  --text-secondary:    #cbd5e1;
  --text-muted:        #94a3b8;
  --text-dim:          #64748b;
  --text-inverse:      #0f172a;

  /* Shadows */
  --shadow-xs:  0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-sm:  0 1px 3px 0 rgba(0, 0, 0, 0.6), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
  --shadow-md:  0 4px 6px -1px rgba(0, 0, 0, 0.65), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.7), 0 4px 6px -4px rgba(0, 0, 0, 0.6);
  --shadow-xl:  0 20px 25px -5px rgba(0, 0, 0, 0.75), 0 8px 10px -6px rgba(0, 0, 0, 0.65);

  /* Sidebar no Dark */
  --sidebar-bg:        #10121a;
  --sidebar-border:    #222838;
  --sidebar-text:      #94a3b8;
  --sidebar-text-hover:#ffffff;
  --sidebar-active-bg: rgba(146, 36, 207, 0.22);
  --sidebar-active-text:#c374eb;

  color-scheme: dark;
}

/* Suporte automático ao Windows/Mac (system theme) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-purple:        #8c22c5;
    --brand-purple-light:  #c374eb;
    --brand-purple-dark:   #6e159b;
    --brand-purple-hover:  #a83ee4;
    --brand-purple-glow:   rgba(168, 85, 247, 0.35);
    --brand-dark:          #f8fafc;
    --brand-dark-deep:     #090a0f;
    --brand-white:         #ffffff;
    --brand-gradient:      linear-gradient(135deg, #7c18af 0%, #b85fdf 100%);

    --primary:             #9224cf;
    --primary-hover:       #a83ee4;
    --primary-light:       #c374eb;
    --primary-subtle:      rgba(146, 36, 207, 0.18);
    --primary-border:      rgba(195, 116, 235, 0.3);

    --success:           #4ade80;
    --success-subtle:    rgba(74, 222, 128, 0.18);
    --warning:           #fbbf24;
    --warning-subtle:    rgba(251, 191, 36, 0.18);
    --danger:            #f87171;
    --danger-subtle:     rgba(248, 113, 113, 0.18);
    --info:              #22d3ee;
    --info-subtle:       rgba(34, 211, 238, 0.18);

    --background:        #0c0e14;
    --surface:           #141721;
    --surface-alt:       #1a1e2b;
    --surface-hover:     #222838;

    --border:            #262c3c;
    --border-subtle:     #1d222f;
    --border-strong:     #343c50;

    --text-main:         #f8fafc;
    --text-secondary:    #cbd5e1;
    --text-muted:        #94a3b8;
    --text-dim:          #64748b;
    --text-inverse:      #0f172a;

    --shadow-xs:  0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-sm:  0 1px 3px 0 rgba(0, 0, 0, 0.6), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
    --shadow-md:  0 4px 6px -1px rgba(0, 0, 0, 0.65), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.7), 0 4px 6px -4px rgba(0, 0, 0, 0.6);
    --shadow-xl:  0 20px 25px -5px rgba(0, 0, 0, 0.75), 0 8px 10px -6px rgba(0, 0, 0, 0.65);

    --sidebar-bg:        #10121a;
    --sidebar-border:    #222838;
    --sidebar-text:      #94a3b8;
    --sidebar-text-hover:#ffffff;
    --sidebar-active-bg: rgba(146, 36, 207, 0.22);
    --sidebar-active-text:#c374eb;

    color-scheme: dark;
  }
}

/* Ajustes de elementos no Dark Theme */
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
  background-color: var(--surface-alt);
  border-color: var(--border);
  color: var(--text-main);
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-textarea:focus {
  border-color: var(--primary);
  background-color: #1c2130;
}

[data-theme="dark"] .card {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .modal-card {
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
}

[data-theme="dark"] .drawer-content {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .topbar {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #343c50;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #4a5570;
}

/* SELETOR DE TEMAS NAS DEFINIÇÕES / PERFIL */
.theme-selector-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.theme-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.theme-option-btn:hover {
  background: var(--surface-alt);
  border-color: var(--primary-light);
  color: var(--text-main);
}

.theme-option-btn.active {
  border-color: var(--primary);
  background: var(--primary-subtle);
  color: var(--primary-light);
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--primary-border);
}

.theme-option-btn svg {
  width: 20px;
  height: 20px;
}

/* ÍCONE DE TEMA DINÂMICO NA TOPBAR */
.theme-toggle-btn {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--surface-alt);
  color: var(--text-main);
  border-color: var(--primary-light);
}

[data-theme="dark"] .theme-icon-sun { display: inline-block; }
[data-theme="dark"] .theme-icon-moon { display: none; }
:root:not([data-theme="dark"]) .theme-icon-sun { display: none; }
:root:not([data-theme="dark"]) .theme-icon-moon { display: inline-block; }

/* ═══════════════════════════════════════════════════════════════════════
   META ADS DUAL-MONTH CALENDAR (2 MESES LADO A LADO)
   ═══════════════════════════════════════════════════════════════════════ */
.meta-date-picker-wrap {
  position: relative;
  display: inline-block;
  z-index: 50;
}

.meta-date-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 780px !important;
  max-width: 95vw;
  background: #141720 !important;
  border: 1px solid #2e3546 !important;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 4px 16px rgba(0, 0, 0, 0.45);
  z-index: 9999 !important;
  display: flex;
  flex-direction: column;
  overflow: visible !important;
  animation: metaPopoverIn 0.16s ease-out;
}

.meta-dual-calendar-wrap {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
}

.meta-cal-month-col {
  flex: 1;
  min-width: 0;
}


/* ═══════════════════════════════════════════════════════════════════════
   SIDEBAR SLACK-STYLE: RAIL + SUB-PANEL
   ═══════════════════════════════════════════════════════════════════════ */

/* Wrapper que contém o rail + sub-painel */
.sidebar-shell {
  display: flex;
  flex-direction: row;
  height: 100%;
  flex-shrink: 0;
}

/* Rail (coluna de ícones, 56px) — visível sempre */
.sidebar-rail {
  width: 56px;
  min-width: 56px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 2px;
  z-index: 41;
  flex-shrink: 0;
}

.sidebar-rail-logo {
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-rail-logo img {
  width: 28px;
  height: auto;
  object-fit: contain;
}

.rail-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
  border: none;
  background: transparent;
  flex-shrink: 0;
}

.rail-icon-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--sidebar-text-hover);
}

.rail-icon-btn.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.rail-icon-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.rail-icon-btn .rail-tooltip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #1a1e2b;
  color: #f8fafc;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 900;
  border: 1px solid #343c50;
  box-shadow: var(--shadow-md);
}

.rail-icon-btn:hover .rail-tooltip {
  opacity: 1;
}

.rail-spacer { flex: 1; }

.rail-divider {
  width: 28px;
  height: 1px;
  background: var(--sidebar-border);
  margin: 4px 0;
}

/* Sub-painel (expande/colapsa) */
.sidebar-sub-panel {
  width: 200px;
  min-width: 200px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.22s cubic-bezier(0.4,0,0.2,1), min-width 0.22s cubic-bezier(0.4,0,0.2,1), opacity 0.18s;
  opacity: 1;
  flex-shrink: 0;
}

.sidebar-sub-panel.collapsed {
  width: 0;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
}

.sub-panel-header {
  padding: 14px 14px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sub-panel-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-panel-back {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  border: none;
  background: transparent;
  flex-shrink: 0;
}

.sub-panel-back:hover {
  background: rgba(255,255,255,0.08);
  color: var(--sidebar-text-hover);
}

.sub-panel-back svg { width: 14px; height: 14px; }

.sub-panel-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
}

.sub-nav-section-title {
  padding: 10px 8px 3px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}

.sub-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

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

.sub-nav-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.8;
}

.sub-nav-item:hover svg, .sub-nav-item.active svg { opacity: 1; }

.sub-panel-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

/* Tenant bloco no sub-painel footer */
.sub-panel-tenant {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sub-panel-tenant:hover { background: rgba(255,255,255,0.05); }

.sub-panel-tenant-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #c9d1d9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.sub-panel-tenant-meta {
  font-size: 0.7rem;
  color: var(--sidebar-text);
}

/* User footer no sub-painel */
.sub-panel-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

/* Compat: oculta a sidebar antiga quando o shell existe */
.sidebar-shell ~ .sidebar,
.sidebar-shell + .sidebar {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════
   SUB-NAV ACCORDION & HIERARCHICAL SUBCATEGORIES (SLACK PATTERN)
   ═══════════════════════════════════════════════════════════════════════ */
.sub-nav-item.has-children {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  cursor: pointer;
}

.sub-nav-item-left {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-nav-chevron {
  width: 14px;
  height: 14px;
  opacity: 0.6;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
  flex-shrink: 0;
}

.sub-nav-item.has-children.expanded .sub-nav-chevron {
  transform: rotate(180deg);
  opacity: 1;
}

/* Container de Subcategorias (Verticais com Recuo e Guia Lateral) */
.sub-nav-children {
  margin: 2px 0 6px 14px;
  padding-left: 10px;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
  display: none;
  flex-direction: column;
  gap: 1px;
}

[data-theme="dark"] .sub-nav-children {
  border-left-color: rgba(255, 255, 255, 0.12);
}

:root:not([data-theme="dark"]) .sub-nav-children {
  border-left-color: rgba(0, 0, 0, 0.1);
}

.sub-nav-children.expanded {
  display: flex;
  animation: subNavExpand 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes subNavExpand {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.sub-nav-child-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.79rem;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

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

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

.sub-nav-child-item svg {
  width: 13px;
  height: 13px;
  opacity: 0.75;
  flex-shrink: 0;
}

.sub-nav-child-item:hover svg,
.sub-nav-child-item.active svg {
  opacity: 1;
}

.sub-nav-child-item .child-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sidebar-text);
  opacity: 0.5;
  flex-shrink: 0;
}

.sub-nav-child-item.active .child-dot {
  background: var(--primary);
  opacity: 1;
}


/* ─── KANBAN & BADGES DARK THEME ADAPTATIONS ──────────────── */
[data-theme="dark"] .kanban-column {
  background: var(--surface-alt);
  border-color: var(--border);
}
[data-theme="dark"] .kanban-col-header {
  border-bottom-color: var(--border);
}
[data-theme="dark"] .kanban-col-count {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}
[data-theme="dark"] .kanban-card {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  color: var(--text-main);
}
[data-theme="dark"] .kanban-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
[data-theme="dark"] .kanban-add-card-btn {
  border-color: var(--border);
  color: var(--text-muted);
}
[data-theme="dark"] .kanban-add-card-btn:hover {
  background: var(--surface);
  color: var(--primary-light);
  border-color: var(--primary);
}
[data-theme="dark"] .kanban-inline-composer {
  background: var(--surface);
  border-color: var(--border-strong);
}
[data-theme="dark"] .kanban-add-stage-col {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border);
}
[data-theme="dark"] .kanban-add-stage-col:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
}
[data-theme="dark"] .search-box kbd {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--text-muted);
}
[data-theme="dark"] .badge-purple {
  background: rgba(168, 85, 247, 0.18);
  color: #d8b4fe;
}
[data-theme="dark"] .badge-lead {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}
[data-theme="dark"] .badge-prospect {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
}
[data-theme="dark"] .badge-inactive {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
}
[data-theme="dark"] .badge-hot {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
[data-theme="dark"] .badge-warm {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
}
[data-theme="dark"] .badge-cold {
  background: rgba(14, 165, 233, 0.2);
  color: #7dd3fc;
}
[data-theme="dark"] .badge-sla {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
}
[data-theme="dark"] .badge-orange {
  background: rgba(249, 115, 22, 0.2);
  color: #fdba74;
}
[data-theme="dark"] .badge-info {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
}
[data-theme="dark"] .empty-state {
  background: var(--surface);
  border-color: var(--border);
}
