/* Notas - Responsivo */
.note-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  margin-bottom: 18px;
  padding: 18px 16px 12px 16px;
  transition: box-shadow .2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.note-card .note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  margin-bottom: 6px;
}
.note-card .note-title {
  font-size: 1.1em;
  color: var(--primary);
}
.note-card .note-status.a_concluir {
  color: var(--danger);
}
.note-card .note-status.concluida {
  color: var(--success);
}
.note-card .note-content {
  font-size: 1em;
  color: #444;
  margin-bottom: 8px;
}
.note-card .note-actions {
  display: flex;
  gap: 8px;
}
.note-card .note-actions button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.95em;
  transition: background .2s;
}
.note-card .note-actions button:hover {
  background: var(--primary-dark);
}
.empty {
  color: #888;
  text-align: center;
  margin: 32px 0;
}
@media (max-width: 700px) {
  .note-card {
    padding: 12px 8px 8px 8px;
    font-size: 0.98em;
  }
}
/* =========================================================
   WebCRM — Stylesheet Completo 2026
   ========================================================= */

/* ── CSS Variables ── */
:root {
  --primary: #1877f2;
  --primary-dark: #1565c0;
  --primary-light: #64b5f6;
  --primary-alpha: rgba(24,119,242,0.12);
  --secondary: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --purple: #0d47a1;
  --pink: #ec4899;

  --bg: #f1f5f9;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #ffffff;
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-section: #475569;
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;

  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-focus: var(--primary);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
  --topbar-h: 64px;
  --transition: .2s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
ul { list-style: none; }
img { max-width: 100%; }
.hidden { display: none !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* =========================================================
   LOGIN
   ========================================================= */
.login-page { overflow: hidden; min-height: 100vh; }
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f4ff;
  position: relative;
  overflow: hidden;
}
.login-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 10;
  box-shadow: 0 8px 40px rgba(24,119,242,.12);
}
.login-brand { text-align: center; margin-bottom: 32px; }
.brand-icon {
  width: 72px; height: 72px;
  background: var(--primary);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(24,119,242,.35);
  overflow: hidden;
}
.login-brand h1 { font-size: 28px; font-weight: 800; color: #0f172a; letter-spacing: -0.5px; }
.login-brand p { color: #64748b; font-size: 14px; margin-top: 4px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; color: #64748b; font-size: 13px; font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .5px; }
.login-form label i { margin-right: 6px; }
.login-form input {
  width: 100%; padding: 12px 16px;
  background: #f8faff;
  border: 1px solid #d1d9f0;
  border-radius: var(--radius-sm);
  color: #0f172a; font-size: 15px;
  transition: var(--transition);
  outline: none;
}
.login-form input:focus { border-color: var(--primary); background: #eef4ff; box-shadow: 0 0 0 3px rgba(24,119,242,.1); }
.login-form input::placeholder { color: #94a3b8; }
.input-icon-right { position: relative; }
.input-icon-right input { padding-right: 44px; }
.toggle-pass { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: #94a3b8; cursor: pointer; }
.login-options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; color: #64748b; font-size: 13px; cursor: pointer; }
.checkbox-label input { accent-color: var(--primary); width: 15px; height: 15px; }
.login-options a { color: var(--primary); font-size: 13px; }
.login-footer { text-align: center; margin-top: 24px; }
.login-footer small { color: #94a3b8; font-size: 12px; }

/* input de recuperação com foco igual aos do login */
#forgot-email:focus {
  border-color: var(--primary) !important;
  background: #eef4ff !important;
  box-shadow: 0 0 0 3px rgba(24,119,242,.1) !important;
}
#forgot-email::placeholder { color: #94a3b8; }

/* Login BG Shapes */
.login-bg-shapes .shape {
  position: absolute; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #64b5f6);
  opacity: .08; pointer-events: none;
}
.shape.s1 { width: 500px; height: 500px; top: -150px; right: -150px; }
.shape.s2 { width: 280px; height: 280px; bottom: 0%; left: -80px; }
.shape.s3 { width: 140px; height: 140px; bottom: 30%; right: 5%; }

/* =========================================================
   APP SHELL
   ========================================================= */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: width .3s ease;
  overflow: hidden;
  z-index: 100;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .brand-name,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-section,
.sidebar.collapsed span:not(.badge),
.sidebar-bottom .sidebar.collapsed span { opacity: 0; width: 0; overflow: hidden; white-space: nowrap; }

.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand-icon-sm {
  width: 40px; height: 40px; flex-shrink: 0;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; color: #fff;
}
.brand-name { font-size: 18px; font-weight: 800; color: #fff; letter-spacing: -.5px; flex: 1; }
.sidebar-toggle-btn { color: #475569; font-size: 16px; padding: 4px; transition: color .2s; }
.sidebar-toggle-btn:hover { color: #fff; }

.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; margin: 0 8px 8px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
}
.user-avatar {
  width: 36px; height: 36px; flex-shrink: 0;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
}
.user-name { display: block; font-size: 13px; font-weight: 600; color: #fff; }
.user-role { display: block; font-size: 11px; color: var(--sidebar-text); }

/* Nav */
.sidebar-nav { flex: 1; padding: 8px; overflow-y: auto; overflow-x: hidden; }
.nav-section {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--sidebar-section);
  padding: 16px 12px 6px;
  text-transform: uppercase;
}
.sidebar-nav li a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-size: 14px; font-weight: 500;
  transition: all .2s; position: relative;
}
.sidebar-nav li a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav li a.active { background: var(--primary-alpha); color: var(--primary-light); }
.sidebar-nav li a.active i { color: var(--primary); }
.sidebar-nav li a i { width: 18px; font-size: 15px; flex-shrink: 0; }

.sidebar-bottom {
  padding: 12px 8px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.btn-logout {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: #ef4444; font-size: 14px; font-weight: 500;
  transition: all .2s;
}
.btn-logout:hover { background: rgba(239,68,68,.1); }
.btn-logout i { width: 18px; flex-shrink: 0; }

/* BADGES */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; font-size: 11px; font-weight: 700;
  margin-left: auto;
}
.badge-danger { background: var(--danger); color: #fff; }
.badge-warning { background: var(--warning); color: #fff; }
.badge-primary { background: var(--primary); color: #fff; }
.badge-success { background: var(--success); color: #fff; }
.badge-info { background: var(--info); color: #fff; }

/* ── MAIN AREA ── */
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h); background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  position: relative; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.breadcrumb { font-size: 18px; font-weight: 700; color: var(--text); }
.mobile-menu-btn { display: none; color: var(--text-muted); font-size: 20px; padding: 4px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.search-global { position: relative; }
.search-global i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-global input {
  padding: 9px 12px 9px 36px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 24px; font-size: 14px; width: 260px;
  transition: var(--transition); outline: none;
}
.search-global input:focus { border-color: var(--primary); width: 320px; }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 200; max-height: 360px; overflow-y: auto;
}
.search-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer; transition: background .15s;
}
.search-item:hover { background: var(--bg); }
.search-item-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.search-item-info strong { display: block; font-size: 13px; }
.search-item-info small { color: var(--text-muted); font-size: 11px; }

.topbar-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 16px; transition: all .2s;
  position: relative;
}
.topbar-icon:hover { background: var(--primary-alpha); color: var(--primary); border-color: var(--primary); }
.notif-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--bg-card);
}
.topbar-user { position: relative; cursor: pointer; }
.user-avatar-sm {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 180px; z-index: 200; overflow: hidden;
}
.user-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: var(--text); font-size: 14px;
  transition: background .15s;
}
.user-dropdown a:hover { background: var(--bg); }
.user-dropdown i { width: 16px; color: var(--text-muted); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ── PAGE CONTENT ── */
.page-content {
  flex: 1; overflow-y: auto; padding: 24px;
  background: var(--bg);
}

/* =========================================================
   COMMON COMPONENTS
   ========================================================= */

/* Page Header */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 22px; font-weight: 800; color: var(--text); }
.page-header p { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Cards */
.card {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 24px;
  box-shadow: var(--shadow);
}
/* Cards com estrutura card-header/card-body ficam sem padding externo */
.card:has(> .card-header) { padding: 0; overflow: hidden; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; margin-bottom: 0; border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 15px; font-weight: 700; margin: 0; }
.card-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.card-title { font-size: 15px; font-weight: 700; margin: 0; }
.card-body { padding: 20px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; transition: all .2s;
  white-space: nowrap; cursor: pointer; border: none;
}
.btn i { font-size: 13px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(24,119,242,.3); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-info { background: var(--info); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-outline-primary { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary-alpha); }
.btn-outline-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: rgba(239,68,68,.08); }
.btn-outline-success { background: transparent; border: 1px solid var(--success); color: var(--success); }
.btn-outline-success:hover { background: rgba(16,185,129,.08); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 13px 24px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; }
.btn-icon-sm { width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px;
}
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text);
  transition: var(--transition); outline: none;
}
.form-control:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(24,119,242,.12); }
.form-control::placeholder { color: var(--text-light); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-control-sm { padding: 7px 12px; font-size: 13px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.table th {
  background: var(--bg); padding: 11px 16px;
  text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: rgba(24,119,242,.04); }
.table-actions { display: flex; gap: 6px; }

/* Chips/Tags */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.tag-primary { background: var(--primary-alpha); color: var(--primary); }
.tag-success { background: rgba(16,185,129,.12); color: var(--success); }
.tag-danger { background: rgba(239,68,68,.12); color: var(--danger); }
.tag-warning { background: rgba(245,158,11,.12); color: var(--warning); }
.tag-info { background: rgba(6,182,212,.12); color: var(--info); }
.tag-muted { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.tag-purple { background: rgba(139,92,246,.12); color: var(--purple); }

/* Avatar */
.avatar {
  border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 700; color: #fff; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--purple));
}
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 16px; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }

/* Loading */
.loading-spinner {
  display: flex; align-items: center; justify-content: center;
  padding: 80px; color: var(--primary); font-size: 32px;
}

/* Empty state */
.empty-state {
  text-align: center; padding: 60px 24px; color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: .4; display: block; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 24px; }

/* =========================================================
   KPIs / STAT CARDS
   ========================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px 24px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-card-icon {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 12px;
}
.kpi-card-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.kpi-card-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.kpi-card-delta { font-size: 12px; font-weight: 600; margin-top: 8px; }
.kpi-card-delta.up { color: var(--success); }
.kpi-card-delta.down { color: var(--danger); }
.kpi-card.primary .kpi-card-icon { background: var(--primary-alpha); color: var(--primary); }
.kpi-card.success .kpi-card-icon { background: rgba(16,185,129,.12); color: var(--success); }
.kpi-card.warning .kpi-card-icon { background: rgba(245,158,11,.12); color: var(--warning); }
.kpi-card.danger .kpi-card-icon { background: rgba(239,68,68,.12); color: var(--danger); }
.kpi-card.info .kpi-card-icon { background: rgba(6,182,212,.12); color: var(--info); }
.kpi-card.purple .kpi-card-icon { background: rgba(139,92,246,.12); color: var(--purple); }
.kpi-card-bg {
  position: absolute; right: -10px; bottom: -10px;
  font-size: 80px; opacity: .04; pointer-events: none;
}

/* =========================================================
   KANBAN BOARD (Leads / Deals)
   ========================================================= */
.kanban-wrap { overflow-x: auto; padding-bottom: 16px; }
.kanban-board {
  display: flex; gap: 16px;
  min-width: max-content; align-items: flex-start;
}
.kanban-col {
  width: 280px; flex-shrink: 0;
  background: var(--bg); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.kanban-col-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.kanban-col-color { width: 4px; height: 20px; border-radius: 2px; flex-shrink: 0; }
.kanban-col-title { font-size: 13px; font-weight: 700; flex: 1; }
.kanban-col-count {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 8px; font-size: 11px; font-weight: 600;
  color: var(--text-muted);
}
.kanban-col-total { font-size: 11px; color: var(--text-muted); }

.kanban-cards {
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
  min-height: 100px;
}
.kanban-card {
  background: var(--bg-card); border-radius: var(--radius-sm);
  border: 1px solid var(--border); padding: 14px;
  cursor: grab; box-shadow: var(--shadow);
  transition: all .2s; position: relative;
}
.kanban-card:hover { box-shadow: var(--shadow-lg); border-color: var(--primary-light); transform: translateY(-1px); }
.kanban-card.sortable-ghost { opacity: .4; background: var(--primary-alpha); border: 2px dashed var(--primary); }
.kanban-card.sortable-drag { box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.kanban-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.kanban-card-name { font-size: 13px; font-weight: 700; color: var(--text); flex: 1; }
.kanban-card-company { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.kanban-card-value { font-size: 15px; font-weight: 800; color: var(--success); }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.kanban-card-date { font-size: 11px; color: var(--text-light); }
.kanban-card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.kanban-card-priority {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
}
.priority-high { background: var(--danger); }
.priority-medium { background: var(--warning); }
.priority-low { background: var(--success); }

.kanban-add-card {
  margin: 0 10px 10px; padding: 8px 10px;
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
  text-align: center; color: var(--text-muted); font-size: 13px;
  cursor: pointer; transition: all .2s;
}
.kanban-add-card:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-alpha); }

/* =========================================================
   PIPELINE STAGES BAR
   ========================================================= */
.pipeline-stages {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 24px; overflow-x: auto;
}
.stage-step {
  display: flex; align-items: center;
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 10px 20px 10px 28px;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; position: relative; white-space: nowrap;
  transition: all .2s; clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%);
  margin-right: -1px;
}
.stage-step:first-child { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%); }
.stage-step.active { background: var(--primary); color: #fff; border-color: var(--primary); z-index: 1; }
.stage-step.completed { background: var(--success); color: #fff; border-color: var(--success); }
.stage-step span { font-size: 11px; opacity: .7; margin-left: 6px; }

/* =========================================================
   CHAT INTERFACE
   ========================================================= */
.chat-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  min-height: 0;
  background: var(--bg-card);
  border-radius: var(--radius); border: 1px solid var(--border);
  overflow: hidden; box-shadow: var(--shadow);
}
.chat-sidebar {
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-card);
}
.chat-sidebar-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.chat-sidebar-header h3 { font-size: 16px; font-weight: 700; }
.chat-search { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.chat-search input {
  width: 100%; padding: 8px 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; font-size: 13px; outline: none;
}
.chat-channels { flex: 1; overflow-y: auto; padding: 8px; }
.chat-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--text-muted); padding: 10px 12px 6px;
  text-transform: uppercase;
}
.chat-channel {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .15s;
}
.chat-channel:hover { background: var(--bg); }
.chat-channel.active { background: var(--primary-alpha); }
.chat-channel-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.chat-channel-info { flex: 1; min-width: 0; }
.chat-channel-name { font-size: 13px; font-weight: 600; color: var(--text); }
.chat-channel-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-channel-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.chat-channel-time { font-size: 10px; color: var(--text-light); }
.chat-channel-unread {
  background: var(--primary); color: #fff;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.chat-main { display: flex; flex-direction: column; overflow: hidden; }
.chat-mobile-back { display: none; }
.chat-sidebar-overlay { display: none; }
.chat-main-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.chat-main-title { display: flex; align-items: center; gap: 10px; }
.chat-main-title h3 { font-size: 16px; font-weight: 700; }
.chat-main-title small { font-size: 12px; color: var(--text-muted); margin-left: 4px; }
.chat-online-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.chat-msg { display: flex; gap: 10px; max-width: 80%; }
.chat-msg.own { flex-direction: row-reverse; align-self: flex-end; }
.chat-msg-avatar { flex-shrink: 0; margin-top: 4px; }
.chat-msg-bubble {
  background: var(--bg); border-radius: 16px 16px 16px 4px;
  padding: 10px 14px; max-width: 100%;
}
.chat-msg.own .chat-msg-bubble {
  background: var(--primary); color: #fff;
  border-radius: 16px 16px 4px 16px;
}
.chat-msg-sender { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.chat-msg.own .chat-msg-sender { color: rgba(255,255,255,.7); }
.chat-msg-text { font-size: 14px; line-height: 1.5; }
.chat-msg-time { font-size: 10px; color: var(--text-light); margin-top: 4px; text-align: right; }
.chat-msg.own .chat-msg-time { color: rgba(255,255,255,.6); }

/* Indicador de digitação */
.typing-dots { display:inline-flex; align-items:center; gap:3px; }
.typing-dots span { width:6px; height:6px; background:var(--text-muted); border-radius:50%; animation:typing-bounce 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay:.2s; }
.typing-dots span:nth-child(3) { animation-delay:.4s; }
@keyframes typing-bounce { 0%,60%,100% { transform:translateY(0); } 30% { transform:translateY(-5px); } }

.chat-input-area {
  padding: 16px 20px; border-top: 1px solid var(--border);
}
.chat-input-box {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 16px; padding: 8px 12px;
  transition: border-color .2s;
}
.chat-input-box:focus-within { border-color: var(--primary); }
.chat-input-box textarea {
  flex: 1; border: none; background: transparent; resize: none;
  font-size: 14px; outline: none; max-height: 100px; min-height: 24px; line-height: 1.5;
}
.chat-input-actions { display: flex; gap: 6px; align-items: center; }
.chat-input-btn { color: var(--text-muted); font-size: 16px; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.chat-input-btn:hover { background: var(--border); color: var(--primary); }
.chat-send-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all .2s; flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--primary-dark); }

/* =========================================================
   ACTIVITIES / TIMELINE
   ========================================================= */
.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: ''; position: absolute; left: 12px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
  position: absolute; left: -26px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--border); z-index: 1;
}
.timeline-content {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
}
.timeline-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.timeline-title { font-size: 13px; font-weight: 700; }
.timeline-time { font-size: 11px; color: var(--text-muted); }
.timeline-body { font-size: 13px; color: var(--text-muted); }

/* Task card */
.task-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: all .2s; cursor: pointer;
}
.task-card:hover { box-shadow: var(--shadow); border-color: var(--primary-light); }
.task-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border); flex-shrink: 0; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; cursor: pointer;
}
.task-check.done { background: var(--success); border-color: var(--success); color: #fff; font-size: 10px; }
.task-info { flex: 1; min-width: 0; }
.task-name { font-size: 14px; font-weight: 600; }
.task-name.done { text-decoration: line-through; color: var(--text-muted); }
.task-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; display: flex; gap: 10px; align-items: center; }
.task-due { font-size: 12px; font-weight: 600; }
.task-due.overdue { color: var(--danger); }
.task-due.today { color: var(--warning); }

