/* ============================================
   BLUE CONTABILIDADE · CRM
   Design System & Styles
   ============================================ */

:root {
  /* ============================================
     BLUE CONTABILIDADE · DESIGN TOKENS v1.2
     primary-blue: #165BFF (anexo 3)
     ============================================ */

  /* Primary · azul principal (anexo 3) */
  --primary-blue:       #165BFF;
  --primary-blue-dark:  #0044D6;   /* -15% L */
  --primary-blue-light: #4D80FF;   /* +16% L */
  --primary-blue-soft:  #E5EDFF;   /* bg claro */
  --primary-blue-deep:  #002F8A;   /* gradiente escuro p/ time tracker */

  /* Variações de azul (escala completa) */
  --blue-50:  #E5EDFF;
  --blue-100: #C8D6FF;
  --blue-200: #9CB3FF;
  --blue-300: #6E8FFF;
  --blue-400: #4D80FF;
  --blue-500: #2F6BFF;
  --blue-600: #165BFF;
  --blue-700: #0044D6;
  --blue-800: #0033A8;
  --blue-900: #002F8A;

  /* Surfaces */
  --surface-bg:   #F7F8FA;
  --card-bg:      #FFFFFF;
  --bg-page:      #F7F8FA;

  /* Texto */
  --text-primary: #1F2D3D;
  --text-secondary: #334155;
  --muted-text:   #6B7885;

  /* Neutros (complementares) */
  --gray-50:  #F7F8FA;
  --gray-100: #F1F4F8;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #6B7885;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;

  /* Estados (semânticos) */
  --success:        #2FB56A;
  --success-soft:   #E6F7EE;
  --warning:        #F0A500;
  --warning-soft:   #FEF6E0;
  --error:          #E14C4C;
  --error-soft:     #FDECEC;

  /* Compatibilidade com tokens antigos */
  --green-50:  #E6F7EE;
  --green-500: #2FB56A;
  --green-600: #1F9857;
  --amber-50:  #FEF6E0;
  --amber-500: #F0A500;
  --amber-600: #C98A00;
  --red-50:    #FDECEC;
  --red-500:   #E14C4C;
  --red-600:   #C73838;
  --purple-50: #E5EDFF;
  --purple-500: #4D80FF;
  --purple-600: #2F6BFF;

  /* Gradientes */
  --grad-blue:       linear-gradient(135deg, #165BFF 0%, #0044D6 100%);
  --grad-blue-soft:  linear-gradient(135deg, #4D80FF 0%, #165BFF 100%);
  --grad-blue-light: linear-gradient(135deg, #E5EDFF 0%, #C8D6FF 100%);
  --grad-progress:   linear-gradient(90deg,  #165BFF 0%, #0044D6 100%);
  --grad-tracker:    linear-gradient(135deg, #002F8A 0%, #165BFF 100%);

  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-md: 0 2px 4px -1px rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 4px 10px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 40px -10px rgba(15, 23, 42, 0.12);
  --shadow-card: 0 6px 18px rgba(31, 45, 61, 0.06);
  --shadow-blue: 0 8px 20px -4px rgba(22, 91, 255, 0.35);

  /* Focus ring */
  --focus-ring: 0 0 0 3px rgba(22, 91, 255, 0.18);

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h:  76px;

  /* Espaçamentos */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;

  /* Radius */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* Tipografia */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --h1: 32px;
  --h2: 24px;
  --h3: 18px;
  --body: 14px;
  --small: 12px;
}

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

/* Utilidade: conteúdo visível apenas para leitores de tela */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.5;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* Lucide substitui o <i data-lucide> por <svg class="lucide"> */
i[data-lucide],
svg.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
  vertical-align: middle;
}

svg.lucide.lg { width: 22px; height: 22px; }

/* ============================================
   APP LAYOUT
   ============================================ */
.app {
  display: flex;
  min-height: 100vh;
  background: var(--gray-50);
}

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  padding: 28px 32px 48px;
  flex: 1;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #ffffff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 24px;
  border-bottom: 1px solid var(--gray-100);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--grad-blue);
  display: grid;
  place-items: center;
  color: white;
  box-shadow: var(--shadow-blue);
}

.brand-logo i[data-lucide],
.brand-logo svg.lucide {
  width: 22px;
  height: 22px;
  color: white;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--blue-700);
  letter-spacing: -0.4px;
}

.brand-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 16px;
  overflow-y: auto;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-400);
  padding: 8px 12px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--gray-600);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 2px;
  transition: all 0.15s ease;
  position: relative;
}

.nav-item i[data-lucide], .nav-item svg.lucide { color: var(--gray-400); transition: color 0.15s ease; }
.nav-item span:first-of-type { flex: 1; }

.nav-item:hover {
  background: var(--gray-50);
  color: var(--gray-800);
}

.nav-item:hover i[data-lucide], .nav-item:hover svg.lucide { color: var(--blue-600); }

.nav-item.active {
  background: var(--blue-50);
  color: var(--blue-700);
  font-weight: 600;
}

.nav-item.active i[data-lucide], .nav-item.active svg.lucide { color: var(--blue-600); }

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--blue-600);
  border-radius: 0 4px 4px 0;
}

.nav-badge {
  background: var(--red-50);
  color: var(--red-600);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--gray-100);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--gray-50);
  transition: background 0.15s;
}

.user-card:hover { background: var(--gray-100); }

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--grad-blue);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

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

.user-action {
  background: transparent;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: all 0.15s;
}
.user-action:hover { color: var(--red-500); background: var(--red-50); }

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-200);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  gap: 24px;
  z-index: 30;
}

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

.topbar-center { flex: 1; max-width: 480px; }

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--muted-text);
  margin-top: 4px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--gray-600);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}

.icon-btn {
  transition: all 0.18s ease;
}
.icon-btn:hover {
  background: rgba(22, 91, 255, 0.08);
  color: var(--primary-blue);
  border-color: rgba(22, 91, 255, 0.18);
}

.icon-btn.small {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
}

.icon-btn.small:hover { background: var(--gray-100); }

.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 8px;
  height: 8px;
  background: var(--red-500);
  border-radius: 50%;
  border: 2px solid white;
}

.search-box {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0 14px;
  height: 44px;
  transition: all 0.18s ease;
}

.search-box:focus-within {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 4px rgba(22, 91, 255, 0.10);
}

.search-box i { color: var(--muted-text); }

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text-primary);
}

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

.search-box kbd {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  padding: 3px 6px;
}

.search-box.small {
  height: 40px;
  max-width: 320px;
  background: white;
  border-color: rgba(34, 47, 90, 0.08);
  border-radius: 12px;
}
.search-box.small input {
  font-size: 14px;
}
.search-box.small input::placeholder {
  font-size: 14px;
  color: #9CA3AF;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--grad-blue);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0 18px;
  height: 42px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-blue);
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -4px rgba(37, 99, 235, 0.45);
}

.btn-primary.small {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  border-radius: 10px;
  padding: 0 16px;
  height: 40px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { background: var(--gray-50); color: var(--gray-800); }

/* Botão secundário · outline primary-blue */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--primary-blue);
  border: 1.5px solid var(--primary-blue);
  border-radius: var(--radius);
  padding: 0 18px;
  height: 42px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.btn-secondary:hover {
  background: rgba(22, 91, 255, 0.08);
  transform: translateY(-1px);
}

/* ============================================
   PAGES
   ============================================ */
.page { display: none; animation: fadeUp 0.3s ease; }
.page.active { display: block; }

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

/* ============================================
   HOME · MÓDULOS (grid dinâmico)
   ============================================ */
#page-home {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.home-hero {
  background: var(--grad-blue);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  color: white;
  position: relative;
  overflow: hidden;
  margin-bottom: 32px;
  box-shadow: var(--shadow-blue);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}

.home-hero-content {
  flex: 1;
  min-width: 240px;
}

.home-hero-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.6px;
  margin-bottom: 8px;
}

.home-hero-sub {
  font-size: 15px;
  opacity: 0.9;
  line-height: 1.5;
}

.home-hero-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  padding: 0 14px;
  height: 48px;
  min-width: 260px;
  backdrop-filter: blur(4px);
  transition: background 0.18s, border-color 0.18s;
}
.home-hero-search:focus-within {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.5);
}
.home-hero-search i { color: rgba(255, 255, 255, 0.7); flex-shrink: 0; }
.home-hero-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: white;
  font-size: 14px;
  font-family: inherit;
}
.home-hero-search input::placeholder { color: rgba(255, 255, 255, 0.6); }
.home-hero-search kbd {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  padding: 3px 6px;
}

.home-main {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.home-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.home-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted-text);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
}
.home-section-title i { width: 16px; height: 16px; color: var(--primary-blue); }

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.home-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.home-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-blue);
}
.home-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--primary-blue);
}

.home-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--primary-blue-soft);
  color: var(--primary-blue);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.18s, color 0.18s;
}
.home-card:hover .home-card-icon {
  background: var(--primary-blue);
  color: white;
}
.home-card-icon i { width: 20px; height: 20px; }

.home-card-body {
  flex: 1;
  min-width: 0;
}

.home-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.home-card-desc {
  font-size: 12px;
  color: var(--muted-text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-card-action {
  flex-shrink: 0;
  color: var(--gray-300);
  transition: color 0.18s, transform 0.18s;
  margin-top: 2px;
}
.home-card:hover .home-card-action {
  color: var(--primary-blue);
  transform: translateX(2px);
}
.home-card-action i { width: 16px; height: 16px; }

.home-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted-text);
}
.home-empty i { width: 40px; height: 40px; color: var(--gray-300); margin-bottom: 12px; }
.home-empty p { font-size: 14px; }
.home-empty strong { color: var(--text-primary); }

/* Responsivo */
@media (max-width: 1280px) {
  .home-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-hero { flex-direction: column; align-items: stretch; text-align: center; padding: 28px 24px; }
  .home-hero-search { min-width: 0; }
}

/* ============================================
   CARD
   ============================================ */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card + .card,
.two-col + .card { margin-top: 20px; }

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

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.2px;
}

.card-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

.link-btn {
  background: transparent;
  border: none;
  color: var(--blue-600);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.link-btn:hover { color: var(--blue-700); }
.link-btn i[data-lucide], .link-btn svg.lucide { width: 14px; height: 14px; }

/* ============================================
   AGENDA & CLIENT LISTS
   ============================================ */
.agenda-list, .client-list, .team-list, .event-list, .toggle-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agenda-item, .client-row, .team-item, .event-item, .toggle-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 10px;
  transition: background 0.15s;
}

.agenda-item:hover, .client-row:hover, .team-item:hover, .event-item:hover {
  background: var(--gray-50);
}

.agenda-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 8px;
  background: var(--blue-50);
  border-radius: 8px;
  flex-shrink: 0;
}

.agenda-time strong {
  font-size: 15px;
  color: var(--blue-700);
  font-weight: 700;
}

.agenda-time span {
  font-size: 10px;
  color: var(--blue-600);
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 2px;
}

.agenda-content { flex: 1; min-width: 0; }
.agenda-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 3px;
}
.agenda-meta { font-size: 12px; color: var(--gray-500); }

/* Tags */
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.tag-blue   { background: var(--blue-50);   color: var(--blue-700); }
.tag-amber  { background: var(--amber-50);  color: var(--amber-600); }
.tag-green  { background: var(--green-50);  color: var(--green-600); }
.tag-red    { background: var(--red-50);    color: var(--red-600); }
.tag-purple { background: var(--purple-50); color: var(--purple-600); }

/* Status */
.status {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.status-active { background: var(--green-50);  color: var(--green-600); }
.status-impl   { background: var(--blue-50);   color: var(--blue-700); }
.status-late   { background: var(--red-50);    color: var(--red-600); }
.status-warn   { background: var(--amber-50);  color: var(--amber-600); }

/* Pills de status (cards de Clientes): limpa, sem bolinha lateral */
.client-card-head .status,
.client-card .status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.1px;
  white-space: nowrap;
  flex-shrink: 0;
}
.client-card-head .status::before,
.client-card .status::before {
  display: none !important;
}

/* Avatars */
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
}
.avatar.lg { width: 52px; height: 52px; font-size: 16px; }
.avatar-blue   { background: #2F6BFF; }
.avatar-green  { background: #10B981; }
.avatar-amber  { background: #F59E0B; }
.avatar-red    { background: #EF4444; }
.avatar-purple { background: #A855F7; }

.client-meta { flex: 1; min-width: 0; }
.client-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 2px;
}
.client-cnpj { font-size: 12px; color: var(--gray-500); }

/* ============================================
   DASHBOARD
   ============================================ */
.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  cursor: default;
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-blue-soft);
}

.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.metric-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
}

.metric-ico {
  color: var(--primary-blue);
  width: 18px;
  height: 18px;
}

.metric-value {
  font-size: 36px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -1.2px;
  line-height: 1;
  margin-bottom: 10px;
}

.metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
}
.metric-trend i { width: 13px; height: 13px; }
.metric-trend.up { color: var(--success); }
.metric-trend.down { color: var(--error); }

