/* ──────────────────────────────────────────────────────────────
   LFT CRM - Complete Stylesheet
   ────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #1a56db;
  --primary-hover: #1649c0;
  --accent: #f97316;
  --accent-hover: #ea6800;
  --bg: #0f1117;
  --bg2: #161b27;
  --bg3: #1e2535;
  --bg4: #252d3d;
  --border: #2a3347;
  --border2: #344059;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --purple: #8b5cf6;
  --sidebar-w: 64px;
  --sidebar-w-open: 240px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

.light-mode {
  --bg: #f0f4f8;
  --bg2: #ffffff;
  --bg3: #f8fafc;
  --bg4: #edf2f7;
  --border: #e2e8f0;
  --border2: #cbd5e1;
  --text: #1e293b;
  --text2: #475569;
  --text3: #94a3b8;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ── SCROLLBARS ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: none; outline: none; transition: var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg4); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ── INPUTS ── */
input, select, textarea {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 13px; font-family: inherit;
  outline: none; transition: border-color var(--transition);
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
input::placeholder, textarea::placeholder { color: var(--text3); }
select option { background: var(--bg3); }
textarea { resize: vertical; min-height: 80px; }

/* ── TAGS / BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500;
}
.badge-count {
  background: var(--danger); color: #fff;
  min-width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}

/* ── LAYOUT ── */
#app { display: flex; height: 100vh; width: 100vw; overflow: hidden; }

/* ── LOGIN PAGE ── */
#login-page {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  z-index: 1000; background: var(--bg);
}
#login-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  z-index: 0;
}
.login-card {
  position: relative; z-index: 1;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px; width: 400px; max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img { max-height: 60px; }
.login-logo .login-title { font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo .login-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }
.login-form .form-group { margin-bottom: 16px; }
.login-form label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
.login-error { color: var(--danger); font-size: 12px; margin-top: 8px; text-align: center; }

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: width 0.25s ease;
  overflow: hidden; z-index: 100;
  position: relative;
}
#sidebar.open { width: var(--sidebar-w-open); min-width: var(--sidebar-w-open); }

.sidebar-toggle {
  position: absolute; top: 16px; right: -12px;
  width: 24px; height: 24px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 101; color: var(--text2);
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--bg4); color: var(--text); }
.sidebar-toggle svg { width: 12px; height: 12px; transition: transform 0.25s; }
#sidebar.open .sidebar-toggle svg { transform: rotate(180deg); }

.sidebar-logo {
  padding: 16px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border); min-height: 64px;
}
.sidebar-logo img { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; }
.sidebar-logo .logo-text { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; opacity: 0; transition: opacity 0.2s; }
#sidebar.open .sidebar-logo .logo-text { opacity: 1; }

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; overflow-x: hidden; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer; border-radius: 0;
  transition: background var(--transition); color: var(--text2);
  white-space: nowrap; min-height: 44px;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(26,86,219,0.15); color: var(--primary); border-right: 3px solid var(--primary); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-label { font-size: 13px; font-weight: 500; opacity: 0; transition: opacity 0.15s; }
#sidebar.open .nav-label { opacity: 1; }
.nav-badge { margin-left: auto; }

.sidebar-bottom { border-top: 1px solid var(--border); padding: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background var(--transition);
}
.user-chip:hover { background: var(--bg3); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { opacity: 0; transition: opacity 0.15s; overflow: hidden; }
#sidebar.open .user-info { opacity: 1; }
.user-name { font-size: 12px; font-weight: 600; color: var(--text); }
.user-role { font-size: 10px; color: var(--text3); }

/* ── MAIN CONTENT ── */
#main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg);
}

/* ── PAGE ── */
.page { display: none; flex: 1; flex-direction: column; overflow: hidden; height: 100%; }
.page.active { display: flex; }

.page-header {
  padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; gap: 16px;
}
.page-title { font-size: 20px; font-weight: 700; color: var(--text); }
.page-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; align-items: center; }

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

/* ── CARDS ── */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 12px; }

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

/* ── STAT CARDS ── */
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
}
.stat-card .stat-icon {
  position: absolute; right: 16px; top: 16px;
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.15;
}
.stat-card .stat-icon svg { width: 20px; height: 20px; }
.stat-label { font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); }
.stat-sub { font-size: 11px; color: var(--text3); }

