/* CRM Engage System — Design System
   Baseado na identidade de agencia.engagesystem.shop
   Fontes: Bricolage Grotesque (headings) | Plus Jakarta Sans (body) | IBM Plex Mono (UI/labels)
*/

/* =============================================
   CSS VARIABLES
   ============================================= */
:root {
  /* Backgrounds */
  --bg-base:       #0A0A0B;
  --bg-surface:    #19191C;
  --bg-surface-2:  #15151A;
  --bg-elevated:   #FAF8F4;
  --bg-overlay:    rgba(10, 10, 11, 0.78);

  /* Text */
  --text-primary:  #F6F5F2;
  --text-secondary:#A8A8AC;
  --text-muted:    #55555A;
  --text-dark:     #15151A;

  /* Brand accent */
  --accent:        #3430D0;
  --accent-soft:   #9B88F0;
  --accent-muted:  rgba(155, 136, 240, 0.14);
  --accent-hover:  rgba(52, 48, 208, 0.12);

  /* Borders */
  --border:        rgba(255, 255, 255, 0.09);
  --border-light:  rgba(21, 21, 26, 0.08);

  /* Status */
  --success:       #10B981;
  --warning:       #F59E0B;
  --danger:        #EF4444;
  --info:          #3B82F6;
  --purple:        #8B5CF6;

  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 60px;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  20px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
}

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

html { font-size: 16px; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; }

/* =============================================
   TYPOGRAPHY
   ============================================= */
h1, h2, h3 { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; line-height: 1.1; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.05rem; }
p  { font-size: 0.875rem; line-height: 1.65; color: var(--text-secondary); }

.mono {
  font-family: 'IBM Plex Mono', monospace;
}

.section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

/* =============================================
   LAYOUT — APP SHELL
   ============================================= */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-base);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .dot { color: var(--accent-soft); font-size: 1.3rem; line-height: 1; }
.sidebar-logo .name {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--text-primary);
}

.sidebar-section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 16px 16px 6px;
}

.sidebar-nav { flex: 1; padding: 8px; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar-item:hover { background: var(--bg-surface); color: var(--text-primary); }
.sidebar-item.active { background: var(--accent-hover); color: var(--accent-soft); }
.sidebar-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

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

/* =============================================
   TOPBAR
   ============================================= */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* =============================================
   PAGE CONTENT
   ============================================= */
.page {
  padding: 28px 28px;
  flex: 1;
}

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

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.card-sm { padding: var(--space-md); border-radius: var(--radius-md); }

.card-light {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  color: var(--text-dark);
}

/* =============================================
   STAT CARDS
   ============================================= */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.stat-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-value {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* =============================================
   BADGES & TAGS
   ============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-accent  { background: var(--accent-muted); color: var(--accent-soft); }
.badge-success { background: rgba(16,185,129,0.12); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.12); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,0.12);  color: var(--danger);  }
.badge-info    { background: rgba(59,130,246,0.12); color: var(--info);    }
.badge-purple  { background: rgba(139,92,246,0.12); color: var(--purple);  }
.badge-muted   { background: rgba(255,255,255,0.06); color: var(--text-secondary); }

/* Tag colors for pipeline stages */
.tag-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  transition: opacity 0.15s, background 0.15s;
  cursor: pointer;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }

.btn-primary  { background: var(--accent); color: var(--text-primary); }
.btn-primary:hover { opacity: 0.88; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-surface); color: var(--text-primary); }

.btn-danger { background: rgba(239,68,68,0.12); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }

.btn-sm { padding: 6px 12px; font-size: 0.7rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* =============================================
   FORM ELEMENTS
   ============================================= */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.input, .select, .textarea {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.875rem;
  padding: 10px 14px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(155, 136, 240, 0.5);
  box-shadow: 0 0 0 3px var(--accent-hover);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.select { appearance: none; cursor: pointer; }
.textarea { resize: vertical; min-height: 80px; }

/* =============================================
   KANBAN
   ============================================= */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: calc(100vh - 180px);
}
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-track { background: transparent; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.kanban-column {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  min-width: 272px;
  max-width: 272px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.kanban-column-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}
.kanban-column-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 2px 7px;
  border-radius: 10px;
}

.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: grab;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
  user-select: none;
}
.kanban-card:hover {
  border-color: rgba(155, 136, 240, 0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}
.kanban-card.sortable-ghost {
  opacity: 0.4;
  transform: scale(0.98);
}
.kanban-card.sortable-chosen { box-shadow: 0 8px 32px rgba(0,0,0,0.5); }

.kanban-card-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.kanban-card-contact { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 8px; }
.kanban-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.kanban-card-value { font-family: 'IBM Plex Mono', monospace; font-size: 0.7rem; font-weight: 600; color: var(--success); }

.kanban-add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  width: 100%;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-top: 4px;
}
.kanban-add-btn:hover { background: var(--bg-surface); color: var(--text-secondary); }