.metric-bar {
  height: 8px;
  background: var(--surface-bg);
  border-radius: var(--radius-pill);
  margin-top: 16px;
  overflow: hidden;
  position: relative;
}
.metric-bar > span {
  display: block;
  height: 100%;
  background: var(--grad-progress);
  border-radius: var(--radius-pill);
  width: 0;
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.metric-bar.animated > span { /* setado por JS ao entrar em viewport */ }

/* Estado destacado do gauge (cor primária) */
.metric-card.highlight {
  background: var(--grad-blue);
  color: white;
  border-color: transparent;
}
.metric-card.highlight .metric-label { color: rgba(255,255,255,0.85); }
.metric-card.highlight .metric-value { color: white; }
.metric-card.highlight .metric-trend   { color: rgba(255,255,255,0.92); }
.metric-card.highlight .metric-ico     { color: white; }
.metric-card.highlight .metric-bar { background: rgba(255,255,255,0.18); }
.metric-card.highlight .metric-bar > span { background: linear-gradient(90deg, #ffffff 0%, #C8D6FF 100%); }

/* Gauge */
.gauge-card { display: flex; flex-direction: column; }
.gauge-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 8px auto 12px;
}

.gauge {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: var(--gray-100);
  stroke-width: 10;
}

.gauge-fg {
  fill: none;
  stroke: var(--primary-blue);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 314.16;
  stroke-dashoffset: 12.56;
}

.gauge-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.gauge-text strong {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.8px;
}

.gauge-text span {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 500;
}

/* Charts */
.chart-card .card-header { margin-bottom: 16px; }
.chart-wrap { height: 260px; position: relative; }
.chart-wrap.small { height: 220px; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--gray-600);
  font-weight: 500;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}

/* Table */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gray-500);
  padding: 12px 12px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.data-table th:first-child { border-radius: 8px 0 0 8px; }
.data-table th:last-child  { border-radius: 0 8px 8px 0; }

.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--gray-50); }

.task-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  color: var(--gray-800);
}

.task-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-mini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-700);
}

.avatar-mini {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--grad-blue);
  color: white;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
}

/* ============================================
   FILTROS (CLIENTES)
   ============================================ */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-50);
  border: 1px solid transparent;
  color: var(--gray-600);
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.chip span {
  background: rgba(34, 47, 90, 0.06);
  color: #4B5563;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
}

.chip:hover { background: var(--gray-100); }
.chip.active {
  background: var(--blue-600);
  color: white;
  border-color: var(--blue-600);
}
.chip.active span { background: rgba(255,255,255,0.25); color: white; }
.chip:focus-visible { outline: 2px dotted #2B6EF6; outline-offset: 2px; }

.filters-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--blue-300); color: var(--blue-600); }
.filter-btn i[data-lucide]:first-child, .filter-btn svg.lucide:first-of-type { width: 14px; height: 14px; }
.filter-btn i[data-lucide]:last-child, .filter-btn svg.lucide:last-of-type { width: 14px; height: 14px; color: var(--gray-400); }

.view-toggle {
  display: flex;
  background: var(--gray-100);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.vt-btn {
  background: transparent;
  border: none;
  color: var(--gray-500);
  width: 34px;
  height: 32px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s;
}

.vt-btn:hover { color: var(--gray-800); }
.vt-btn.active {
  background: white;
  color: var(--blue-600);
  box-shadow: var(--shadow-sm);
}

.vt-btn i[data-lucide], .vt-btn svg.lucide { width: 16px; height: 16px; }

/* Service filter dropdown */
.filter-dropdown-wrap { position: relative; }
.filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
  flex-direction: column;
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
}
.filter-dropdown.open { display: flex; }
.filter-dropdown-item {
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.filter-dropdown-item:hover { background: var(--primary-blue-soft); color: var(--primary-blue); }
.filter-dropdown-item[data-svc="all"] { font-weight: 600; border-bottom: 1px solid var(--gray-100); margin-bottom: 2px; }

/* Active filter badge */
.active-filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-blue-soft);
  color: var(--primary-blue);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.filter-badge-x {
  background: transparent;
  border: none;
  color: var(--primary-blue);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
}
.filter-badge-x:hover { opacity: 1; }

/* Summary text */
.summary-text { font-size: 13px; color: var(--muted-text); margin-bottom: 16px; }

/* Service overflow badge on card */
.svc-overflow {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary-blue);
  margin-left: 2px;
}

/* Service remove X button */
.svc-remove-x {
  display: none;
}
/* svc-remove-x hidden on cards — only visible in sidebar/edit */

.client-card-svc-val { display: flex; flex-wrap: wrap; gap: 3px; justify-content: flex-end; min-width: 0; }

/* Toast undo button */
.toast-undo {
  background: transparent;
  border: none;
  color: white;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin-left: 6px;
  font-size: inherit;
}

/* Client Grid */
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

/* Client Grid — list view */
.client-grid.client-grid-list {
  grid-template-columns: 1fr;
  gap: 8px;
}
.client-grid.client-grid-list .client-card {
  flex-direction: row;
  align-items: center;
  padding: 14px 20px;
  gap: 16px;
}
.client-grid.client-grid-list .client-card-head {
  flex: 0 0 auto;
  min-width: 220px;
}
.client-grid.client-grid-list .client-card-meta {
  flex: 1;
  border-top: none;
  margin-top: 0;
  padding: 0;
  flex-direction: row;
  gap: 24px;
}
.client-grid.client-grid-list .client-card-meta .row {
  flex: 0 0 auto;
}
.client-grid.client-grid-list .client-card-foot {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.client-card {
  background: #FFFFFF;
  border: 1px solid rgba(34, 47, 90, 0.06);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 6px 18px rgba(22, 27, 40, 0.06);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}

.client-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(22, 27, 40, 0.10);
  border-color: rgba(34, 47, 90, 0.10);
}

.client-card:focus-visible {
  outline: 2px dotted #2B6EF6;
  outline-offset: 3px;
}

.client-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-card-head .avatar {
  width: 48px;
  height: 48px;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
  background-image: none; /* sobrescreve gradient da .avatar base */
}

.client-card-info { flex: 1; min-width: 0; }
.client-card-name {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}
.client-card-cnpj {
  font-size: 13px;
  color: #6B7280;
  font-variant-numeric: tabular-nums;
}

.client-card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0 0;
  border-top: 1px dashed rgba(34, 47, 90, 0.10);
  margin-top: 0;
}

.client-card-meta .row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 13px;
  gap: 12px;
  min-width: 0;
}

.client-card-meta .row .lbl { color: #6B7280; font-weight: 400; flex-shrink: 0; }
.client-card-meta .row .val { color: #111827; font-weight: 600; text-align: right; min-width: 0; }

.client-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 4px;
}

.client-card-actions {
  display: flex;
  gap: 6px;
}

.client-card-actions .icon-btn {
  width: 32px;
  height: 32px;
  background: rgba(34, 47, 90, 0.03);
  border: 1px solid transparent;
  border-radius: 8px;
  color: #4B5563;
  transition: all 0.18s ease;
}
.client-card-actions .icon-btn:hover {
  background: rgba(34, 47, 90, 0.08);
  color: #111827;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(22, 27, 40, 0.06);
}
.client-card-actions .icon-btn:focus-visible {
  outline: 2px dotted #2B6EF6;
  outline-offset: 2px;
}
.client-card-actions .icon-btn i[data-lucide],
.client-card-actions .icon-btn svg.lucide { width: 14px; height: 14px; }

.client-card .open-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #2B6EF6;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
.client-card .open-link:hover {
  background: rgba(43, 110, 246, 0.08);
  color: #1E54D6;
}
.client-card .open-link i[data-lucide],
.client-card .open-link svg.lucide { width: 14px; height: 14px; }

/* ============================================
   CALENDAR
   ============================================ */
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 8px;
  min-width: 160px;
  text-align: center;
}

.cal-views { display: flex; gap: 12px; align-items: center; }

.seg-control {
  display: inline-flex;
  background: var(--gray-100);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.seg {
  background: transparent;
  border: none;
  color: var(--gray-500);
  padding: 6px 14px;
  border-radius: 7px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.seg:hover { color: var(--gray-800); }
.seg.active {
  background: var(--primary-blue);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  font-size: 12px;
  color: var(--gray-600);
  font-weight: 500;
}

.cal-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}

.cal-card { padding: 0; overflow: hidden; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.cal-weekdays span {
  padding: 12px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gray-500);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day {
  min-height: 100px;
  border-right: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  padding: 8px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}

.cal-day:nth-child(7n) { border-right: none; }

.cal-day:hover { background: var(--blue-50); }

.cal-day.other-month { background: var(--gray-50); }
.cal-day.other-month .cal-day-num { color: var(--gray-300); }

.cal-day.today .cal-day-num {
  background: var(--blue-600);
  color: white;
}

.cal-day-num {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.cal-event {
  display: block;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

/* -- Week view -- */
.cal-grid-week { display: flex; flex-direction: column; overflow: auto; max-height: 600px; }
.cal-week-header { display: flex; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); position: sticky; top: 0; z-index: 1; }
.cal-week-day-head { flex: 1; padding: 10px 4px; text-align: center; font-size: 12px; font-weight: 700; color: var(--gray-600); border-right: 1px solid var(--gray-100); }
.cal-week-day-head.today { color: var(--blue-600); }
.cal-week-day-head:last-child { border-right: none; }
.cal-week-body { display: flex; flex-direction: column; }
.cal-week-row { display: flex; border-bottom: 1px solid var(--gray-100); min-height: 48px; }
.cal-week-time-gutter { width: 60px; min-width: 60px; padding: 6px 8px; text-align: right; font-size: 11px; font-weight: 600; color: var(--gray-500); border-right: 1px solid var(--gray-100); }
.cal-week-cell { flex: 1; padding: 4px; border-right: 1px solid var(--gray-100); cursor: pointer; min-height: 48px; }
.cal-week-cell:last-child { border-right: none; }
.cal-week-cell:hover { background: var(--blue-50); }
.cal-event-week, .cal-event-day { display: inline-block; font-size: 11px; padding: 2px 6px; margin: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; user-select: none; -webkit-user-select: none; cursor: pointer; }

/* -- Day view -- */
.cal-grid-day { display: flex; flex-direction: column; overflow: auto; max-height: 600px; }
.cal-day-header { padding: 12px 16px; font-size: 15px; font-weight: 700; color: var(--gray-800); border-bottom: 1px solid var(--gray-200); background: var(--gray-50); position: sticky; top: 0; z-index: 1; }
.cal-day-body { display: flex; flex-direction: column; }
.cal-day-row { display: flex; border-bottom: 1px solid var(--gray-100); min-height: 48px; }

/* Dark mode — week/day */
.theme-dark .cal-weekdays { background: var(--gray-900); border-color: var(--gray-600); }
.theme-dark .cal-week-day-head { color: var(--gray-400); border-color: var(--gray-600); }
.theme-dark .cal-week-day-head.today { color: var(--blue-400); }
.theme-dark .cal-week-header { background: var(--gray-900); border-color: var(--gray-600); }
.theme-dark .cal-week-time-gutter { color: var(--gray-400); border-color: var(--gray-600); }
.theme-dark .cal-week-cell { border-color: var(--gray-600); }
.theme-dark .cal-week-cell:hover { background: var(--gray-800); }
.theme-dark .cal-day-header { background: var(--gray-900); color: var(--gray-200); border-color: var(--gray-600); }

/* ============================================
   COMPACT EVENT POPUP
   ============================================ */
.cal-event-popup {
  position: fixed; z-index: 300;
  background: var(--card-bg); border: 1px solid var(--gray-200);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 280px; max-width: 360px;
  padding: 0; outline: none;
}
.cal-event-popup[hidden] { display: none; }
.cal-event-popup-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px 8px; border-bottom: 1px solid var(--gray-100);
}
.cal-event-popup-color {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.cal-event-popup-head h4 {
  flex: 1; margin: 0; font-size: 14px; font-weight: 700;
  color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-event-popup-actions { display: flex; gap: 2px; flex-shrink: 0; }
.cal-event-popup-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cal-popup-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}
.cal-popup-info-row i {
  width: 15px;
  height: 15px;
  color: var(--muted-text);
  flex-shrink: 0;
}
.cal-popup-info-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-popup-info-row strong {
  color: var(--text-primary);
  font-weight: 600;
}
.cal-popup-info-row span span {
  color: var(--muted-text);
  font-size: 12px;
  margin-left: 4px;
}
.theme-dark .cal-event-popup { border-color: var(--gray-600); background: var(--gray-800); }
.theme-dark .cal-event-popup-head { border-color: var(--gray-600); }

/* Lead edit popup */
.cal-lead-popup { max-width: 320px; }
.cal-lead-field { display: flex; flex-direction: column; gap: 3px; }
.cal-lead-field label { font-size: 11px; font-weight: 600; color: var(--muted-text); text-transform: uppercase; letter-spacing: 0.3px; }
.cal-lead-field input,
.cal-lead-field select,
.cal-lead-field textarea {
  padding: 6px 8px; border: 1px solid var(--gray-200); border-radius: 6px;
  font-size: 13px; color: var(--text-primary); background: var(--card-bg);
  outline: none; transition: border-color 0.15s;
}
.cal-lead-field input:focus,
.cal-lead-field select:focus,
.cal-lead-field textarea:focus { border-color: var(--accent); }
.cal-lead-field textarea { resize: vertical; min-height: 36px; }
.theme-dark .cal-lead-field input,
.theme-dark .cal-lead-field select,
.theme-dark .cal-lead-field textarea {
  border-color: var(--gray-600); background: var(--gray-700); color: var(--text-primary);
}

/* Popup services chips */
.cal-popup-services {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--gray-100);
}
.cal-popup-svc-chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary-blue);
  background: var(--primary-blue-soft);
  white-space: nowrap;
  cursor: default;
  transition: background 0.15s;
}
.cal-popup-svc-chip:hover {
  background: var(--blue-100);
}
.theme-dark .cal-popup-svc-chip {
  color: var(--blue-300);
  background: rgba(22,91,255,0.15);
}
.theme-dark .cal-popup-svc-chip:hover {
  background: rgba(22,91,255,0.25);
}