/* ── INBOX ── */
.inbox-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 20px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 12px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }
.td-actions { display: flex; gap: 6px; }

/* ── SEARCH ── */
.search-bar {
  position: relative; flex: 1; max-width: 320px;
}
.search-bar input { padding-left: 36px; }
.search-bar svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text3); pointer-events: none; }

/* ── WHATSAPP MODULE ── */
#page-whatsapp { flex-direction: row; overflow: hidden; }

.wa-sidebar {
  width: 480px; min-width: 391px; background: var(--bg2);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
}

.wa-sidebar-header {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.wa-sidebar-title { display: flex; align-items: center; justify-content: space-between; }
.wa-sidebar-title span { font-size: 16px; font-weight: 700; }

.wa-tabs {
  display: flex; gap: 4px; background: var(--bg3);
  padding: 3px; border-radius: var(--radius-sm);
}
.wa-tab {
  flex: 1; padding: 5px; text-align: center; font-size: 12px;
  font-weight: 500; cursor: pointer; border-radius: 5px;
  color: var(--text2); transition: var(--transition);
}
.wa-tab.active { background: var(--bg2); color: var(--text); }

.wa-search { position: relative; }
.wa-search input { padding-left: 34px; font-size: 13px; }
.wa-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text3); }

.wa-contacts { flex: 1; overflow-y: auto; }
.wa-contact-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer; transition: background var(--transition);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.wa-contact-item:hover { background: var(--bg3); }
.wa-contact-item.active { background: rgba(26,86,219,0.12); }

.wa-avatar-wrap { position: relative; flex-shrink: 0; }
.wa-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg4); display: flex; align-items: center;
  justify-content: center; font-size: 16px; font-weight: 700;
  color: var(--text2); overflow: hidden; flex-shrink: 0;
}
.wa-avatar img { width: 100%; height: 100%; object-fit: cover; }

.priority-ring {
  position: absolute; inset: -2px; border-radius: 50%; border: 2px solid transparent;
}
.priority-ring.urgente { border-color: var(--danger); }
.priority-ring.alto { border-color: var(--warning); }
.priority-ring.medio { border-color: var(--info); }
.priority-ring.normal { border-color: var(--success); }

.wa-contact-info { flex: 1; min-width: 0; }
.wa-contact-name { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; justify-content: space-between; }
.wa-contact-name .time { font-size: 11px; font-weight: 400; color: var(--text3); }
.wa-contact-last { font-size: 12px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-contact-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.wa-contact-tags .tag { padding: 1px 6px; border-radius: 20px; font-size: 10px; font-weight: 500; }
.wa-unread { background: var(--success); color: #fff; min-width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; }

/* ── CHAT AREA ── */
.wa-chat { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.wa-chat-header {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2); flex-shrink: 0;
}
.wa-chat-header-info { flex: 1; min-width: 0; }
.wa-chat-header-name { font-size: 15px; font-weight: 600; }
.wa-chat-header-sub { font-size: 12px; color: var(--text3); }
.wa-chat-header-actions { display: flex; gap: 6px; }

.wa-chat-bar {
  padding: 8px 14px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3); flex-shrink: 0;
}

.wa-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg);
}

.wa-msg {
  display: flex; max-width: 70%; position: relative;
}
.wa-msg.mine { align-self: flex-end; }
.wa-msg.theirs { align-self: flex-start; }

.wa-bubble {
  padding: 8px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.5; max-width: 100%;
  position: relative;
}
.wa-msg.mine .wa-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 3px; }
.wa-msg.theirs .wa-bubble { background: var(--bg3); color: var(--text); border-bottom-left-radius: 3px; }

.wa-msg-time { font-size: 10px; color: rgba(255,255,255,0.6); float: right; margin-left: 10px; margin-top: 2px; }
.wa-msg.theirs .wa-bubble .wa-msg-time { color: var(--text3); }

.wa-msg-reaction { position: absolute; bottom: -10px; right: 4px; font-size: 13px; }

.wa-reply-preview {
  background: rgba(0,0,0,0.1); border-left: 3px solid var(--primary);
  padding: 4px 8px; border-radius: 4px; margin-bottom: 4px; font-size: 11px; color: var(--text2);
}