/* =========================================================
   AUTOMATION BUILDER
   ========================================================= */
.automation-canvas {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); min-height: 500px;
  padding: 24px; position: relative; overflow: auto;
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
}
.flow-node {
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
  display: inline-flex; align-items: center; gap: 12px;
  cursor: pointer; position: relative; box-shadow: var(--shadow);
  transition: all .2s; white-space: nowrap; min-width: 200px;
}
.flow-node:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.flow-node.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-alpha); }
.flow-node.trigger { border-color: var(--success); }
.flow-node.trigger .flow-node-icon { background: rgba(16,185,129,.15); color: var(--success); }
.flow-node.condition { border-color: var(--warning); }
.flow-node.condition .flow-node-icon { background: rgba(245,158,11,.15); color: var(--warning); }
.flow-node.action { border-color: var(--primary); }
.flow-node.action .flow-node-icon { background: var(--primary-alpha); color: var(--primary); }
.flow-node-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.flow-node-info { flex: 1; }
.flow-node-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.flow-node-title { font-size: 14px; font-weight: 700; }
.flow-arrow { text-align: center; color: var(--text-muted); padding: 4px; font-size: 18px; }
.flow-row { display: flex; gap: 16px; align-items: flex-start; }
.flow-branch { border: 2px dashed var(--border); border-radius: var(--radius); padding: 16px; flex: 1; }
.flow-branch-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.flow-branch.yes { border-color: var(--success); }
.flow-branch.yes .flow-branch-label { color: var(--success); }
.flow-branch.no { border-color: var(--danger); }
.flow-branch.no .flow-branch-label { color: var(--danger); }