/* Event list */
.event-item .event-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 56px;
  background: var(--blue-50);
  border-radius: 10px;
  flex-shrink: 0;
}

.event-date strong { font-size: 18px; color: var(--blue-700); font-weight: 800; }
.event-date span   { font-size: 10px; color: var(--blue-600); text-transform: uppercase; font-weight: 600; }

.event-bar {
  width: 3px;
  align-self: stretch;
  border-radius: 3px;
  flex-shrink: 0;
}

.event-info { flex: 1; min-width: 0; }
.event-title { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 2px; }
.event-meta  { font-size: 12px; color: var(--gray-500); }

/* ============================================
   CONFIGURAÇÕES
   ============================================ */
.settings-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 12px;
  height: fit-content;
  position: sticky;
  top: calc(var(--topbar-h) + 28px);
}

.settings-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--gray-600);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.settings-link i[data-lucide], .settings-link svg.lucide { color: var(--gray-400); width: 16px; height: 16px; }
.settings-link:hover { background: var(--gray-50); color: var(--gray-800); }
.settings-link.active {
  background: var(--blue-50);
  color: var(--blue-700);
  font-weight: 600;
}
.settings-link.active i[data-lucide], .settings-link.active svg.lucide { color: var(--blue-600); }

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Profile */
.profile-row {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.profile-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.big-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--grad-blue);
  color: white;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 700;
  box-shadow: var(--shadow-blue);
}

.profile-form { flex: 1; min-width: 320px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
}

.form-group input,
.form-group textarea,
.form-group select {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--gray-800);
  transition: all 0.15s;
  font-family: inherit;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-100);
}

/* Toggle */
.toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--gray-100);
}

.toggle-item + .toggle-item { margin-top: 8px; }

.toggle-title { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 3px; }
.toggle-desc  { font-size: 12px; color: var(--gray-500); }

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.switch input { display: none; }

.switch span {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.switch span::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch.on span { background: var(--blue-600); }
.switch.on span::before { left: 21px; }

/* ============================================
   DRAWER (PERFIL CLIENTE)
   ============================================ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 100%;
  height: 100vh;
  background: white;
  z-index: 70;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(15, 23, 42, 0.1);
}

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

.drawer-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.drawer-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.drawer-title h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-title p { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  gap: 4px;
  overflow-x: auto;
}

.d-tab {
  background: transparent;
  border: none;
  color: var(--gray-500);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}

.d-tab:hover { color: var(--gray-800); }
.d-tab.active {
  color: var(--blue-600);
  border-bottom-color: var(--blue-600);
  font-weight: 600;
}

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

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gray-100);
}

.info-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.info-value { font-size: 14px; font-weight: 600; color: var(--gray-800); }

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
  margin: 22px 0 12px;
}

.situation-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sit-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--gray-50);
}

.sit-item i { width: 22px; height: 22px; flex-shrink: 0; }
.sit-item.ok   i { color: var(--green-500); }
.sit-item.warn i { color: var(--amber-500); }
.sit-item.bad  i { color: var(--red-500); }

.sit-item p { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.sit-item span { font-size: 12px; color: var(--gray-500); }

.timeline {
  position: relative;
  padding-left: 22px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 7px;
  width: 2px;
  background: var(--gray-200);
}

.timeline li {
  position: relative;
  padding: 4px 0 18px;
}

.tl-dot {
  position: absolute;
  left: -22px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--gray-200);
}

.tl-title { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 2px; }
.tl-meta  { font-size: 12px; color: var(--gray-500); margin-bottom: 6px; }
.tl-desc  { font-size: 13px; color: var(--gray-600); line-height: 1.5; }

/* ============================================
   CRM · PÁGINA PRINCIPAL
   ============================================ */
.crm-header {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.crm-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
}

.crm-header-actions .search-box.small { min-width: 280px; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title-main {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.section-sub {
  font-size: 13px;
  color: var(--muted-text);
  margin-top: 2px;
}

.cadence-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-blue-soft);
  color: var(--primary-blue);
  padding: 6px 10px 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.cadence-filter-pill .link-btn {
  font-size: 11px;
  color: var(--primary-blue);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.cadence-filter-pill .link-btn i { width: 12px; height: 12px; }

/* ============================================
   CRM · RESUMO POR CADÊNCIA (2x7)
   ============================================ */
.cadence-section {
  margin-bottom: 32px;
  max-width: 100%;
  overflow-x: auto;
}
.kanban-section { margin-bottom: 32px; }

.cadence-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: 100%;
}

.cadence-card {
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 58px;
  position: relative;
  overflow: hidden;
}

.cadence-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2.5px;
  background: var(--cadence-color, var(--primary-blue));
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.cadence-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-blue-soft);
}

.cadence-card.active {
  background: var(--primary-blue-soft);
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(22, 91, 255, 0.10);
}

.cadence-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
}

.cadence-card-name {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted-text);
  line-height: 1.2;
  flex: 1;
}

.cadence-card-badge {
  background: var(--primary-blue);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.cadence-card.active .cadence-card-badge {
  background: var(--primary-blue-dark);
}

.cadence-card-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
}

.cadence-card-meta {
  font-size: 11px;
  color: var(--muted-text);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Variações de cor por cadência (mantendo azul como primário)
   Os IDs abaixo DEVEM corresponder aos ids do array `cadences` em app.js
   (fonte única de verdade usada por Resumo por Cadência e Pipeline de Leads). */
.cadence-card[data-cadence="dados-ia"]             { --cadence-color: var(--gray-400); }
.cadence-card[data-cadence="coletados-frio"]       { --cadence-color: #6E8FFF; }
.cadence-card[data-cadence="qualificado"]          { --cadence-color: #4D80FF; }
.cadence-card[data-cadence="em-atendimento"]       { --cadence-color: var(--primary-blue); }
.cadence-card[data-cadence="geladeira"]            { --cadence-color: var(--gray-300); }
.cadence-card[data-cadence="stand-by"]             { --cadence-color: var(--gray-400); }
.cadence-card[data-cadence="diagnostico-gratis"]   { --cadence-color: #2563EB; }
.cadence-card[data-cadence="reuniao-agendada"]     { --cadence-color: #1D4ED8; }
.cadence-card[data-cadence="reuniao-realizada"]    { --cadence-color: #1E40AF; }
.cadence-card[data-cadence="contrato-enviado"]     { --cadence-color: #06B6D4; }
.cadence-card[data-cadence="contrato-fechado"]     { --cadence-color: #A855F7; }
.cadence-card[data-cadence="cobranca-enviada"]     { --cadence-color: #F59E0B; }
.cadence-card[data-cadence="pagamento-recebido"]   { --cadence-color: var(--primary-blue-dark); }
.cadence-card[data-cadence="servico-executado"]    { --cadence-color: #10B981; }
.cadence-card[data-cadence="pos-vendas"]           { --cadence-color: var(--success); }

/* ============================================
   CRM · KANBAN
   ============================================ */
.kanban-meta {
  display: flex;
  gap: 8px;
}
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.meta-pill i { width: 14px; height: 14px; color: var(--primary-blue); }

.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
}

/* ============================================
   CALENDAR EVENT MODAL
   ============================================ */
#calEventModal .modal-avatar {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--primary-blue-soft); color: var(--primary-blue);
  display: grid; place-items: center; flex-shrink: 0;
}
#calEventModal .modal-avatar i { width: 20px; height: 20px; }

.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--card-bg); border: 1px solid var(--gray-200);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 50; max-height: 200px; overflow-y: auto;
  display: none; flex-direction: column;
}
.autocomplete-list.open { display: flex; }
.autocomplete-item {
  background: transparent; border: none; text-align: left;
  padding: 10px 14px; font-size: 13px; color: var(--text-primary);
  cursor: pointer; transition: background 0.12s;
}
.autocomplete-item:hover,
.autocomplete-item.active { background: var(--primary-blue-soft); color: var(--primary-blue); }
.autocomplete-item small { color: var(--muted-text); margin-left: 6px; }

/* Color picker chips */
.color-picker {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.color-swatch {
  width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent;
  cursor: pointer; transition: border-color 0.15s, transform 0.15s;
  position: relative;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch[aria-checked="true"] {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--text-primary);
}
.color-swatch[aria-checked="true"]::after {
  content: '✓'; position: absolute; inset: 0;
  display: grid; place-items: center;
  color: white; font-size: 14px; font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.theme-dark .color-swatch[aria-checked="true"] { border-color: var(--gray-200); box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--gray-200); }

/* Mobile full-screen modal */
@media (max-width: 640px) {
  #calEventModal {
    position: fixed; inset: 0; z-index: 200;
    width: 100% !important; max-width: 100% !important;
    height: 100% !important; max-height: 100% !important;
    border-radius: 0 !important; overflow-y: auto;
    display: none; flex-direction: column;
  }
  #calEventModal.open { display: flex; }
  #calEventModal .modal-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  #calEventModal .modal-head { position: sticky; top: 0; z-index: 1; }
  #calEventModal .modal-foot { position: sticky; bottom: 0; z-index: 1; }
  .form-grid-2 { grid-template-columns: 1fr !important; }
  .form-grid-2 .full { grid-column: 1 !important; }
}

.kanban-board::-webkit-scrollbar { height: 8px; }

.kanban-col {
  flex: 0 0 260px;
  min-width: 260px;
  background: var(--surface-bg);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-snap-align: start;
  max-height: 70vh;
  transition: background 0.18s ease;
}

.kanban-col.drag-over {
  background: var(--primary-blue-soft);
  outline: 2px dashed var(--primary-blue);
  outline-offset: -2px;
}

.kanban-col-highlight {
  background: var(--primary-blue-soft);
  outline: 2px solid var(--primary-blue);
  outline-offset: -2px;
}

.kanban-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px 8px;
  border-bottom: 1px solid var(--gray-200);
}

.kanban-col-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted-text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-col-count {
  background: var(--primary-blue);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

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

.kanban-empty {
  text-align: center;
  font-size: 11px;
  color: var(--muted-text);
  padding: 20px 8px;
  border: 1px dashed var(--gray-200);
  border-radius: var(--radius-sm);
  font-style: italic;
}

.kanban-load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  background: var(--gray-50);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  color: var(--muted-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  font-family: inherit;
}
.kanban-load-more:hover:not(:disabled) {
  background: var(--primary-blue-soft);
  border-color: var(--primary-blue);
  border-style: solid;
  color: var(--primary-blue);
}
.kanban-load-more:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}
.kanban-load-more:disabled {
  cursor: progress;
  opacity: 0.7;
}
.kanban-load-more i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.kanban-load-more-count {
  background: var(--gray-200, #E5E7EB);
  color: var(--muted-text);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
}
.kanban-load-more:hover:not(:disabled) .kanban-load-more-count {
  background: var(--primary-blue);
  color: white;
}
.kanban-load-more.loading i {
  animation: kanban-spin 0.8s linear infinite;
}
.kanban-load-more .lead-card-fade-in {
  animation: kanban-fade-in 0.25s ease;
}
@keyframes kanban-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes kanban-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Lead card */
.lead-card {
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px;
  cursor: grab;
  transition: all 0.18s ease;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.lead-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-blue-soft);
}

.lead-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
  transform: scale(0.98);
}

.lead-card.just-moved {
  animation: pulseHighlight 1.2s ease;
}

@keyframes pulseHighlight {
  0%   { box-shadow: 0 0 0 0 rgba(22, 91, 255, 0.5); }
  60%  { box-shadow: 0 0 0 8px rgba(22, 91, 255, 0); }
  100% { box-shadow: var(--shadow-sm); }
}

.lead-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.lead-card-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-blue-soft);
  color: var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.lead-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-card-thermal {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.lead-card-thermal.frio  { background: #6E8FFF; }
.lead-card-thermal.morno { background: var(--warning); }
.lead-card-thermal.quente{ background: var(--error); }

.lead-card-meta {
  font-size: 11px;
  color: var(--muted-text);
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lead-card-meta .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.lead-card-meta .row .lbl { color: var(--muted-text); font-weight: 400; }
.lead-card-meta .row .val { color: var(--text-primary); font-weight: 600; text-align: right; display: flex; flex-wrap: wrap; gap: 3px; justify-content: flex-end; }
.lead-card-meta i { width: 11px; height: 11px; }

.lead-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--gray-200);
}

.lead-card-responsible {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted-text);
}
.lead-avatar-mini {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--grad-blue);
  color: white;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
}

.lead-card-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--success);
  background: var(--success-soft);
  padding: 3px 8px;
  border-radius: 999px;
}

.lead-card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.18s ease;
  background: rgba(255,255,255,0.96);
  padding: 4px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.lead-card:hover .lead-card-actions { display: none; }