/* =============================================
   TABLE
   ============================================= */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  white-space: nowrap;
}
td {
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-header h2 { font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-surface-2); }

.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 0 24px 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* =============================================
   SCROLLBAR GLOBAL
   ============================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* =============================================
   UTILITIES
   ============================================= */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm       { gap: var(--space-sm); }
.gap-md       { gap: var(--space-md); }
.gap-lg       { gap: var(--space-lg); }
.grid-2       { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
.grid-3       { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.grid-4       { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }
.mb-sm        { margin-bottom: var(--space-sm); }
.mb-md        { margin-bottom: var(--space-md); }
.mb-lg        { margin-bottom: var(--space-lg); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-accent  { color: var(--accent-soft); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-mono    { font-family: 'IBM Plex Mono', monospace; }
.font-sm      { font-size: 0.75rem; }
.font-xs      { font-size: 0.65rem; }
.hidden       { display: none !important; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full       { width: 100%; }

/* =============================================
   AVATAR CIRCLE
   ============================================= */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-muted);
  display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-soft);
  flex-shrink: 0;
}
.avatar-sm { width: 24px; height: 24px; font-size: 0.55rem; }

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  gap: 12px;
}
.empty-state svg { width: 36px; height: 36px; opacity: 0.4; }
.empty-state p { font-size: 0.875rem; max-width: 260px; line-height: 1.5; }

/* =============================================
   TOAST / NOTIFICATION
   ============================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideIn 0.25s ease;
}
@keyframes slideIn {
  from { transform: translateX(24px); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger);  }
.toast.info    { border-left: 3px solid var(--accent-soft); }

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 24px;
}
.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.login-logo { display: flex; align-items: center; gap: 8px; margin-bottom: 32px; }

/* =============================================
   ACTIVITY ICONS
   ============================================= */
.activity-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.activity-icon svg { width: 14px; height: 14px; }
.activity-icon.task     { background: rgba(52,48,208,0.15); color: var(--accent-soft); }
.activity-icon.call     { background: rgba(16,185,129,0.15); color: var(--success); }
.activity-icon.whatsapp { background: rgba(37,211,102,0.15); color: #25D366; }
.activity-icon.email    { background: rgba(245,158,11,0.15); color: var(--warning); }
.activity-icon.meeting  { background: rgba(139,92,246,0.15); color: var(--purple); }

/* =============================================
   PIPELINE TABS
   ============================================= */
.pipeline-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  width: fit-content;
}
.pipeline-tab {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.pipeline-tab.active { background: var(--accent); color: var(--text-primary); }
.pipeline-tab:not(.active):hover { background: rgba(255,255,255,0.05); color: var(--text-secondary); }

/* =============================================
   PROGRESS BAR
   ============================================= */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent-soft);
  transition: width 0.4s ease;
}

/* =============================================
   SEARCH
   ============================================= */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrapper svg {
  position: absolute;
  left: 12px;
  width: 14px; height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.875rem;
  padding: 8px 14px 8px 36px;
  outline: none;
  width: 240px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  border-color: rgba(155, 136, 240, 0.5);
  box-shadow: 0 0 0 3px var(--accent-hover);
}
.search-input::placeholder { color: var(--text-muted); }

/* =============================================
   GOAL PROGRESS
   ============================================= */
.goal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.goal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.goal-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.goal-period { font-family: 'IBM Plex Mono', monospace; font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; }
.goal-values { display: flex; justify-content: space-between; margin-bottom: 8px; }
.goal-current { font-family: 'Bricolage Grotesque', sans-serif; font-size: 1.5rem; font-weight: 700; }
.goal-target { font-family: 'IBM Plex Mono', monospace; font-size: 0.75rem; color: var(--text-muted); align-self: flex-end; margin-bottom: 4px; }