.wa-day-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text3); font-size: 11px; margin: 8px 0;
}
.wa-day-divider::before, .wa-day-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.wa-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px; color: var(--text3);
}
.wa-empty svg { width: 48px; height: 48px; opacity: 0.3; }
.wa-empty p { font-size: 14px; }

/* Message input area */
.wa-input-area {
  flex: 1; position: relative;
}
.wa-input-area textarea {
  min-height: unset; height: 38px; resize: none;
  padding: 9px 12px; border-radius: 20px;
  max-height: 120px; overflow-y: auto;
  line-height: 1.4;
}

.wa-toolbar { display: flex; gap: 4px; }
.wa-tool-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text2); transition: var(--transition);
  border: none; background: transparent;
}
.wa-tool-btn:hover { background: var(--bg4); color: var(--text); }
.wa-tool-btn svg { width: 18px; height: 18px; }

.wa-send-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; flex-shrink: 0;
  transition: var(--transition);
}
.wa-send-btn:hover { background: var(--primary-hover); }
.wa-send-btn svg { width: 16px; height: 16px; }

/* Quick transfer bar */
.wa-conv-bar {
  padding: 6px 16px; background: var(--bg3);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.wa-conv-bar .lbl { font-size: 11px; color: var(--text3); }
.priority-dot { width: 10px; height: 10px; border-radius: 50%; cursor: pointer; transition: transform var(--transition); }
.priority-dot:hover { transform: scale(1.3); }

/* Media message */
.wa-media { max-width: 260px; border-radius: 8px; overflow: hidden; cursor: pointer; }
.wa-media img, .wa-media video { width: 100%; display: block; }
.wa-media-caption { font-size: 12px; margin-top: 4px; }
.wa-audio-player { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.wa-audio-player audio { height: 28px; }

/* ── PIPELINE KANBAN ── */
.kanban-board {
  display: flex; gap: 14px; overflow-x: auto;
  padding-bottom: 16px; flex: 1;
}
.kanban-col {
  min-width: 240px; width: 240px; flex-shrink: 0;
  background: var(--bg2); border-radius: var(--radius);
  border: 1px solid var(--border); display: flex; flex-direction: column;
  max-height: 100%;
}
.kanban-col-header {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.kanban-col-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kanban-col-dot { width: 8px; height: 8px; border-radius: 50%; }
.kanban-col-count { font-size: 11px; color: var(--text3); }
.kanban-col-value { font-size: 11px; color: var(--success); }
.kanban-cards { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.kanban-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
  draggable: true;
}
.kanban-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.3); transform: translateY(-1px); }
.kanban-card-title { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.kanban-card-value { font-size: 12px; color: var(--success); font-weight: 600; }
.kanban-card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.kanban-card-avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.kanban-add-btn { padding: 10px 14px; display: flex; align-items: center; gap: 6px; color: var(--text3); cursor: pointer; font-size: 12px; border-top: 1px solid var(--border); flex-shrink: 0; transition: color var(--transition); }
.kanban-add-btn:hover { color: var(--text); }

/* ── TASKS ── */
.tasks-layout { display: flex; gap: 16px; flex: 1; overflow: hidden; }
.tasks-sidebar {
  width: 220px; min-width: 220px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.tasks-sidebar-title { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.task-filter-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; color: var(--text2); transition: var(--transition);
}
.task-filter-item:hover, .task-filter-item.active { background: var(--bg4); color: var(--text); }
.tasks-main { flex: 1; overflow: hidden; display: flex; flex-direction: column; gap: 14px; }
.task-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; display: flex;
  align-items: flex-start; gap: 12px; cursor: pointer;
  transition: background var(--transition);
}
.task-card:hover { background: var(--bg3); }
.task-check { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border2); flex-shrink: 0; cursor: pointer; transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.task-check.done { background: var(--success); border-color: var(--success); }
.task-check.done svg { width: 10px; height: 10px; color: #fff; }
.task-info { flex: 1; }
.task-title { font-size: 13px; font-weight: 500; }
.task-meta { font-size: 11px; color: var(--text3); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.task-priority { padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; }
.priority-urgente { background: rgba(239,68,68,0.15); color: var(--danger); }
.priority-alta { background: rgba(245,158,11,0.15); color: var(--warning); }
.priority-media { background: rgba(59,130,246,0.15); color: var(--info); }
.priority-baixa { background: rgba(16,185,129,0.15); color: var(--success); }

/* ── CALENDAR ── */
.cal-wrap { display: flex; flex-direction: column; flex: 1; }
.cal-nav { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.cal-nav-btn { padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); cursor: pointer; }
.cal-nav-btn:hover { background: var(--bg4); }
.cal-title { font-size: 15px; font-weight: 600; }
.cal-view-btns { display: flex; gap: 4px; margin-left: auto; }
.cal-view-btn { padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: transparent; color: var(--text2); transition: var(--transition); }
.cal-view-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; flex: 1; }
.cal-day-header { background: var(--bg2); padding: 8px; text-align: center; font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; }
.cal-day { background: var(--bg2); padding: 6px; min-height: 100px; overflow: hidden; cursor: pointer; transition: background var(--transition); }
.cal-day:hover { background: var(--bg3); }
.cal-day.today { background: rgba(26,86,219,0.08); }
.cal-day.other-month { opacity: 0.4; }
.cal-day-num { font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 4px; }
.cal-day.today .cal-day-num { color: var(--primary); }
.cal-event { padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 500; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.event-reuniao { background: rgba(59,130,246,0.3); color: #93c5fd; }
.event-call { background: rgba(249,115,22,0.3); color: #fdba74; }
.event-suporte { background: rgba(16,185,129,0.3); color: #6ee7b7; }
.event-mentoria { background: rgba(139,92,246,0.3); color: #c4b5fd; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  padding: 16px; backdrop-filter: blur(2px);
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%; max-width: 560px;
  max-height: 92vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text2); border: none; background: transparent; transition: var(--transition); }
.modal-close:hover { background: var(--bg4); color: var(--text); }
.modal-close svg { width: 14px; height: 14px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; }

/* ── FORM GROUPS ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── TOAST NOTIFICATIONS ── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 360px;
  box-shadow: var(--shadow); animation: slideIn 0.3s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast-msg { flex: 1; font-size: 13px; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── NOTIFICATION PANEL ── */
.notif-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 360px; background: var(--bg2); border-left: 1px solid var(--border);
  z-index: 400; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.3s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,0.4);
}
.notif-panel.open { transform: translateX(0); }
.notif-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.notif-list { flex: 1; overflow-y: auto; }
.notif-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--transition);
  display: flex; gap: 10px;
}
.notif-item:hover { background: var(--bg3); }
.notif-item.unread { background: rgba(26,86,219,0.06); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 5px; }
.notif-text { font-size: 12px; color: var(--text); }
.notif-time { font-size: 10px; color: var(--text3); margin-top: 2px; }

/* ── CONTACT PROFILE MODAL ── */
.contact-modal-header { text-align: center; padding: 24px; }
.contact-modal-avatar { width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 12px; overflow: hidden; background: var(--bg4); }
.contact-modal-avatar img { width: 100%; height: 100%; object-fit: cover; }
.contact-modal-name { font-size: 18px; font-weight: 700; }
.contact-modal-phone { font-size: 13px; color: var(--text3); margin-top: 4px; }

/* ── FILE LIBRARY ── */
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.library-file {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; display: flex;
  flex-direction: column; gap: 10px; transition: border-color var(--transition);
}
.library-file:hover { border-color: var(--primary); }
.library-file-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--bg4); display: flex; align-items: center; justify-content: center; }
.library-file-icon svg { width: 24px; height: 24px; }
.library-file-name { font-size: 12px; font-weight: 600; word-break: break-word; }
.library-file-meta { font-size: 10px; color: var(--text3); }
.library-file-actions { display: flex; gap: 6px; margin-top: auto; }