.lead-card-actions button {
  background: transparent;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted-text);
  transition: all 0.15s;
}
.lead-card-actions button:hover {
  background: var(--primary-blue-soft);
  color: var(--primary-blue);
}
.lead-card-actions i { width: 13px; height: 13px; }

/* Services badges */
.lead-card-services {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.lead-card-svc-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--primary-blue-soft);
  color: var(--primary-blue);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.lead-card-svc-more {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--gray-100);
  color: var(--muted-text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}
.lead-card-svc-more:hover {
  background: var(--gray-200);
  color: var(--text-primary);
}

/* ============================================
   MODAL · DETALHES DO LEAD
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% + 12px));
  width: 90%;
  max-width: 720px;
  max-height: 92vh;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  z-index: 210;
  display: none;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}

.modal.modal-lg { max-width: 900px; }

.modal.open {
  display: flex;
  opacity: 1;
  transform: translate(-50%, -50%);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--card-bg);
}

.modal-head-left {
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.modal-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--grad-blue);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: var(--shadow-blue);
}

.modal-head h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.modal-meta {
  font-size: 12px;
  color: var(--muted-text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.dot-sep { color: var(--gray-300); }

.badge-readonly {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(251, 191, 36, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(251, 191, 36, 0.3);
}
.theme-dark .badge-readonly {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.25);
}

.modal-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.thermal-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.thermal-tag.frio   { background: #E5EDFF; color: #0044D6; }
.thermal-tag.morno  { background: var(--warning-soft); color: var(--warning); }
.thermal-tag.quente { background: var(--error-soft);   color: var(--error); }

.btn-ghost.small {
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
  gap: 6px;
}
.btn-ghost.small i { width: 14px; height: 14px; }

/* Journey bar */
.lead-journey {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 24px;
  background: var(--surface-bg);
  border-bottom: 1px solid var(--gray-200);
  overflow-x: auto;
}

.journey-step {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.journey-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gray-200);
  border: 3px solid var(--card-bg);
  box-shadow: 0 0 0 1px var(--gray-200);
  flex-shrink: 0;
}

.journey-step.done .journey-dot {
  background: var(--primary-blue);
  box-shadow: 0 0 0 1px var(--primary-blue);
}

.journey-step.active .journey-dot {
  background: var(--card-bg);
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px var(--primary-blue);
  animation: pulseRing 1.5s ease infinite;
}

@keyframes pulseRing {
  0%, 100% { box-shadow: 0 0 0 2px var(--primary-blue); }
  50%      { box-shadow: 0 0 0 6px rgba(22, 91, 255, 0.20); }
}

.journey-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-text);
  white-space: nowrap;
}

.journey-step.done .journey-label,
.journey-step.active .journey-label {
  color: var(--text-primary);
}

.journey-arrow {
  width: 16px;
  height: 2px;
  background: var(--gray-200);
  flex-shrink: 0;
}

/* Modal body */
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.lead-tab { display: none; }
.lead-tab[data-active="true"] { display: block; }

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group .req { color: var(--error); margin-left: 2px; }

#leadHon { text-align: right; font-variant-numeric: tabular-nums; }

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: all 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(22, 91, 255, 0.10);
}

.form-group input.invalid,
.form-group select.invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(225, 76, 76, 0.10);
}

.form-error {
  font-size: 11px;
  color: var(--error);
  min-height: 14px;
  font-weight: 500;
}

/* Chip groups */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-toggle {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.chip-toggle:hover {
  border-color: var(--primary-blue-soft);
  color: var(--primary-blue);
}

.chip-toggle.active {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

/* Modal history */
.modal-history {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--surface-bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary-blue);
}

.history-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-blue-soft);
  color: var(--primary-blue);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.history-icon i { width: 16px; height: 16px; }

.history-content { flex: 1; min-width: 0; }
.history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.history-meta { font-size: 11px; color: var(--muted-text); }
.history-desc { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* Modal foot */
.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  background: var(--surface-bg);
  flex-wrap: wrap;
}

.modal-foot-meta {
  font-size: 11px;
  color: var(--muted-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-foot-actions {
  display: flex;
  gap: 8px;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text-primary);
  color: white;
  padding: 12px 18px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  z-index: 300;
  box-shadow: var(--shadow-xl);
  animation: slideInRight 0.3s ease;
}

.toast i { width: 18px; height: 18px; color: var(--success); }

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

/* ============================================
   CRM · RESPONSIVE
   ============================================ */
@media (max-width: 1400px) {
  .cadence-card { font-size: 10px; }
}
@media (max-width: 1100px) {
  .form-grid-2 { grid-template-columns: 1fr; }
  .modal-head { flex-direction: column; align-items: stretch; }
  .modal-head-right { justify-content: flex-end; }
}
@media (max-width: 720px) {
  .kanban-col { flex: 0 0 240px; }
  .crm-header-actions { width: 100%; }
  .crm-header-actions .search-box.small { min-width: 0; flex: 1; }
}

/* Modal em modo CRIAÇÃO (novo lead): esconde journey, sync-badge, botões irrelevantes */
.sync-badge { display: none !important; }

.modal.is-new .lead-journey,
.modal.is-new .sync-badge,
.modal.is-new [data-action="history"],
.modal.is-new [data-action="whatsapp"],
.modal.is-new .modal-foot-meta {
  display: none !important;
}
.modal.is-new .modal-avatar {
  background: var(--primary-blue);
  color: #fff;
  font-weight: 700;
}

/* Destaque de erro no chip-group */
.chip-group.invalid {
  outline: 2px solid #DC2626;
  outline-offset: 2px;
  border-radius: 8px;
}

/* ============================================
   DASHBOARD · 4 CARDS METRIC GRID
   ============================================ */
.metric-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.metric-trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.metric-trend-pill i { width: 13px; height: 13px; }
.metric-trend-pill.up      { background: var(--success-soft); color: var(--success); }
.metric-trend-pill.down    { background: var(--error-soft);   color: var(--error); }
.metric-trend-pill.neutral { background: var(--gray-100);    color: var(--muted-text); }

/* ============================================
   DASHBOARD · REMINDER WIDGET
   ============================================ */
.reminder-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.reminder-card .card-header { margin-bottom: 0; }

.reminder-event {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  background: var(--primary-blue-soft);
  border-radius: var(--radius);
}

.reminder-event-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 56px;
  background: var(--card-bg);
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.reminder-event-time strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-blue);
  line-height: 1;
}

.reminder-event-time span {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted-text);
  text-transform: uppercase;
  margin-top: 3px;
}

.reminder-event-info { flex: 1; min-width: 0; }
.reminder-event-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.reminder-event-meta { font-size: 12px; color: var(--muted-text); }

.reminder-meet-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--grad-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-blue);
  transition: all 0.2s ease;
}
.reminder-meet-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -4px rgba(22, 91, 255, 0.45);
}
.reminder-meet-btn i { width: 16px; height: 16px; }

/* ============================================
   DASHBOARD · PROJECT PROGRESS (radial)
   ============================================ */
.progress-radial {
  position: relative;
  width: 160px;
  height: 160px;
  margin: var(--space-3) auto var(--space-4);
}

.progress-radial svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.progress-radial .pr-bg  { fill: none; stroke: var(--gray-100); stroke-width: 12; }
.progress-radial .pr-fg  { fill: none; stroke: var(--primary-blue); stroke-width: 12; stroke-linecap: round; stroke-dasharray: 376.99; stroke-dashoffset: 222.4; transition: stroke-dashoffset 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.progress-radial .pr-mid { fill: none; stroke: var(--primary-blue-light); stroke-width: 12; stroke-dasharray: 376.99; stroke-dashoffset: 245; transition: stroke-dashoffset 0.8s cubic-bezier(0.22, 1, 0.36, 1); }

.progress-radial-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.progress-radial-text strong {
  display: block;
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.8px;
  line-height: 1;
}
.progress-radial-text span {
  font-size: 11px;
  color: var(--muted-text);
  margin-top: 4px;
  display: block;
}

.progress-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: var(--space-3);
}
.progress-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}
.progress-legend-row .pl-label { display: inline-flex; align-items: center; gap: 8px; }
.progress-legend-row .pl-label i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.progress-legend-row .pl-value { font-weight: 600; color: var(--text-primary); }

/* ============================================
   DASHBOARD · TIME TRACKER (bloco escuro)
   ============================================ */
.time-tracker {
  background: var(--grad-tracker);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-blue);
  min-height: 100%;
}

.time-tracker::before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  top: -80px;
  right: -80px;
  pointer-events: none;
}
.time-tracker::after {
  content: '';
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  bottom: -40px;
  left: -40px;
  pointer-events: none;
}

.tt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}
.tt-head .tt-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.85);
}
.tt-head .tt-more {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s;
}
.tt-head .tt-more:hover { background: rgba(255, 255, 255, 0.2); }
.tt-head .tt-more i { width: 14px; height: 14px; }

.tt-project {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  position: relative;
  z-index: 1;
}

.tt-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  position: relative;
  z-index: 1;
  margin: var(--space-2) 0;
}
.tt-segment {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 28px;
  color: #fff;
  min-width: 52px;
  text-align: center;
}
.tt-sep {
  font-size: 24px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
}
.tt-label-sm {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.6);
  display: block;
  text-align: center;
  margin-top: 4px;
}

.tt-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  position: relative;
  z-index: 1;
  margin-top: var(--space-2);
}
.tt-btn {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tt-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
  transform: scale(1.05);
}
.tt-btn.primary {
  background: #fff;
  color: var(--primary-blue);
  border-color: #fff;
}
.tt-btn.primary:hover {
  background: #fff;
  color: var(--primary-blue-dark);
  transform: scale(1.05);
}
.tt-btn i { width: 18px; height: 18px; }

/* ============================================
   DASHBOARD · ROWS (analytics + progresso + tracker)
   ============================================ */
.dash-bottom {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: var(--space-5);
  margin-top: var(--space-5);
}

.dash-mid-3 {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--space-5);
  margin-top: var(--space-5);
}

@media (max-width: 1280px) {
  .metric-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .dash-mid-3, .dash-bottom { grid-template-columns: 1fr 1fr; }
  .dash-mid-3 > :nth-child(3), .dash-bottom > :nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .dash-mid-3, .dash-bottom { grid-template-columns: 1fr; }
  .dash-mid-3 > :nth-child(3), .dash-bottom > :nth-child(3) { grid-column: auto; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1280px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-row { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { padding: 0 20px; }
  .topbar-center { display: none; }
  .content { padding: 20px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
}

@media (max-width: 720px) {
  .topbar-left .page-subtitle { display: none; }
  .topbar-right .btn-primary span { display: none; }
  .topbar-right .btn-primary { width: 40px; padding: 0; justify-content: center; }
  .stat-grid { grid-template-columns: 1fr; }
  .welcome-banner { flex-direction: column; text-align: center; }
  .welcome-illustration { display: none; }
  .filters-right { flex-wrap: wrap; }
  .drawer { width: 100%; }
  .cal-day { min-height: 70px; padding: 4px; }
  .cal-day-num { font-size: 11px; min-width: 22px; height: 22px; }
  .cal-event { font-size: 9px; padding: 2px 4px; }
  .info-grid { grid-template-columns: 1fr; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 999px; border: 2px solid var(--gray-50); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

/* ============================================
   FOCUS · ACESSIBILIDADE
   ============================================ */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius);
}

/* ============================================
   TOOLTIPS (data-tooltip)
   ============================================ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--gray-900);
  color: white;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 80;
  box-shadow: var(--shadow-md);
}

[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--gray-900);
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 80;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   ANIMAÇÕES (carregamento do dashboard)
   ============================================ */
@keyframes barGrow {
  from { width: 0; }
}

.metric-bar > span {
  animation: barGrow 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes gaugeFill {
  from { stroke-dashoffset: 314.16; }
}

.gauge-fg {
  animation: gaugeFill 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes drawCircle {
  from { stroke-dashoffset: 314.16; }
}

.metric-card {
  animation: fadeUp 0.4s ease both;
}
.metric-card:nth-child(1) { animation-delay: 0.05s; }
.metric-card:nth-child(2) { animation-delay: 0.15s; }
.metric-card:nth-child(3) { animation-delay: 0.25s; }
.metric-card:nth-child(4) { animation-delay: 0.35s; }

/* ============================================
   DASHBOARD · TOOLBAR + ABAS + ANALYTICS v1.4
   ============================================ */

/* Toolbar */
.dash-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--card-bg);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.dash-toolbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dash-toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-title { font-size: 18px; font-weight: 600; color: var(--text-primary); margin: 0; }
.dash-updated {
  font-size: 12px; color: var(--muted-text);
  padding: 4px 10px; background: var(--gray-50);
  border-radius: 999px; display: inline-flex; align-items: center; gap: 4px;
}
.dash-days {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; background: var(--gray-50);
  border-radius: var(--radius-md); font-size: 12px;
}
.dash-days label { color: var(--muted-text); font-weight: 500; }
.dash-days input {
  width: 56px; padding: 4px 6px; border: 1px solid var(--gray-200);
  border-radius: 6px; font-family: inherit; font-size: 13px;
  color: var(--text-primary); background: #fff;
  text-align: center;
}
.dash-days input:focus { outline: none; border-color: var(--primary-blue); box-shadow: var(--focus-ring); }
.dash-custom-range {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; background: var(--gray-50);
  border-radius: var(--radius-md); font-size: 12px;
}
.dash-custom-range input {
  padding: 4px 6px; border: 1px solid var(--gray-200);
  border-radius: 6px; font-family: inherit; font-size: 13px;
}
.dash-custom-range input:focus { outline: none; border-color: var(--primary-blue); box-shadow: var(--focus-ring); }
.dash-range-sep { color: var(--muted-text); font-weight: 600; }

/* Tabs */
.dash-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--card-bg);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: thin;
}
.dash-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; background: transparent;
  border: 0; border-radius: var(--radius-md);
  font: 500 13px/1 'Inter', sans-serif;
  color: var(--muted-text); cursor: pointer; white-space: nowrap;
  transition: background 0.18s, color 0.18s, transform 0.15s;
}
.dash-tab i { width: 16px; height: 16px; }
.dash-tab:hover { background: var(--gray-50); color: var(--text-primary); }
.dash-tab.active {
  background: var(--primary-blue);
  color: #fff;
  box-shadow: 0 4px 12px -2px rgba(22, 91, 255, 0.4);
}
.dash-tab.active:hover { background: var(--primary-blue-dark); color: #fff; }
.dash-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Filtros secundários */
.dash-secondary-filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.dash-filter {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
}
.dash-filter i { width: 14px; height: 14px; color: var(--muted-text); }
.dash-filter select {
  border: 0; background: transparent; padding: 4px 0;
  font: 500 13px 'Inter', sans-serif; color: var(--text-primary);
  cursor: pointer; min-width: 140px;
}
.dash-filter select:focus { outline: none; }
.dash-export-menu { position: relative; margin-left: auto; }
.btn-export {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; background: var(--primary-blue);
  color: #fff; border: 0; border-radius: var(--radius-md);
  font: 500 13px 'Inter', sans-serif; cursor: pointer;
  transition: background 0.18s, transform 0.15s;
}
.btn-export:hover { background: var(--primary-blue-dark); transform: translateY(-1px); }
.btn-export i { width: 14px; height: 14px; }
.dash-export-caret { margin-left: 2px; }
.dash-export-dropdown {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--card-bg); border: 1px solid var(--gray-100);
  border-radius: var(--radius-md); box-shadow: var(--shadow-xl);
  min-width: 180px; padding: 4px; z-index: 50;
  animation: fadeUp 0.18s ease;
}
.dash-export-dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; background: transparent; border: 0; border-radius: 6px;
  font: 500 13px 'Inter', sans-serif; color: var(--text-primary);
  cursor: pointer; text-align: left;
}
.dash-export-dropdown button:hover { background: var(--gray-50); }
.dash-export-dropdown i { width: 14px; height: 14px; color: var(--muted-text); }