/* =========================================================
   REPORTS / CHARTS
   ========================================================= */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px; margin-top: 24px;
}
.chart-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.chart-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 20px; }
.chart-container { position: relative; }

/* Funnel viz */
.funnel-chart { padding: 16px 0; }
.funnel-stage {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.funnel-label { width: 120px; font-size: 13px; font-weight: 600; text-align: right; flex-shrink: 0; }
.funnel-bar-wrap { flex: 1; background: var(--bg); border-radius: 4px; height: 32px; overflow: hidden; }
.funnel-bar { height: 100%; border-radius: 4px; display: flex; align-items: center; padding-left: 10px; color: #fff; font-size: 12px; font-weight: 700; transition: width .8s ease; }
.funnel-count { width: 50px; font-size: 13px; font-weight: 700; color: var(--text-muted); }

/* =========================================================
   IMPORT PAGE
   ========================================================= */
.import-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 48px 24px; text-align: center; cursor: pointer;
  transition: all .2s; background: var(--bg);
}
.import-zone:hover, .import-zone.dragging { border-color: var(--primary); background: var(--primary-alpha); }
.import-zone i { font-size: 48px; color: var(--text-light); margin-bottom: 16px; display: block; }
.import-zone h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.import-zone p { color: var(--text-muted); font-size: 14px; }
.import-preview { margin-top: 24px; }
.field-mapper { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px 16px; align-items: center; }
.field-mapper-arrow { text-align: center; color: var(--text-muted); }

/* =========================================================
   SETTINGS
   ========================================================= */
.settings-layout {
  display: grid; grid-template-columns: 220px 1fr; gap: 24px;
  align-items: flex-start;
}
.settings-menu { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.settings-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; cursor: pointer; transition: background .15s;
  font-size: 14px; color: var(--text-muted); border-left: 3px solid transparent;
}
.settings-menu-item:hover { background: var(--bg); }
.settings-menu-item.active { background: var(--primary-alpha); color: var(--primary); border-left-color: var(--primary); }
.settings-menu-item i { width: 18px; }

.settings-section h3 { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.settings-section p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

/* Pipeline editor */
.pipeline-col-editor { display: flex; gap: 16px; flex-wrap: wrap; }
.pipeline-stage-edit {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; display: flex; align-items: center; gap: 10px; min-width: 180px;
}
.stage-color-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* User table */
.user-row-avatar { display: flex; align-items: center; gap: 10px; }
.user-row-name { font-size: 14px; font-weight: 600; }
.user-row-email { font-size: 12px; color: var(--text-muted); }

/* =========================================================
   CONTACT DETAIL MODAL
   ========================================================= */
.contact-detail-header {
  display: flex; align-items: flex-start; gap: 20px; padding: 24px;
  border-bottom: 1px solid var(--border); background: linear-gradient(to bottom, var(--primary-alpha), transparent);
}
.contact-detail-body { padding: 0; }
.contact-detail-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 24px; }
.contact-detail-tab {
  padding: 14px 20px; font-size: 14px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .2s;
}
.contact-detail-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.contact-tab-content { padding: 24px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.info-item label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); display: block; margin-bottom: 4px; }
.info-item span { font-size: 14px; font-weight: 500; }