/* ── STORAGE BAR ── */
.storage-bar { background: var(--bg4); border-radius: 20px; height: 6px; overflow: hidden; }
.storage-bar-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.5s ease; }
.storage-bar-fill.danger { background: var(--danger); }

/* ── DASHBOARD ── */
.chart-container { width: 100%; height: 240px; position: relative; }
.funnel-chart { display: flex; flex-direction: column; gap: 6px; }
.funnel-stage { display: flex; align-items: center; gap: 10px; }
.funnel-bar-wrap { flex: 1; background: var(--bg4); border-radius: 4px; height: 28px; overflow: hidden; }
.funnel-bar { height: 100%; border-radius: 4px; display: flex; align-items: center; justify-content: flex-end; padding: 0 8px; font-size: 11px; font-weight: 600; color: #fff; transition: width 0.8s ease; }
.funnel-label { font-size: 12px; color: var(--text2); width: 160px; text-align: right; }
.funnel-count { font-size: 12px; color: var(--text3); width: 30px; }

/* ── EMOJI PICKER ── */
.emoji-picker {
  position: absolute; bottom: 50px; left: 0;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px;
  width: 280px; box-shadow: var(--shadow); z-index: 200;
  display: none;
}
.emoji-picker.open { display: block; }
.emoji-grid { display: grid; grid-template-columns: repeat(8,1fr); gap: 2px; }
.emoji-btn { font-size: 20px; padding: 4px; cursor: pointer; border-radius: 4px; text-align: center; transition: background var(--transition); border: none; background: transparent; }
.emoji-btn:hover { background: var(--bg4); }

/* ── AUDIO RECORDING ── */
.audio-recording { display: flex; align-items: center; gap: 10px; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.rec-timer { font-size: 13px; font-weight: 600; color: var(--text); }

/* ── MEDIA VIEWER ── */
#media-viewer {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92);
  z-index: 1000; display: none; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
}
#media-viewer.open { display: flex; }
#media-viewer img, #media-viewer video { max-width: 90vw; max-height: 85vh; border-radius: 8px; }
.media-viewer-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.15); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; border: none; }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .inbox-grid { grid-template-columns: repeat(2,1fr); }
  .wa-sidebar { width: 280px; min-width: 280px; }
}
@media (max-width: 768px) {
  #sidebar { width: 0; min-width: 0; position: fixed; left: 0; top: 0; bottom: 0; z-index: 200; }
  #sidebar.open { width: var(--sidebar-w-open); min-width: var(--sidebar-w-open); }
  .grid-2, .grid-3, .grid-4, .inbox-grid { grid-template-columns: 1fr; }
  .wa-sidebar { position: absolute; left: 0; top: 0; bottom: 0; z-index: 10; transform: translateX(-100%); transition: transform 0.3s; }
  .wa-sidebar.open { transform: translateX(0); }
  .wa-chat { width: 100%; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .kanban-col { min-width: 200px; width: 200px; }
}

/* ── MISC ── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.text-muted { color: var(--text3); }
.text-sm { font-size: 12px; }
.fw-600 { font-weight: 600; }
.flex { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.ml-auto { margin-left: auto; }
.hidden { display: none !important; }
.color-success { color: var(--success); }
.color-danger { color: var(--danger); }
.color-warning { color: var(--warning); }

.select-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 40px; cursor: pointer; }
.select-tag { display: flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; }

/* Record button active state */
.wa-tool-btn.recording { color: var(--danger); animation: pulse 1s infinite; }

/* Drag highlight */
.kanban-col.drag-over { border-color: var(--primary); background: rgba(26,86,219,0.05); }
.kanban-card.dragging { opacity: 0.4; }

/* Connection status */
.wa-status {
  padding: 3px 8px; border-radius: 20px; font-size: 10px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.wa-status.connected { background: rgba(16,185,129,0.15); color: var(--success); }
.wa-status.disconnected { background: rgba(239,68,68,0.15); color: var(--danger); }
.wa-status.connecting { background: rgba(245,158,11,0.15); color: var(--warning); }
.wa-status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Scheduled messages */
.sched-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.sched-card-info { flex: 1; }
.sched-card-contact { font-size: 13px; font-weight: 600; }
.sched-card-time { font-size: 11px; color: var(--text3); margin-top: 2px; }
.sched-card-text { font-size: 12px; color: var(--text2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 400px; }
.sched-recurrence { padding: 2px 8px; border-radius: 20px; font-size: 10px; background: rgba(139,92,246,0.15); color: var(--purple); }