/* Panels */
.dash-panel { animation: fadeUp 0.32s ease both; }
.dash-panel[hidden] { display: none; }
.dash-panel-actions { display: inline-flex; align-items: center; gap: 8px; }
.sync-indicator {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--success);
  padding: 4px 8px; background: rgba(47, 181, 106, 0.1);
  border-radius: 999px;
}
.sync-indicator i { width: 12px; height: 12px; }

/* Expandable */
.dash-expandable { margin-bottom: 8px; }
.dash-expand-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; background: var(--gray-50);
  border: 0; border-radius: var(--radius-md);
  font: 500 12px 'Inter', sans-serif; color: var(--text-primary);
  cursor: pointer; transition: background 0.18s;
}
.dash-expand-toggle:hover { background: var(--gray-100); }
.dash-expand-toggle i { width: 14px; height: 14px; transition: transform 0.2s; }
.dash-expand-toggle.open i { transform: rotate(180deg); }
.dash-expand-body {
  margin-top: 8px; padding: 12px;
  background: var(--gray-50); border-radius: var(--radius-md);
  border: 1px dashed var(--gray-200);
  animation: slideDown 0.24s ease;
}
.dash-expand-body[hidden] { display: none; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Funil por cadência */
.funil-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.funil-row {
  display: grid; grid-template-columns: 200px 1fr 80px 100px;
  align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--gray-50); border-radius: var(--radius-md);
  transition: background 0.18s, transform 0.15s;
  cursor: pointer;
}
.funil-row:hover { background: var(--primary-blue-soft); transform: translateX(2px); }
.funil-row-name { font: 500 12px 'Inter', sans-serif; color: var(--text-primary); }
.funil-row-bar { height: 10px; background: var(--gray-200); border-radius: 999px; overflow: hidden; }
.funil-row-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-blue), var(--primary-blue-light)); border-radius: 999px; transition: width 0.6s ease-out; }
.funil-row-count { font: 600 14px 'Inter', sans-serif; color: var(--text-primary); text-align: right; }
.funil-row-value { font: 500 12px 'Inter', sans-serif; color: var(--muted-text); text-align: right; }

/* Origens */
.origens-grid { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: center; margin-bottom: 12px; }
.origens-chart { position: relative; width: 220px; height: 220px; }
.origens-chart canvas { width: 100% !important; height: 100% !important; }
.origens-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}
.origens-center strong { font-size: 32px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.origens-center span { font-size: 11px; color: var(--muted-text); margin-top: 4px; }
.origens-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.origens-legend li {
  display: grid; grid-template-columns: 14px 1fr auto auto;
  align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--gray-50); border-radius: var(--radius-md);
  cursor: pointer; transition: background 0.18s, transform 0.15s;
}
.origens-legend li:hover { background: var(--primary-blue-soft); transform: translateX(2px); }
.origens-legend li.active { background: var(--primary-blue-soft); box-shadow: inset 3px 0 0 var(--primary-blue); }
.origens-legend i { width: 12px; height: 12px; border-radius: 3px; display: block; }
.origens-legend .ol-name { font: 500 13px 'Inter', sans-serif; color: var(--text-primary); }
.origens-legend .ol-count { font: 600 13px 'Inter', sans-serif; color: var(--text-primary); }
.origens-legend .ol-pct { font: 500 12px 'Inter', sans-serif; color: var(--muted-text); min-width: 42px; text-align: right; }