/* =========================================================
   MODAL
   ========================================================= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  animation: fadeIn .2s ease;
}
.modal-box {
  background: var(--bg-card); border-radius: var(--radius-lg);
  width: 100%; max-width: 600px; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 25px 60px rgba(0,0,0,.3);
  animation: slideUp .2s ease;
}
.modal-box.modal-lg { max-width: 900px; }
.modal-box.modal-xl { max-width: 1100px; }
.modal-box.modal-sm { max-width: 400px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; font-weight: 800; }
.modal-close { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 16px; transition: all .2s; }
.modal-close:hover { background: var(--bg); color: var(--danger); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================================
   TOAST NOTIFICATIONS
   ========================================================= */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 2000;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: var(--radius);
  background: var(--bg-card); box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  font-size: 14px; font-weight: 500;
  animation: toastIn .3s ease; min-width: 280px; max-width: 400px;
}
.toast i { font-size: 16px; flex-shrink: 0; }
.toast-success { border-left: 4px solid var(--success); }
.toast-success i { color: var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-error i { color: var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-warning i { color: var(--warning); }
.toast-info { border-left: 4px solid var(--primary); }
.toast-info i { color: var(--primary); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* =========================================================
   MISC
   ========================================================= */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-100 { width: 100%; }

/* Progress Bar */
.progress { background: var(--bg); border-radius: 4px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 4px; transition: width .5s ease; }
.progress-primary { background: var(--primary); }
.progress-success { background: var(--success); }
.progress-warning { background: var(--warning); }
.progress-danger { background: var(--danger); }

/* Score / Temperature */
.lead-score { display: flex; align-items: center; gap: 4px; }
.score-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.score-dot.filled { background: var(--warning); }
.score-dot.high { background: var(--success); }
.score-dot.danger { background: var(--danger); }

/* Pill Select */
.pill-select { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-option {
  padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border); color: var(--text-muted);
  cursor: pointer; transition: all .2s;
}
.pill-option.selected { background: var(--primary); border-color: var(--primary); color: #fff; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: -260px; height: 100vh; transition: left .3s ease; z-index: 300; }
  .sidebar.mobile-open { left: 0; box-shadow: 8px 0 32px rgba(0,0,0,.25); }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.4); z-index: 299;
  }
  .sidebar-overlay.active { display: block; }
  .main-area { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex !important; }
  .search-global input { width: 180px; }
  .search-global input:focus { width: 220px; }
  .settings-layout { grid-template-columns: 1fr; }
  .chat-container { grid-template-columns: 1fr; }
  .chat-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    width: 85vw;
    max-width: 320px;
    height: calc(100vh - var(--topbar-h));
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
    border-right: 1px solid var(--border);
    background: #ffffff !important;
  }
  .chat-sidebar.mobile-open {
    transform: translateX(0);
  }
  .chat-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 199;
  }
  .chat-sidebar-overlay.active { display: block; }
  .chat-mobile-back { display: flex !important; }
}
@media (max-width: 768px) {
  /* Layout */
  .page-content { padding: 14px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .search-global { display: none; }
  .pipeline-stages { display: none; }

  /* Page header */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
  .page-header h2 { font-size: 18px; }
  .page-header-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
  .page-header-actions .btn { flex: 1 1 auto; min-width: 120px; justify-content: center; }

  /* KPI grid — override inline styles too */
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; margin-bottom: 16px; }
  .kpi-card { padding: 16px; }
  .kpi-card-value { font-size: 22px; }
  .kpi-card-icon { width: 40px; height: 40px; font-size: 17px; margin-bottom: 8px; }

  /* Charts */
  .charts-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Cards */
  .card { padding: 16px; }
  .card:has(> .card-header) { padding: 0; }
  .card-header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .card-header-actions { flex-wrap: wrap; }
  .card-body { padding: 14px; }

  /* Tables — horizontally scrollable */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table,
  .table { min-width: 560px; }
  .table th, .table td { padding: 10px 12px; font-size: 13px; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; gap: 12px; }
  .form-actions { flex-wrap: wrap; gap: 8px; }
  .form-actions .btn { flex: 1 1 auto; min-width: 110px; justify-content: center; }

  /* Kanban */
  .kanban-board { flex-direction: column; }
  .kanban-col { width: 100% !important; min-width: unset !important; }

  /* Info grid (detail views) */
  .info-grid { grid-template-columns: 1fr !important; gap: 12px; }

  /* Contact detail */
  .contact-detail-header { flex-direction: column; align-items: center; text-align: center; padding: 16px; gap: 12px; }
  .contact-detail-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 12px; }
  .contact-detail-tab { padding: 12px 14px; font-size: 13px; white-space: nowrap; }
  .contact-tab-content { padding: 16px; }

  /* Modals */
  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal-box { max-width: 100% !important; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-body { padding: 16px; }
  .modal-header { padding: 16px 18px; }
  .modal-footer { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .modal-footer .btn { flex: 1 1 auto; min-width: 100px; justify-content: center; }

  /* Settings */
  .settings-menu { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
  .settings-menu-item { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; flex-direction: column; gap: 4px; padding: 10px 14px; font-size: 12px; }
  .settings-menu-item.active { border-bottom-color: var(--primary); border-left-color: transparent; }
  .settings-menu-item i { width: auto; }
  .pipeline-col-editor { flex-direction: column; }

  /* Import */
  .import-zone { padding: 32px 16px; }
  .field-mapper { grid-template-columns: 1fr auto 1fr; gap: 6px 10px; }

  /* Automation */
  .automation-canvas { padding: 16px; }
  .flow-node { min-width: 160px; padding: 12px 14px; }
  .flow-row { flex-direction: column; }

  /* Funnel */
  .funnel-label { width: 90px; font-size: 12px; }

  /* Timeline */
  .timeline { padding-left: 24px; }

  /* Topbar */
  .topbar-icon { width: 36px; height: 36px; font-size: 15px; }
  .breadcrumb { font-size: 16px; }
}

@media (max-width: 480px) {
  /* Layout */
  .page-content { padding: 10px; }
  .topbar { padding: 0 10px; height: 56px; gap: 6px; }

  /* KPI — single column on very small screens */
  .kpi-grid { grid-template-columns: 1fr !important; }
  .kpi-card { padding: 14px; }
  .kpi-card-value { font-size: 20px; }
  .kpi-card-bg { font-size: 60px; }

  /* Page header */
  .page-header { gap: 8px; margin-bottom: 12px; }
  .page-header h2 { font-size: 16px; }
  .page-header-actions .btn { font-size: 13px; padding: 8px 12px; }

  /* Buttons */
  .btn { padding: 8px 14px; font-size: 13px; }
  .btn-sm { padding: 5px 10px; font-size: 11px; }
  .btn-lg { padding: 11px 18px; font-size: 14px; }

  /* Modals */
  .modal-box { border-radius: var(--radius) var(--radius) 0 0; }
  .modal-header h3 { font-size: 16px; }
  .modal-body { padding: 12px; }

  /* Tables */
  .table-wrap table, .table { min-width: 460px; }
  .table th, .table td { padding: 9px 10px; font-size: 12px; }

  /* Cards */
  .card { padding: 12px; }
  .card-body { padding: 12px; }

  /* Topbar icons */
  .topbar-right { gap: 6px; }
  .topbar-icon { width: 32px; height: 32px; font-size: 14px; }
  .user-avatar-sm { width: 30px; height: 30px; font-size: 12px; }

  /* Toast */
  #toast-container { right: 10px; bottom: 10px; left: 10px; }
  .toast { min-width: unset; width: 100%; font-size: 13px; }

  /* Empty state */
  .empty-state { padding: 40px 16px; }
  .empty-state i { font-size: 36px; }
  .empty-state h3 { font-size: 16px; }

  /* Kanban */
  .kanban-card { padding: 10px; }
  .kanban-col-header { padding: 10px 12px; }

  /* Login */
  .login-card { padding: 32px 22px; }
  .login-brand h1 { font-size: 22px; }
  .brand-icon { width: 56px; height: 56px; font-size: 24px; }
}

/* ── Extra Utilities ── */
.import-zone.drag-over { border-color: var(--primary); background: var(--primary-alpha); transform: scale(1.01); }
.w-100 { width: 100%; }

/* ── Light Theme ── */
[data-theme="light"] {
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --sidebar-bg: #1e293b;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
}

/* ═══════════════════════════════════════════════════════════
   MAILBOX — Cliente de Email
   ═══════════════════════════════════════════════════════════ */
.mailbox-layout {
  display: grid;
  grid-template-columns: 200px 340px 1fr;
  gap: 0;
  height: calc(100vh - 160px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card-bg);
}
.mailbox-sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 8px 0;
}
.mailbox-folders {
  list-style: none;
  padding: 0;
  margin: 0;
}
.mailbox-folders li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
}
.mailbox-folders li:hover { background: var(--primary-alpha); color: var(--primary); }
.mailbox-folders li.active { background: var(--primary-alpha); color: var(--primary); font-weight: 700; }
.mailbox-folders li i { width: 16px; font-size: 14px; flex-shrink: 0; }