/* Temperatura */
.temp-bars { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.temp-bar {
  display: grid; grid-template-columns: 90px 1fr 60px 80px;
  align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--gray-50); border-radius: var(--radius-md);
  cursor: pointer; transition: background 0.18s, transform 0.15s;
}
.temp-bar:hover { background: var(--primary-blue-soft); transform: translateX(2px); }
.temp-bar.active { background: var(--primary-blue-soft); box-shadow: inset 3px 0 0 var(--primary-blue); }
.temp-bar-name { font: 600 13px 'Inter', sans-serif; display: inline-flex; align-items: center; gap: 6px; }
.temp-bar-frio  .temp-bar-name { color: #0284C7; }
.temp-bar-morno .temp-bar-name { color: #D97706; }
.temp-bar-quente .temp-bar-name { color: #DC2626; }
.temp-bar-track { height: 12px; background: var(--gray-200); border-radius: 999px; overflow: hidden; }
.temp-bar-fill { height: 100%; border-radius: 999px; transition: width 0.7s ease-out; }
.temp-bar-frio  .temp-bar-fill { background: linear-gradient(90deg, #38BDF8, #0284C7); }
.temp-bar-morno .temp-bar-fill { background: linear-gradient(90deg, #FBBF24, #D97706); }
.temp-bar-quente .temp-bar-fill { background: linear-gradient(90deg, #F87171, #DC2626); }
.temp-bar-count { font: 600 14px 'Inter', sans-serif; color: var(--text-primary); text-align: right; }
.temp-bar-trend { font: 500 12px 'Inter', sans-serif; color: var(--muted-text); text-align: right; }

/* Honorários */
.honorarios-grid {
  display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 16px;
}
.honorarios-total {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
  color: #fff; border: 0;
}
.honorarios-total .card-title, .honorarios-total .card-sub { color: #fff; }
.honorarios-total .card-sub { opacity: 0.85; }
.honorarios-amount {
  font-size: 38px; font-weight: 700; letter-spacing: -0.02em;
  margin: 8px 0 6px; line-height: 1.1;
}
.honorarios-meta { font-size: 13px; opacity: 0.9; }
.honorarios-trend {
  margin-top: 8px; display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 4px 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}
.honorarios-trend i { width: 12px; height: 12px; }
.honorarios-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.honorarios-list li {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: 12px; padding: 8px 12px;
  background: var(--gray-50); border-radius: var(--radius-md);
}
.honorarios-list .hl-name { font: 500 12px 'Inter', sans-serif; color: var(--text-primary); }
.honorarios-list .hl-bar { grid-column: 1 / -1; height: 6px; background: var(--gray-200); border-radius: 999px; overflow: hidden; }
.honorarios-list .hl-bar > span { display: block; height: 100%; background: var(--primary-blue); border-radius: 999px; transition: width 0.6s ease-out; }
.honorarios-list .hl-value { font: 600 13px 'Inter', sans-serif; color: var(--text-primary); }

/* Empty state */
.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--muted-text);
}
.empty-state i { width: 36px; height: 36px; color: var(--gray-300); margin-bottom: 8px; }
.empty-state p { margin: 0; font-size: 13px; }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s infinite;
  border-radius: 6px;
  height: 16px;
}
@keyframes skeletonShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Status tag (cadence) */
.dash-status-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  font: 600 10px/1 'Inter', sans-serif; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dash-status-tag.t-dados-ia           { background: #DBEAFE; color: #1D4ED8; }
.dash-status-tag.t-coletados-frio     { background: #E0E7FF; color: #4338CA; }
.dash-status-tag.t-qualificado        { background: #CFFAFE; color: #0E7490; }
.dash-status-tag.t-em-atendimento     { background: #FEF3C7; color: #B45309; }
.dash-status-tag.t-geladeira          { background: #E0F2FE; color: #0369A1; }
.dash-status-tag.t-stand-by           { background: #F3F4F6; color: #4B5563; }
.dash-status-tag.t-diagnostico-gratis { background: #DCFCE7; color: #15803D; }
.dash-status-tag.t-reuniao-agendada   { background: #DBEAFE; color: #1D4ED8; }
.dash-status-tag.t-reuniao-realizada  { background: #E0E7FF; color: #4338CA; }
.dash-status-tag.t-contrato-fechado   { background: #DCFCE7; color: #15803D; }
.dash-status-tag.t-cobranca-enviada   { background: #FEF3C7; color: #B45309; }
.dash-status-tag.t-pagamento-recebido { background: #D1FAE5; color: #047857; }
.dash-status-tag.t-servico-executado  { background: #CFFAFE; color: #0E7490; }
.dash-status-tag.t-pos-vendas         { background: #F1F5F9; color: #475569; }

/* Thermal tag */
.thermal-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font: 600 10px/1.4 'Inter', sans-serif; text-transform: uppercase;
}
.thermal-tag.frio   { background: #E0F2FE; color: #0369A1; }
.thermal-tag.morno  { background: #FEF3C7; color: #B45309; }
.thermal-tag.quente { background: #FEE2E2; color: #B91C1C; }

/* Pagination */
.dash-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; margin-top: 8px;
  font-size: 12px; color: var(--muted-text);
  border-top: 1px solid var(--gray-100);
}
.dash-pagination .dp-pages { display: flex; gap: 4px; }
.dash-pagination button {
  padding: 4px 10px; background: var(--gray-50);
  border: 0; border-radius: 6px; font: 500 12px 'Inter', sans-serif;
  color: var(--text-primary); cursor: pointer;
}
.dash-pagination button:hover { background: var(--gray-100); }
.dash-pagination button.active { background: var(--primary-blue); color: #fff; }
.dash-pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Clickable lead row */
.lead-row-clickable { cursor: pointer; }
.lead-row-clickable:hover { background: var(--primary-blue-soft) !important; }

/* Responsive */
@media (max-width: 1200px) {
  .origens-grid { grid-template-columns: 1fr; }
  .origens-chart { margin: 0 auto; }
  .honorarios-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .dash-toolbar { flex-direction: column; align-items: flex-start; }
  .dash-toolbar-right { width: 100%; }
  .funil-row { grid-template-columns: 1fr 60px; }
  .funil-row-bar, .funil-row-value { display: none; }
  .temp-bar { grid-template-columns: 80px 1fr 60px; }
  .temp-bar-trend { display: none; }
  .dash-secondary-filters { flex-direction: column; align-items: stretch; }
  .dash-export-menu { margin-left: 0; }
}
@media (max-width: 600px) {
  .dash-tab span, .dash-tab { font-size: 12px; padding: 7px 10px; }
}

/* ============================================
   DARK THEME
   ============================================ */
.theme-dark {
  --surface-bg:   #0F172A;
  --card-bg:      #1E293B;
  --bg-page:      #0F172A;

  --text-primary: #E2E8F0;
  --text-secondary: #CBD5E1;
  --muted-text:   #94A3B8;

  --gray-50:  #1E293B;
  --gray-100: #1E293B;
  --gray-200: #334155;
  --gray-300: #475569;
  --gray-400: #64748B;

  --primary-blue-soft: #1E3A5F;
  --success-soft:   #064E3B;
  --warning-soft:   #78350F;
  --error-soft:     #7F1D1D;

  --sidebar-bg: #0F172A;
}

.theme-dark .sidebar { background: var(--sidebar-bg, #0F172A); }
.theme-dark .sidebar-nav .nav-item:hover { background: rgba(255,255,255,0.06); }
.theme-dark .sidebar-nav .nav-item.active { background: rgba(22,91,255,0.15); }
.theme-dark .topbar { background: #1E293B; border-color: #334155; }
.theme-dark .card { background: #1E293B; border-color: #334155; }
.theme-dark .page-title { color: #E2E8F0; }
.theme-dark .page-subtitle { color: #94A3B8; }
.theme-dark .home-hero { background: linear-gradient(135deg, #002F8A 0%, #165BFF 100%); }
.theme-dark .home-hero-search {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}
.theme-dark .home-hero-search:focus-within {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
}
.theme-dark .home-hero-search input {
  background: transparent;
  color: white;
}
.theme-dark .home-hero-search input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}
.theme-dark input[type="text"],
.theme-dark input[type="email"],
.theme-dark input[type="tel"],
.theme-dark input[type="number"],
.theme-dark input[type="date"],
.theme-dark textarea,
.theme-dark select {
  background: #0F172A;
  color: #E2E8F0;
  border-color: #475569;
}
.theme-dark .data-table th { background: #1E293B; color: #CBD5E1; }
.theme-dark .data-table td { border-color: #334155; }
.theme-dark .metric-card { background: #1E293B; }
.theme-dark .client-card { background: #1E293B; border-color: #334155; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); }
.theme-dark .client-card:hover { border-color: #475569; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4); }
.theme-dark .client-card-name { color: #E2E8F0; }
.theme-dark .client-card-cnpj { color: #94A3B8; }
.theme-dark .client-card-meta { border-top-color: #334155; }
.theme-dark .client-card-meta .row .lbl { color: #94A3B8; }
.theme-dark .client-card-meta .row .val { color: #E2E8F0; }
.theme-dark .filter-dropdown { background: #1E293B; border-color: #334155; }
.theme-dark .filter-dropdown-item:hover { background: rgba(22,91,255,0.15); }
.theme-dark .active-filter-badge { background: rgba(22,91,255,0.15); }
.theme-dark .filters-bar { background: #1E293B; border-color: #334155; }
.theme-dark .kanban-col-highlight { background: rgba(22,91,255,0.12); outline-color: #165BFF; }
.theme-dark .cadence-card.active { background: rgba(22,91,255,0.12); border-color: #165BFF; }

/* --- Search bars --- */
.theme-dark .search-box.small { background: #1E293B; border-color: #334155; }
.theme-dark .search-box.small input { color: #E2E8F0; }
.theme-dark .search-box.small input::placeholder { color: #64748B; }
.theme-dark .search-box.small i { color: #64748B; }
.theme-dark .search-box kbd { background: #334155; color: #94A3B8; border-color: #475569; }

/* --- Dashboard titles --- */
.theme-dark .card-title { color: #E2E8F0; }
.theme-dark .card-sub { color: #94A3B8; }
.theme-dark .kpi-label { color: #94A3B8; }
.theme-dark .kpi-value { color: #F1F5F9; }
.theme-dark .home-card-title { color: #E2E8F0; }
.theme-dark .home-section-title { color: #94A3B8; }

/* --- Calendar header --- */
.theme-dark .cal-title { color: #E2E8F0; }
.theme-dark .seg-control { background: #1E293B; }
.theme-dark .seg { color: #94A3B8; }
.theme-dark .seg.active { background: #334155; color: #E2E8F0; }
.theme-dark .cal-weekdays { background: #1E293B; }
.theme-dark .cal-weekday span { color: #94A3B8; }

/* --- Rotina kanban cards --- */
.theme-dark .pastel-blue   { background: #1E3A5F; border-color: #2563EB; }
.theme-dark .pastel-pink   { background: #4C1D45; border-color: #A855F7; }
.theme-dark .pastel-yellow { background: #422006; border-color: #EAB308; }
.theme-dark .pastel-purple { background: #2E1065; border-color: #7C3AED; }
.theme-dark .pastel-green  { background: #052E16; border-color: #22C55E; }
.theme-dark .rotina-card-title { color: #E2E8F0; }
.theme-dark .rotina-card-item.done .rotina-card-title { color: #64748B; }
.theme-dark .rotina-meta-item { color: #94A3B8; }
.theme-dark .rotina-type-badge.tarefa  { background: rgba(37, 99, 235, 0.25); color: #60A5FA; }
.theme-dark .rotina-type-badge.reuniao { background: rgba(168, 85, 247, 0.25); color: #C084FC; }
.theme-dark .rotina-type-badge.prazo   { background: rgba(234, 179, 8, 0.25); color: #FACC15; }
.theme-dark .rotina-col { background: #0F172A; }
.theme-dark .rotina-col-head { border-color: #334155; color: #CBD5E1; }
.theme-dark .rotina-reminder-item { background: #1E293B; border-color: #334155; }
.theme-dark .rotina-reminder-item-title { color: #E2E8F0; }
.theme-dark .rotina-detail-modal { background: #1E293B; }
.theme-dark .rotina-detail-title { color: #F1F5F9; }
.theme-dark .rotina-detail-title::placeholder { color: #64748B; }
.theme-dark .rotina-detail-desc { color: #CBD5E1; }
.theme-dark .rotina-detail-desc::placeholder { color: #64748B; }
.theme-dark .rotina-detail-toolbar { border-color: #334155; }
.theme-dark .rotina-detail-close:hover { background: #334155; color: #F1F5F9; }
.theme-dark .rotina-detail-pin:hover { background: rgba(255,255,255,0.08); }

/* Toggle button transition */
#themeToggle { transition: background 0.2s ease; }
#themeToggle:hover { background: rgba(22,91,255,0.1); }

/* ============================================
   DASHBOARD WIDGETS v2
   ============================================ */
.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.dash-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.dash-grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.dash-widget {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.dash-widget:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* KPI Cards */
.kpi-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 18px 20px;
  border: 1px solid var(--gray-200);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-text);
}
.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-blue-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-blue);
}
.kpi-icon.green { background: var(--success-soft); color: var(--success); }
.kpi-icon.blue { background: var(--primary-blue-soft); color: var(--primary-blue); }
.kpi-icon.amber { background: var(--warning-soft); color: var(--warning); }
.kpi-icon svg, .kpi-icon i { width: 16px; height: 16px; }
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
  line-height: 1.1;
}
.kpi-trend {
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--error); }
.kpi-trend.neutral { color: var(--muted-text); }
.kpi-trend svg, .kpi-trend i { width: 14px; height: 14px; }
.kpi-spark {
  margin-top: 8px;
  display: block;
}
.kpi-donut-wrap {
  margin-top: 8px;
}
.kpi-donut {
  display: block;
}
.kpi-bar-mini {
  margin-top: 10px;
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
}
.kpi-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary-blue);
  transition: width 0.6s ease;
}
.kpi-bar-fill.amber { background: var(--warning); }

/* Funnel */
.funnel-container {
  padding: 16px 20px;
}
.funnel-step {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.funnel-bar-wrap {
  flex: 1;
  margin: 0 12px;
}
.funnel-bar {
  height: 28px;
  border-radius: 6px;
  background: var(--primary-blue);
  display: flex;
  align-items: center;
  padding-left: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  transition: width 0.6s ease;
}
.funnel-label {
  width: 100px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
}
.funnel-count {
  width: 50px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Origins */
.origins-container {
  padding: 16px 20px;
}
.origins-container canvas {
  max-height: 180px;
}
.origins-legend {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}
.origins-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.origins-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Temperature */
.temp-container {
  padding: 16px 20px;
}
.temp-row {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.temp-label {
  width: 60px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.temp-bar-wrap {
  flex: 1;
  margin: 0 12px;
  height: 24px;
  background: var(--gray-100);
  border-radius: 6px;
  overflow: hidden;
}
.temp-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease;
  display: flex;
  align-items: center;
  padding-left: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.temp-bar.hot { background: #E14C4C; }
.temp-bar.warm { background: #F0A500; }
.temp-bar.cold { background: #3B82F6; }
.temp-count {
  width: 45px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

/* Honorarios */
.honorarios-amount {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0 20px 8px;
}

/* Reunião */
.reuniao-card {
  display: flex;
  flex-direction: column;
}
.reuniao-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}
.reuniao-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.reuniao-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.reuniao-date {
  font-size: 14px;
  color: var(--text-secondary);
}
.reuniao-time {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-blue);
}
.reuniao-cta {
  margin-top: auto;
  width: 100%;
  justify-content: center;
}

/* ============================================
   DASHBOARD PERIOD CONTROL
   ============================================ */
.dash-period-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.dash-period-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.dash-period-custom input[type="date"] {
  padding: 6px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--card-bg);
  transition: border-color 0.15s;
}
.dash-period-custom input[type="date"]:focus {
  outline: none;
  border-color: var(--primary-blue);
}
.dash-period-badge {
  font-size: 12px;
  color: var(--primary-blue);
  background: var(--primary-blue-soft);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
  white-space: nowrap;
}

/* ============================================
   PRÓXIMOS EVENTOS CARD
   ============================================ */
.eventos-card .eventos-list { padding: 0 20px; }
.evento-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.1s;
}
.evento-item:hover { background: var(--gray-50, #f9fafb); margin: 0 -20px; padding: 10px 20px; }
.evento-item:last-child { border-bottom: none; }
.evento-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 36px;
}
.evento-date strong { font-size: 16px; color: var(--text-primary); line-height: 1.1; }
.evento-date span { font-size: 11px; color: var(--muted-text); }
.evento-bar { width: 3px; height: 32px; border-radius: 2px; flex-shrink: 0; }
.evento-info { flex: 1; min-width: 0; }
.evento-title { font-size: 13px; font-weight: 500; color: var(--text-primary); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evento-meta { font-size: 12px; color: var(--muted-text); margin: 2px 0 0; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--gray-100); }
.eventos-cta { width: 100%; justify-content: center; }
.eventos-card .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 20px;
  color: var(--muted-text);
  font-size: 13px;
  text-align: center;
}
.eventos-card .empty-state i { width: 24px; height: 24px; opacity: 0.4; }

/* Responsive */
@media (max-width: 1100px) {
  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-grid-3 { grid-template-columns: 1fr; }
  .dash-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .dash-kpi-row { grid-template-columns: 1fr; }
  .kpi-value { font-size: 22px; }
  .dash-period-bar { gap: 10px; }
  .seg-control { flex-wrap: wrap; }
}

/* ============================================
   ROTINA BLUE · DASHBOARD PESSOAL
   ============================================ */

/* Layout principal */
.rotina-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}

/* Sidebar / painel lateral */
.rotina-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 100px;
}

/* Card base */
.rotina-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--gray-100);
}

/* ---- Botão Criar Card ---- */
.rotina-create-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--grad-blue);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-blue);
  transition: transform 0.15s, box-shadow 0.15s;
}
.rotina-create-btn i { width: 18px; height: 18px; }
.rotina-create-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -4px rgba(22,91,255,0.45); }
.rotina-create-btn:active { transform: translateY(0); }

/* ---- Lembrete ---- */
.rotina-reminder {
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
  border: 1px solid #C7D2FE;
}
.rotina-reminder-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  color: var(--muted-text);
  font-size: 13px;
  text-align: center;
}
.rotina-reminder-empty i { width: 28px; height: 28px; opacity: 0.4; }
.rotina-reminder-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary-blue);
  background: rgba(22, 91, 255, 0.12);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
}
.rotina-reminder-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.3;
}
.rotina-reminder-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.rotina-reminder-details span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
.rotina-reminder-details i { width: 14px; height: 14px; color: var(--primary-blue); opacity: 0.7; }
.rotina-reminder-assignees {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.rotina-reminder-actions {
  display: flex;
  gap: 8px;
}
.rotina-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.rotina-action-btn i { width: 14px; height: 14px; }
.rotina-action-btn.confirm {
  background: var(--primary-blue);
  color: white;
}
.rotina-action-btn.confirm:hover { background: var(--primary-blue-dark); }
.rotina-action-btn.snooze {
  background: var(--warning-soft);
  color: #92600A;
}
.rotina-action-btn.snooze:hover { background: #FDE68A; }
.rotina-action-btn.cancel {
  background: var(--error-soft);
  color: #B91C1C;
}
.rotina-action-btn.cancel:hover { background: #FECACA; }

/* ---- Filtros ---- */
.rotina-filters-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.rotina-filter-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rotina-filter-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}
.rotina-filter-check:hover { background: var(--gray-100); }
.rotina-filter-check input { display: none; }
.rotina-checkmark-sm {
  width: 18px;
  height: 18px;
  border: 2px solid var(--gray-300);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  background: white;
  flex-shrink: 0;
}
.rotina-filter-check input:checked + .rotina-checkmark-sm {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
}
.rotina-filter-check input:checked + .rotina-checkmark-sm::after {
  content: '✓';
  color: white;
  font-size: 11px;
  font-weight: 700;
}
.rotina-filter-check input:focus-visible + .rotina-checkmark-sm {
  box-shadow: var(--focus-ring);
}

/* ---- Kanban ---- */
.rotina-kanban-wrap {
  min-height: 500px;
}
.rotina-kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  align-items: start;
}
.rotina-col {
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 16px;
  min-height: 300px;
  border: 2px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.rotina-col.drag-over {
  border-color: var(--primary-blue);
  background: var(--primary-blue-soft);
}
.rotina-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gray-200);
}
.rotina-col-head h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.rotina-col-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.rotina-col-dot.cadencia { background: var(--primary-blue); }
.rotina-col-dot.andamento { background: var(--warning); }
.rotina-col-dot.pendentes { background: var(--error); }
.rotina-col-dot.concluido { background: var(--success); }
.rotina-col-count {
  background: var(--gray-200);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.rotina-col-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 60px;
}

/* ---- Cards do Kanban ---- */
.rotina-card-item {
  border-radius: var(--radius);
  padding: 14px;
  cursor: grab;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
  border: 1px solid transparent;
  position: relative;
}
.rotina-card-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.rotina-card-item.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}
.rotina-card-item.done {
  opacity: 0.55;
}

/* Paleta pastel */
.pastel-blue   { background: #DBEAFE; border-color: #BFDBFE; }
.pastel-pink   { background: #FCE7F3; border-color: #FBCFE8; }
.pastel-yellow { background: #FEF9C3; border-color: #FEF08A; }
.pastel-purple { background: #EDE9FE; border-color: #DDD6FE; }
.pastel-green  { background: #D1FAE5; border-color: #A7F3D0; }

.rotina-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 6px;
}
.rotina-delete-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted-text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.rotina-delete-btn i { width: 15px; height: 15px; }
.rotina-delete-btn:hover { background: var(--error-soft); color: var(--error); }
.rotina-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.rotina-type-badge i { width: 12px; height: 12px; }
.rotina-type-badge.tarefa  { background: rgba(22, 91, 255, 0.15); color: #1e40af; }
.rotina-type-badge.reuniao { background: rgba(168, 85, 247, 0.15); color: #6b21a8; }
.rotina-type-badge.prazo   { background: rgba(245, 158, 11, 0.15); color: #92400e; }

.rotina-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.35;
}
.rotina-card-item.done .rotina-card-title {
  text-decoration: line-through;
  color: var(--muted-text);
}
.rotina-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.rotina-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}
.rotina-meta-item i { width: 12px; height: 12px; opacity: 0.6; }

/* ---- Lista de eventos na sidebar ---- */
.rotina-reminder-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rotina-reminder-item {
  background: white;
  border-radius: var(--radius);
  padding: 12px;
  border: 1px solid #E0E7FF;
}
.rotina-reminder-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.rotina-reminder-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  flex: 1;
}
.rotina-reminder-item .rotina-reminder-details {
  margin-bottom: 10px;
}
.rotina-reminder-item .rotina-reminder-actions {
  gap: 6px;
}
.rotina-reminder-item .rotina-action-btn {
  padding: 6px 4px;
  font-size: 11px;
}
.rotina-reminder-item .rotina-action-btn i {
  width: 12px;
  height: 12px;
}

/* ---- Snooze panel ---- */
.rotina-snooze-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}
.rotina-snooze-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.rotina-datetime-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: white;
}
.rotina-datetime-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(22, 91, 255, 0.12);
}
.rotina-date-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted-text);
  background: rgba(0,0,0,0.05);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.rotina-done-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-soft);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.rotina-done-badge i { width: 12px; height: 12px; }

/* Checkbox custom */
.rotina-checkbox-wrap {
  display: inline-flex;
  cursor: pointer;
}
.rotina-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.rotina-checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  background: white;
}
.rotina-checkbox:checked + .rotina-checkmark {
  background: var(--success);
  border-color: var(--success);
}
.rotina-checkbox:checked + .rotina-checkmark::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: 700;
}
.rotina-checkbox:focus-visible + .rotina-checkmark {
  box-shadow: var(--focus-ring);
}

/* ---- Detail Panel ---- */
.rotina-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 900;
  animation: fadeIn 0.2s ease;
}
.rotina-detail-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  max-width: 92vw;
  max-height: 85vh;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  z-index: 901;
  overflow-y: auto;
  animation: modalFadeIn 0.25s ease;
  display: flex;
  flex-direction: column;
}
.rotina-detail-pin {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted-text);
  transition: background 0.15s;
}
.rotina-detail-pin:hover { background: rgba(0,0,0,0.06); }
.rotina-detail-pin i { width: 18px; height: 18px; }
.rotina-detail-title {
  width: 100%;
  border: none;
  outline: none;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  background: transparent;
  padding: 20px 48px 8px 24px;
  font-family: inherit;
}
.rotina-detail-title::placeholder { color: var(--muted-text); }
.rotina-detail-desc {
  width: 100%;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text-secondary);
  background: transparent;
  padding: 8px 24px;
  font-family: inherit;
  line-height: 1.7;
  resize: none;
  flex: 1;
  min-height: 120px;
}
.rotina-detail-desc::placeholder { color: var(--muted-text); }
.rotina-detail-colors {
  display: flex;
  gap: 8px;
  padding: 8px 24px;
}
.rotina-detail-edited {
  font-size: 11px;
  color: var(--muted-text);
  padding: 4px 24px 0;
  margin: 0;
}
.rotina-detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--gray-100);
}
.rotina-detail-toolbar-left {
  display: flex;
  gap: 4px;
}
.rotina-detail-close {
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-text);
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.rotina-detail-close:hover { background: var(--gray-100); color: var(--text-primary); }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ---- Empty State ---- */
.rotina-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 16px;
  color: var(--muted-text);
  font-size: 13px;
  text-align: center;
}
.rotina-empty i { width: 32px; height: 32px; opacity: 0.3; }
.rotina-empty p { margin: 0; line-height: 1.4; }

/* ---- Modal Criar Card (Google Keep) ---- */
.rotina-hidden { display: none !important; }
.rotina-create-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 950;
  animation: fadeIn 0.2s ease;
}
.rotina-create-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 520px;
  max-width: 92vw;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  z-index: 951;
  padding: 20px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
  animation: scaleIn 0.2s ease;
}
@keyframes scaleIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.rotina-create-pin {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted-text);
  transition: background 0.15s, color 0.15s;
}
.rotina-create-pin:hover { background: var(--gray-100); color: var(--text-primary); }
.rotina-create-pin i { width: 18px; height: 18px; }
.rotina-create-pin.pinned { color: var(--primary-blue); }

.rotina-create-title {
  border: none;
  outline: none;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 4px 0;
  background: transparent;
  width: 100%;
  margin-bottom: 4px;
}
.rotina-create-title::placeholder { color: var(--gray-400); }

.rotina-create-desc {
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 8px 0;
  background: transparent;
  width: 100%;
  resize: vertical;
  min-height: 60px;
  font-family: var(--font);
  line-height: 1.5;
}
.rotina-create-desc::placeholder { color: var(--gray-400); }

/* Cores */
.rotina-create-colors {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--gray-100);
}
.rotina-color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.25);
}
.rotina-color-dot:hover { transform: scale(1.15); }
.rotina-color-dot.active { border-color: var(--primary-blue); box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(22,91,255,0.25); }

/* Toolbar inferior */
.rotina-create-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--gray-100);
  margin-top: 4px;
}
.rotina-create-toolbar-left {
  display: flex;
  align-items: center;
  gap: 4px;
}
.rotina-toolbar-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none !important;
  border-radius: var(--radius-sm);
  background: transparent !important;
  color: #3c4043 !important;
  cursor: pointer;
  transition: color 0.15s;
  outline: none !important;
  box-shadow: none !important;
}
.rotina-toolbar-btn i[data-lucide],
.rotina-toolbar-btn svg.lucide {
  width: 18px;
  height: 18px;
  background: transparent !important;
  color: #3c4043 !important;
  fill: #3c4043 !important;
  stroke: #3c4043 !important;
  filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.4)) !important;
}
.rotina-toolbar-btn:hover {
  background: transparent !important;
  color: #3c4043 !important;
}

.rotina-create-close {
  border: none;
  background: transparent;
  color: var(--primary-blue);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.rotina-create-close:hover { background: var(--primary-blue-soft); }

/* Date/Time Picker */
.rotina-datetime-panel {
  padding: 16px 0 8px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rotina-datetime-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rotina-datetime-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 40px;
}
.rotina-datetime-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-primary);
  background: white;
  outline: none;
  transition: border-color 0.15s;
}
.rotina-datetime-input:focus { border-color: var(--primary-blue); box-shadow: var(--focus-ring); }
.rotina-datetime-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}
.rotina-datetime-cancel {
  border: none;
  background: transparent;
  color: var(--muted-text);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.rotina-datetime-cancel:hover { background: var(--gray-100); }
.rotina-datetime-confirm {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: var(--primary-blue);
  color: white;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.rotina-datetime-confirm i { width: 14px; height: 14px; }
.rotina-datetime-confirm:hover { background: var(--primary-blue-dark); }
.rotina-datetime-selected {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--primary-blue-soft);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--primary-blue);
  margin-top: 4px;
}
.rotina-datetime-selected i { width: 14px; height: 14px; }

/* Dropdowns da toolbar */
.rotina-toolbar-dropdown-wrap {
  position: relative;
}
.rotina-toolbar-dropdown {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-100);
  min-width: 240px;
  padding: 6px;
  z-index: 10;
  animation: fadeUp 0.15s ease;
}
.rotina-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.rotina-dropdown-item:hover { background: var(--gray-100); }
.rotina-dropdown-item i { width: 16px; height: 16px; opacity: 0.6; }
.rotina-dropdown-item.active { background: var(--primary-blue-soft); color: var(--primary-blue); }

/* ---- Responsivo ---- */
@media (max-width: 1100px) {
  .rotina-layout { grid-template-columns: 260px 1fr; }
  .rotina-kanban { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .rotina-layout { grid-template-columns: 1fr; }
  .rotina-sidebar { position: static; flex-direction: row; flex-wrap: wrap; gap: 16px; }
  .rotina-card { flex: 1; min-width: 220px; }
  .rotina-kanban { grid-template-columns: 1fr; }
}

/* ============================================
   COMING SOON · TELA EM DESENVOLVIMENTO
   ============================================ */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
  text-align: center;
}
.coming-soon-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.coming-soon-icon i {
  width: 36px;
  height: 36px;
  color: var(--primary-blue);
  opacity: 0.5;
}
.coming-soon-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}
.coming-soon-text {
  font-size: 14px;
  color: var(--muted-text);
  line-height: 1.6;
  max-width: 360px;
}
.coming-soon-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 18px;
  background: rgba(22, 91, 255, 0.1);
  color: var(--primary-blue);
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
}
.coming-soon-badge i { width: 14px; height: 14px; }

/* ============================================
   POMODORO · GESTÃO DE TEMPO E FOCO
   ============================================ */

/* Full-screen overrides when pomodoro is active */
.main.pomo-mode .topbar { display: none; }
.main.pomo-mode .content { padding: 0; flex: 0; }
.main.pomo-mode #page-pomodoro { display: flex; }
.sidebar.pomo-white {
  background: #ffffff !important;
  border-right: 1px solid var(--gray-200) !important;
}
.theme-dark .sidebar.pomo-white {
  background: #0F172A !important;
  border-right: 1px solid #334155 !important;
}

/* Full-width blue container */
.pomo-full {
  width: 100%;
  height: 100vh;
  background: #2563EB;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 0 24px 32px;
  box-sizing: border-box;
  overflow-y: auto;
}

/* ---- Integrated Header ---- */
.pomo-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  flex-shrink: 0;
}
.pomo-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.pomo-title {
  font-size: 18px;
  font-weight: 800;
  color: white;
  line-height: 1.2;
}
.pomo-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.2;
}
.pomo-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pomo-hdr-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.pomo-hdr-btn:hover { background: rgba(255, 255, 255, 0.25); }
.pomo-hdr-btn i { width: 18px; height: 18px; }
.pomo-hdr-add {
  background: rgba(255, 255, 255, 0.25);
}

/* ---- Tabs (pílula) ---- */
.pomo-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  padding: 4px;
}
.pomo-tab {
  border: none;
  border-radius: 50px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  color: rgba(255, 255, 255, 0.85);
  background: transparent;
  white-space: nowrap;
}
.pomo-tab:hover {
  background: rgba(255, 255, 255, 0.15);
}
.pomo-tab.active {
  background: white;
  color: #1e40af;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ---- Relógio circular ---- */
.pomo-clock-ring {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.pomo-clock-ring::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}
.pomo-clock {
  font-size: 72px;
  font-weight: 800;
  color: white;
  font-variant-numeric: tabular-nums;
  letter-spacing: 3px;
  z-index: 1;
  user-select: none;
}

/* ---- Controles ---- */
.pomo-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}
.pomo-ctrl-btn {
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pomo-ctrl-btn i { width: 22px; height: 22px; }

.pomo-play-btn {
  width: 72px;
  height: 72px;
  background: white;
  color: #1e40af;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
.pomo-play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
}
.pomo-play-btn:active { transform: scale(0.96); }
.pomo-play-btn i { width: 30px; height: 30px; }

.pomo-reset-btn {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
}
.pomo-reset-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ---- Dots + ciclo ---- */
.pomo-footer {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pomo-dots {
  display: flex;
  gap: 10px;
}
.pomo-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transition: all 0.3s ease;
}
.pomo-dot.filled {
  background: rgba(255, 255, 255, 0.7);
}
.pomo-dot.active {
  background: white;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}
.pomo-cycle-num {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
}

/* ---- Mensagem motivação ---- */
.pomo-motivation {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
}

/* ---- Settings trigger ---- */
.pomo-settings-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 50px;
  padding: 10px 24px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.pomo-settings-trigger:hover { background: rgba(255, 255, 255, 0.25); }
.pomo-settings-trigger i { width: 16px; height: 16px; }

/* ---- Settings Modal ---- */
.pomo-settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 960;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.pomo-settings-modal {
  background: white;
  border-radius: 16px;
  width: 400px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: slideUp 0.25s ease;
}

.pomo-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.pomo-settings-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}
.pomo-settings-close {
  background: none;
  border: none;
  color: var(--muted-text);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pomo-settings-close:hover { background: var(--gray-100); }
.pomo-settings-close i { width: 18px; height: 18px; }

.pomo-settings-body { padding: 20px 24px; }
.pomo-settings-section { margin-bottom: 20px; }
.pomo-settings-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.pomo-settings-row { display: flex; gap: 12px; }
.pomo-settings-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pomo-settings-field span {
  font-size: 12px;
  color: var(--text-secondary);
}
.pomo-settings-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: white;
  text-align: center;
}
.pomo-settings-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(22,91,255,0.12);
}
.pomo-settings-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: white;
}
.pomo-settings-range { width: 100%; margin-top: 6px; }

.pomo-settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 0;
}
.pomo-settings-toggle-row span {
  font-size: 13px;
  color: var(--text-primary);
}

.pomo-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.pomo-toggle input { display: none; }
.pomo-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 12px;
  transition: background 0.2s;
}
.pomo-toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.pomo-toggle input:checked + .pomo-toggle-slider { background: var(--primary-blue); }
.pomo-toggle input:checked + .pomo-toggle-slider::after { transform: translateX(20px); }

.pomo-settings-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 20px;
}
.pomo-settings-ok {
  padding: 10px 28px;
  background: var(--primary-blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.pomo-settings-ok:hover { background: var(--primary-blue-dark); }
.pomo-settings-cancel {
  padding: 10px 20px;
  background: var(--gray-100);
  color: var(--text-secondary);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.pomo-settings-cancel:hover { background: var(--gray-200); }

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .pomo-clock { font-size: 52px; }
  .pomo-clock-ring { width: 200px; height: 200px; }
  .pomo-play-btn { width: 60px; height: 60px; }
  .pomo-play-btn i { width: 26px; height: 26px; }
  .pomo-tab { padding: 8px 16px; font-size: 13px; }
}



/* Skeleton loading for client grid */
.client-loading {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 16px 0;
}
.skeleton-card {
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  height: 140px;
  position: relative;
  overflow: hidden;
}
.skeleton-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: skeleton-shimmer 1.5s infinite;
}
@keyframes skeleton-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================
   AUDITORIA
   ============================================ */
.audit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.audit-title {
  font: 700 22px 'Inter', sans-serif;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.5px;
}
.audit-subtitle {
  font: 400 13px 'Inter', sans-serif;
  color: var(--muted-text);
  margin: 4px 0 0;
}
.audit-header-actions {
  display: flex;
  gap: 8px;
}

/* KPI Row */
.audit-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.audit-kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
}
.audit-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.audit-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.audit-kpi-icon i { width: 22px; height: 22px; }
.audit-kpi-icon.blue   { background: var(--primary-blue-soft); color: var(--primary-blue); }
.audit-kpi-icon.green  { background: #E6F7EE; color: #10B981; }
.audit-kpi-icon.purple { background: #EDE9FE; color: #A855F7; }
.audit-kpi-icon.amber  { background: #FEF6E0; color: #F0A500; }
.audit-kpi-label {
  font: 400 12px 'Inter', sans-serif;
  color: var(--muted-text);
  margin: 0;
}
.audit-kpi-value {
  font: 700 26px 'Inter', sans-serif;
  color: var(--text-primary);
  margin: 4px 0 0;
}

/* Filters */
.audit-filters {
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.audit-filters-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.audit-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 130px;
}
.audit-filter-group label {
  font: 500 11px 'Inter', sans-serif;
  color: var(--muted-text);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.audit-filter-group select {
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font: 400 13px 'Inter', sans-serif;
  color: var(--text-primary);
  background: var(--card-bg);
  cursor: pointer;
  transition: var(--transition-base);
}
.audit-filter-group select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: var(--focus-ring);
}
.audit-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-bg);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 7px 12px;
}
.audit-search i { width: 16px; height: 16px; color: var(--muted-text); flex-shrink: 0; }
.audit-search input {
  border: none;
  background: transparent;
  font: 400 13px 'Inter', sans-serif;
  color: var(--text-primary);
  width: 100%;
  outline: none;
}
.audit-search input::placeholder { color: var(--muted-text); }

/* Tabs */
.audit-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
}
.audit-tab {
  padding: 10px 20px;
  font: 500 13px 'Inter', sans-serif;
  color: var(--muted-text);
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  transition: var(--transition-base);
}
.audit-tab:hover { color: var(--text-primary); }
.audit-tab.active {
  color: var(--primary-blue);
  font-weight: 600;
}
.audit-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary-blue);
  border-radius: 2px 2px 0 0;
}
.audit-tab-content { display: none; }
.audit-tab-content.active { display: block; }

/* Table */
.audit-table-wrap {
  overflow-x: auto;
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.audit-table {
  width: 100%;
  border-collapse: collapse;
}
.audit-table thead th {
  padding: 12px 16px;
  text-align: left;
  font: 600 11px 'Inter', sans-serif;
  color: var(--muted-text);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: var(--surface-bg);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.audit-table tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.15s ease;
}
.audit-table tbody tr:last-child { border-bottom: none; }
.audit-table tbody tr:hover { background: var(--surface-bg); }
.audit-table tbody td {
  padding: 12px 16px;
  font: 400 13px 'Inter', sans-serif;
  color: var(--text-primary);
  vertical-align: middle;
}

/* Table cell helpers */
.audit-user-name {
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}
.audit-user-hash {
  font: 400 11px 'Inter', sans-serif;
  color: var(--muted-text);
  display: block;
  margin-top: 2px;
}
.audit-action-name {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  display: block;
}
.audit-action-url {
  font: 400 11px 'Inter', sans-serif;
  color: var(--muted-text);
  display: block;
  margin-top: 2px;
}
.audit-module-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font: 500 11px 'Inter', sans-serif;
  background: var(--primary-blue-soft);
  color: var(--primary-blue);
  white-space: nowrap;
}
.audit-device {
  display: flex;
  align-items: center;
  gap: 6px;
}
.audit-device i { width: 16px; height: 16px; color: var(--muted-text); }

/* Pagination */
.audit-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font: 400 12px 'Inter', sans-serif;
  color: var(--muted-text);
}
.audit-pagination-btns {
  display: flex;
  gap: 6px;
}
.audit-pagination-btn {
  padding: 5px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--card-bg);
  font: 500 12px 'Inter', sans-serif;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-base);
}
.audit-pagination-btn:hover { border-color: var(--primary-blue); color: var(--primary-blue); }
.audit-pagination-btn.active {
  background: var(--primary-blue);
  color: #fff;
  border-color: var(--primary-blue);
}

/* Educação Tab */
.audit-edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.audit-edu-card {
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.audit-edu-card i {
  width: 32px;
  height: 32px;
  color: var(--primary-blue);
}
.audit-edu-card h4 {
  font: 600 15px 'Inter', sans-serif;
  color: var(--text-primary);
  margin: 0;
}
.audit-edu-card p {
  font: 400 13px 'Inter', sans-serif;
  color: var(--muted-text);
  margin: 0;
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 1100px) {
  .audit-kpi-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .audit-kpi-row { grid-template-columns: 1fr; }
  .audit-filters-row { flex-direction: column; }
  .audit-header { flex-direction: column; }
}

/* ============================================
   ADMINISTRADOR VIEW
   ============================================ */
.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.admin-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.6rem; font-weight: 700; color: var(--text-dark, #1a1a2e); margin: 0;
}
.admin-title i { width: 28px; height: 28px; color: var(--primary, #3b82f6); }
.admin-subtitle { color: var(--text-muted, #6b7280); font-size: 0.9rem; margin: 2px 0 0; }

/* Tabs */
.admin-tabs {
  display: flex; gap: 0; border-bottom: 2px solid #e5e7eb;
  margin-bottom: 24px; overflow-x: auto;
}
.admin-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 20px; border: none; background: none;
  font-size: 0.88rem; font-weight: 500; color: #6b7280;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.2s; white-space: nowrap;
}
.admin-tab i { width: 16px; height: 16px; }
.admin-tab:hover { color: var(--primary, #3b82f6); background: #f8fafc; }
.admin-tab.active {
  color: var(--primary, #3b82f6); border-bottom-color: var(--primary, #3b82f6);
  font-weight: 600;
}

/* Tab content */
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }

/* Section header */
.admin-section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.admin-section-text { color: #6b7280; font-size: 0.9rem; margin: 0; }
.admin-section-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Table */
.admin-table-wrap {
  background: #fff; border-radius: 12px; border: 1px solid #e5e7eb;
  overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.admin-table {
  width: 100%; border-collapse: collapse; font-size: 0.88rem;
}
.admin-table thead { background: #f8fafc; }
.admin-table th {
  padding: 12px 16px; text-align: left; font-weight: 600;
  color: #374151; border-bottom: 1px solid #e5e7eb; white-space: nowrap;
}
.admin-table td {
  padding: 12px 16px; border-bottom: 1px solid #f1f5f9; color: #1f2937;
}
.admin-table tbody tr:hover { background: #f8fafc; }
.admin-table tbody tr:last-child td { border-bottom: none; }

/* User cell */
.admin-user-cell { display: flex; align-items: center; gap: 10px; }
.admin-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--primary, #3b82f6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}

/* Badges */
.admin-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600;
}
.admin-badge-admin { background: #eff6ff; color: #2563eb; }
.admin-badge-marketing { background: #f0fdf4; color: #16a34a; }

/* Status */
.admin-status { font-size: 0.82rem; font-weight: 500; }
.admin-status-ativo { color: #16a34a; }
.admin-status-inativo { color: #dc2626; }
.admin-status-pendente { color: #d97706; }

/* Actions cell */
.admin-actions-cell { display: flex; gap: 6px; align-items: center; }

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: none;
  background: var(--primary, #3b82f6); color: #fff;
  font-size: 0.88rem; font-weight: 600; cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover { background: #2563eb; }
.btn-primary i { width: 16px; height: 16px; }
.btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  border: 1px solid #d1d5db; background: #fff; color: #374151;
  font-size: 0.88rem; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.btn-outline:hover { background: #f9fafb; border-color: #9ca3af; }
.btn-outline i { width: 16px; height: 16px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px; border: none;
  background: transparent; color: #6b7280; font-size: 0.85rem;
  font-weight: 500; cursor: pointer; transition: all 0.2s;
}
.btn-ghost:hover { background: #f3f4f6; color: #374151; }
.btn-ghost i { width: 16px; height: 16px; }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; border-radius: 6px; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px; border: none;
  background: transparent; color: #6b7280; cursor: pointer;
  transition: all 0.2s;
}
.btn-icon:hover { background: #f3f4f6; color: #374151; }
.btn-icon i { width: 16px; height: 16px; }
.btn-icon-danger:hover { background: #fef2f2; color: #dc2626; }

/* Input */
.admin-input {
  padding: 8px 12px; border-radius: 8px; border: 1px solid #d1d5db;
  font-size: 0.88rem; background: #fff; color: #1f2937;
  outline: none; transition: border-color 0.2s;
}
.admin-input:focus { border-color: var(--primary, #3b82f6); }

/* Permissions table */
.admin-table-perms { text-align: center; }
.admin-table-perms th.perm-col-action { text-align: left; min-width: 220px; }
.admin-table-perms th.perm-col-role { text-align: center; min-width: 140px; }
.admin-table-perms td:first-child { text-align: left; font-weight: 500; }
.admin-table-perms td { text-align: center; }

/* Toggle switch for permissions */
.admin-toggle {
  position: relative; display: inline-block; width: 40px; height: 22px;
}
.admin-toggle input { opacity: 0; width: 0; height: 0; }
.admin-toggle-slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: #d1d5db; border-radius: 22px; transition: 0.3s;
}
.admin-toggle-slider::before {
  content: ""; position: absolute; height: 16px; width: 16px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
  transition: 0.3s;
}
.admin-toggle input:checked + .admin-toggle-slider { background: var(--primary, #3b82f6); }
.admin-toggle input:checked + .admin-toggle-slider::before { transform: translateX(18px); }

/* Dev grid */
.admin-dev-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.admin-dev-card {
  background: #fff; border-radius: 12px; border: 1px solid #e5e7eb;
  padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.admin-dev-card h4 { margin: 12px 0 6px; font-size: 0.95rem; color: #1f2937; }
.admin-dev-card p { color: #6b7280; font-size: 0.82rem; margin: 0 0 12px; }
.admin-dev-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.admin-dev-icon i { width: 20px; height: 20px; }
.admin-dev-icon.blue { background: #eff6ff; color: #3b82f6; }
.admin-dev-icon.green { background: #f0fdf4; color: #16a34a; }
.admin-dev-icon.purple { background: #faf5ff; color: #9333ea; }
.admin-dev-icon.orange { background: #fff7ed; color: #ea580c; }

/* Responsive */
@media (max-width: 768px) {
  .admin-header { flex-direction: column; align-items: flex-start; }
  .admin-section-header { flex-direction: column; align-items: flex-start; }
  .admin-table-wrap { overflow-x: auto; }
}