.mailbox-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.mailbox-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  align-items: flex-start;
}
.mailbox-item:hover { background: var(--bg); }
.mailbox-item.selected { background: var(--primary-alpha); }
.mailbox-item.unread { background: rgba(24,119,242,.04); }
.mailbox-item.unread .mailbox-item-from { font-weight: 800; }
.mailbox-item.unread .mailbox-item-subject { font-weight: 700; color: var(--text); }

.mailbox-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.mailbox-item-body { flex: 1; min-width: 0; }
.mailbox-item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mailbox-item-from { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mailbox-item-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.mailbox-item-email { font-size: 11px; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.mailbox-item-subject { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.mailbox-item-meta { display: flex; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--text-light); }

.mailbox-reader {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.mailbox-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  text-align: center;
}
.mailbox-msg-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 16px;
  justify-content: space-between;
}
.mailbox-msg-actions {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg);
}
.mailbox-msg-body {
  flex: 1;
  padding: 0;
}
.mailbox-msg-body iframe {
  width: 100%;
  min-height: 300px;
  border: 0;
}
.mailbox-attachments {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mailbox-att {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
  transition: background .15s;
}
.mailbox-att:hover { background: var(--primary-alpha); }

.mailbox-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

/* Responsivo — mobile */
@media (max-width: 1024px) {
  .mailbox-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
  }
  .mailbox-sidebar {
    display: flex;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0;
  }
  .mailbox-folders { display: flex; }
  .mailbox-folders li { white-space: nowrap; padding: 10px 14px; }
  .mailbox-reader { display: none; }
  .mailbox-reader.active { display: flex; }
}
@media (max-width: 768px) {
  .mailbox-layout { grid-template-columns: 1fr; }
  .mailbox-sidebar { display: none; }
}
