/* ==========================================================================
   WSX OPERATIONS CRM - DESIGN SYSTEM & STYLES (DARK & LIGHT)
   ========================================================================== */

:root {
    /* Dark Theme (Default) */
    --bg-app: #090d16;
    --bg-card: #111827;
    --bg-card-hover: #1e293b;
    --bg-surface: #0f172a;
    --bg-glass: rgba(17, 24, 39, 0.85);
    
    --border-subtle: #1e293b;
    --border-hover: #334155;
    --border-accent: #3b82f6;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --blue-primary: #2563eb;
    --blue-hover: #1d4ed8;
    --blue-glow: rgba(37, 99, 235, 0.3);
    
    --green-accent: #10b981;
    --green-bg: rgba(16, 185, 129, 0.12);
    --green-border: rgba(16, 185, 129, 0.3);
    
    --amber-accent: #f59e0b;
    --amber-bg: rgba(245, 158, 11, 0.12);
    
    --purple-accent: #8b5cf6;
    --purple-bg: rgba(139, 92, 246, 0.12);
    
    --red-accent: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.12);
    
    --whatsapp-green: #25d366;
    --whatsapp-hover: #128c7e;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 9999px;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
    
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.9);
    
    --border-subtle: #e2e8f0;
    --border-hover: #cbd5e1;
    --border-accent: #2563eb;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 6px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
}

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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Elimina qualquer scroll na página em si */
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
}

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

a {
    text-decoration: none;
    color: inherit;
}

/* Scrollbar Custom */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ================= APP LAYOUT ================= */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ================= HEADER ================= */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    z-index: 40;
    backdrop-filter: blur(12px);
    gap: 16px;
    flex-wrap: nowrap;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.brand-badge-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    background: var(--blue-primary);
    color: #ffffff;
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: -0.5px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px var(--blue-glow);
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: -0.3px;
}

.brand-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}
.status-dot.online {
    background: var(--green-accent);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}
.status-dot.syncing {
    background: var(--amber-accent);
    animation: pulse 1s infinite;
}

/* ================= NICHE TABS (SELETOR DE ABAS) ================= */
.niche-tabs {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 4px;
}

.niche-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.niche-tab:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.niche-tab.active {
    background: var(--blue-primary);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--blue-glow);
}

.tab-badge {
    background: rgba(255, 255, 255, 0.2);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
}

.niche-tab:not(.active) .tab-badge {
    background: var(--border-subtle);
    color: var(--text-muted);
}

/* ================= SEARCH & CONTROLS ================= */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 240px;
}

.search-box input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 8px 34px 8px 34px;
    font-size: 0.85rem;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px var(--blue-glow);
}

.search-icon {
    position: absolute;
    left: 10px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.view-toggle {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 3px;
}

.view-btn {
    background: transparent;
    border: none;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.view-btn.active {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.action-icon-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
}
.action-icon-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-refresh {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--blue-primary);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px var(--blue-glow);
}
.btn-refresh:hover {
    background: var(--blue-hover);
    transform: translateY(-1px);
}
.btn-refresh.syncing #refreshIcon {
    animation: spin 0.8s linear infinite;
}

/* ================= KPI SECTION (COMPACT SLIM 6-METRICS) ================= */
.kpi-section {
    padding: 6px 12px 2px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    overflow: hidden;
}
.kpi-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.kpi-card-editable {
    cursor: pointer;
    border: 1px dashed rgba(239, 68, 68, 0.35);
}
.kpi-card-editable:hover {
    border-color: #f87171;
    background: rgba(239, 68, 68, 0.05);
}

.kpi-icon-wrapper {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.kpi-icon-wrapper i { width: 14px; height: 14px; }
.kpi-leads { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.kpi-today { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.kpi-adspend { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.kpi-pipeline { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.kpi-won { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.kpi-roi { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.kpi-roi.negative { background: rgba(239, 68, 68, 0.15); color: #f87171; }

.kpi-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.kpi-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.kpi-edit-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}
.kpi-edit-btn i { width: 11px; height: 11px; }
.kpi-edit-btn:hover { color: #f87171; }

.kpi-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.2px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-value-row {
    display: flex;
    align-items: baseline;
    gap: 5px;
    overflow: hidden;
}

.kpi-value {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    line-height: 1.15;
    white-space: nowrap;
}

.kpi-sub-badge {
    font-size: 0.58rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================= FILTERS BAR (SLIM) ================= */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group-niche {
    display: none;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.segmented-control {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.segment-btn {
    background: transparent;
    border: none;
    padding: 3px 8px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.segment-btn:hover {
    color: var(--text-primary);
}
.segment-btn.active {
    background: var(--blue-primary);
    color: #ffffff;
}

.filter-select {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.btn-clear-filters {
    display: flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px dashed var(--border-hover);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: auto;
    transition: var(--transition);
}

/* ================= WORKSPACE & KANBAN (ZERO PAGE SCROLL) ================= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.workspace-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 6px 12px 8px;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* ================= EMPTY STATE BLURRED POPUP OVERLAY ================= */
.empty-state-overlay {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.25s ease-out;
}

.empty-state-card {
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-lg);
    padding: 22px 30px;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    animation: scaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.empty-icon-glow {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(59, 130, 246, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #60a5fa;
}
.empty-icon-glow i { width: 22px; height: 22px; }

.empty-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.empty-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.empty-actions {
    margin-top: 4px;
}

.btn-empty-action {
    background: var(--blue-primary);
    color: #ffffff;
    border: none;
    padding: 7px 16px;
    border-radius: var(--radius-md);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    box-shadow: 0 4px 12px var(--blue-glow);
}
.btn-empty-action:hover {
    background: var(--blue-hover);
    transform: translateY(-1px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleUp {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
    flex: 1;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: hidden;
}

.kanban-col {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    flex-shrink: 0;
    gap: 4px;
}

.col-title-group {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    white-space: nowrap;
}

.col-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.col-mini-select {
    background: var(--bg-card);
    border: 1px solid rgba(6, 182, 212, 0.4);
    border-radius: var(--radius-sm);
    padding: 1px 3px;
    font-size: 0.62rem;
    font-weight: 700;
    color: #06b6d4;
    cursor: pointer;
    outline: none;
    line-height: 1.1;
}

.col-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.col-novo .col-dot { background: #3b82f6; }
.col-contato .col-dot { background: #f59e0b; }
.col-followup .col-dot { background: #06b6d4; }
.col-reuniao .col-dot { background: #8b5cf6; }
.col-proposta .col-dot { background: #ec4899; }
.col-ganho .col-dot { background: #10b981; }
.col-perdido .col-dot { background: #64748b; }

.col-title {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-count {
    background: var(--bg-card);
    font-size: 0.68rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.col-cards-dropzone {
    padding: 5px 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
}

.col-cards-dropzone.drag-over {
    background: rgba(37, 99, 235, 0.08);
}

/* ================= LEAD CARD (SUPER COMPACT & ORGANIZED) ================= */
.lead-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--blue-primary);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    cursor: grab;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    user-select: none;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.lead-card:hover {
    border-color: var(--border-hover);
    border-left-color: #60a5fa;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

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

/* Indicadores laterais por coluna */
[data-stage="novo"] .lead-card { border-left-color: #3b82f6; }
[data-stage="contato"] .lead-card { border-left-color: #f59e0b; }
[data-stage="followup"] .lead-card { border-left-color: #06b6d4; }
[data-stage="reuniao"] .lead-card { border-left-color: #8b5cf6; }
[data-stage="proposta"] .lead-card { border-left-color: #ec4899; }
[data-stage="ganho"] .lead-card { border-left-color: #10b981; }
[data-stage="perdido"] .lead-card { border-left-color: #64748b; }

/* Follow-up attempt tags */
.chip-followup {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.chip-followup-1 { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.chip-followup-2 { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.3); }
.chip-followup-3 { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

.card-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.card-lead-identity {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    flex: 1;
}

.card-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.card-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-attendant {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}
.badge-wenderson { background: rgba(37, 99, 235, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-victor { background: rgba(139, 92, 246, 0.2); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-unassigned { background: var(--border-subtle); color: var(--text-muted); }

.card-info-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    align-items: center;
}

.card-chip {
    font-size: 0.64rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.chip-ticket { background: rgba(16, 185, 129, 0.12); color: #34d399; border-color: rgba(16, 185, 129, 0.3); font-weight: 700; }
.chip-ad { background: rgba(59, 130, 246, 0.1); color: #60a5fa; border-color: rgba(59, 130, 246, 0.25); font-family: var(--font-mono); font-size: 0.62rem; }

.card-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 3px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.65rem;
    color: var(--text-muted);
}

.card-date {
    display: flex;
    align-items: center;
    gap: 3px;
    font-family: var(--font-sans);
    font-size: 0.65rem;
    color: var(--text-muted);
}

.card-actions-quick {
    display: flex;
    gap: 3px;
}

.btn-quick-whats {
    background: var(--whatsapp-green);
    color: #ffffff;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.btn-quick-whats:hover {
    background: var(--whatsapp-hover);
    transform: scale(1.15);
}

/* ================= TABLE VIEW ================= */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.leads-table th {
    background: var(--bg-surface);
    padding: 12px 16px;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.leads-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    white-space: nowrap;
}

.leads-table tr:hover td {
    background: var(--bg-card-hover);
    cursor: pointer;
}

/* ================= MODAL / DRAWER 360° ================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    justify-content: flex-end;
    animation: fadeIn 0.2s ease;
    overflow-x: hidden;
    touch-action: pan-y;
}

.modal-drawer {
    width: 100%;
    max-width: 680px;
    background: var(--bg-card);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    border-left: 1px solid var(--border-subtle);
    animation: slideLeft 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

#leadEditForm {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    background: var(--bg-surface);
}

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

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

.modal-avatar {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--blue-primary), #6366f1);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.5px;
    box-shadow: 0 4px 12px var(--blue-glow);
    flex-shrink: 0;
}

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

.modal-badges-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.modal-badge-niche {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--blue-primary);
    background: rgba(37, 99, 235, 0.12);
    border: 1px solid rgba(37, 99, 235, 0.25);
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.5px;
}

.modal-badge-status {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 2px 7px;
    border-radius: var(--radius-sm);
}

.modal-lead-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.4px;
    margin: 2px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-lead-date {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.74rem;
    color: var(--text-muted);
}

.modal-close-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 7px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.modal-action-bar {
    padding: 10px 24px;
    background: var(--bg-app);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-action-whats {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--whatsapp-green);
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.25);
}
.btn-action-whats:hover {
    background: var(--whatsapp-hover);
    transform: translateY(-1px);
}

.btn-action-insta, .btn-action-site {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    text-decoration: none;
}
.btn-action-insta:hover, .btn-action-site:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* Cards de Resumo Rápido no Topo do Diagnóstico */
.lead-highlight-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.lead-highlight-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.highlight-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.highlight-label i {
    width: 12px;
    height: 12px;
}

.highlight-val {
    font-size: 0.96rem;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.highlight-val.green { color: var(--green-accent); }
.highlight-val.blue { color: #60a5fa; }

.modal-tabs-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
    padding: 8px 16px;
    gap: 8px;
}

.modal-tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 10px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.modal-tab-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}
.modal-tab-btn.active {
    background: var(--blue-primary);
    border-color: var(--blue-primary);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--blue-glow);
}

.modal-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 20px 24px;
}

.modal-tab-pane {
    display: none;
}
.modal-tab-pane.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* Pane Grid & Info Cards */
.pane-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.info-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.info-card.full-width {
    grid-column: span 2;
}

.info-card-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.4px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.82rem;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border-subtle);
}
.info-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-label { color: var(--text-muted); }
.info-value { font-weight: 600; text-align: right; color: var(--text-primary); }
.info-value.highlight { color: #60a5fa; font-weight: 700; }
.info-value.highlight-green { color: var(--green-accent); font-weight: 700; }
.info-value.highlight-blue { color: var(--amber-accent); font-weight: 700; }

.utm-pills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.utm-pill {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.utm-key { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.utm-val { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); font-family: var(--font-mono); }

/* Form Elements inside Modal */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.form-control {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px var(--blue-glow);
}
.form-control.textarea {
    resize: vertical;
    line-height: 1.5;
}

/* Modal Footer (Sempre fixo no rodapé visível) */
.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 15;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
}

.save-status-msg {
    font-size: 0.8rem;
    color: var(--green-accent);
    font-weight: 600;
}

.modal-btn-group {
    display: flex;
    gap: 10px;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border-subtle);
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.btn-cancel:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-save {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--blue-primary);
    color: #ffffff;
    border: none;
    padding: 9px 20px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px var(--blue-glow);
}
.btn-save:hover {
    background: var(--blue-hover);
    transform: translateY(-1px);
}

/* ================= TOASTS ================= */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideUp 0.2s ease;
}
.toast.success { border-left: 4px solid var(--green-accent); }
.toast.error { border-left: 4px solid var(--red-accent); }

/* ================= ANIMATIONS ================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideLeft {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

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

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ================= MOBILE BOTTOM NAV & STAGE BAR (DESKTOP DEFAULT: HIDDEN) ================= */
.mobile-bottom-nav,
.mobile-stage-bar,
.mobile-search-bar,
.btn-apply-mobile-filters {
    display: none;
}

/* ================= RESPONSIVO & MOBILE FIRST ENHANCEMENTS ================= */

@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .kanban-board {
        grid-template-columns: repeat(3, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    /* App Layout com espaço para a Bottom Bar */
    .app-layout {
        height: 100dvh;
        padding-bottom: 60px;
    }

    /* Header Mobile Ultra-Compacto (1 Linha Limpa) */
    .app-header {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 8px 12px;
        gap: 8px;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border-subtle);
    }
    .header-left {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    .brand-badge-group {
        gap: 6px;
        flex-shrink: 0;
    }
    .brand-logo {
        padding: 4px 8px;
        font-size: 0.88rem;
        border-radius: var(--radius-sm);
    }
    .brand-info {
        display: none;
    }
    .niche-tabs {
        display: none !important;
    }
    .header-right {
        display: flex;
        align-items: center;
        gap: 5px;
        flex-shrink: 0;
    }
    .search-box {
        display: none;
    }
    .view-toggle {
        display: none !important;
    }
    .action-icon-btn {
        padding: 6px;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-sm);
    }
    .action-icon-btn i { width: 16px; height: 16px; }
    
    .btn-refresh {
        padding: 6px !important;
        width: 32px !important;
        height: 32px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: var(--radius-sm) !important;
    }
    .btn-refresh i { width: 16px !important; height: 16px !important; }
    .refresh-label {
        display: none !important;
    }

    .user-pill-badge {
        padding: 3px 6px 3px 8px !important;
        gap: 5px !important;
    }
    .user-pill-avatar {
        width: 20px !important;
        height: 20px !important;
        font-size: 0.65rem !important;
    }
    .user-pill-name {
        font-size: 0.75rem !important;
        max-width: 75px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    .btn-logout {
        padding: 2px !important;
    }
    .btn-logout i {
        width: 13px !important;
        height: 13px !important;
    }

    /* Seletor de Etapas Mobile (Chips Horizontais) */
    .mobile-stage-bar {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        white-space: nowrap;
        padding: 6px 0 10px 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-shrink: 0;
    }
    .mobile-stage-bar::-webkit-scrollbar { display: none; }
    .mobile-stage-chip {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 6px 12px;
        background: var(--bg-card);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-pill);
        font-size: 0.76rem;
        font-weight: 700;
        color: var(--text-secondary);
        cursor: pointer;
        transition: var(--transition);
        flex-shrink: 0;
    }
    .mobile-stage-chip.active {
        background: var(--blue-primary);
        border-color: var(--blue-primary);
        color: #ffffff;
        box-shadow: 0 2px 8px var(--blue-glow);
    }
    .stage-chip-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
    }
    .dot-novo { background: #3b82f6; }
    .dot-contato { background: #f59e0b; }
    .dot-followup { background: #ec4899; }
    .dot-qualificado { background: #10b981; }
    .dot-reuniao { background: #8b5cf6; }
    .dot-fechado { background: #10b981; }
    .dot-perdido { background: #ef4444; }
    .stage-chip-count {
        background: rgba(255, 255, 255, 0.2);
        padding: 1px 5px;
        border-radius: var(--radius-pill);
        font-size: 0.7rem;
    }
    .mobile-stage-chip:not(.active) .stage-chip-count {
        background: var(--border-subtle);
        color: var(--text-muted);
    }

    /* ISOLAMENTO POR ABAS NO CELULAR */
    /* 1. Modo Leads (Padrão) */
    body[data-mobile-tab="leads"] .kpi-section { display: none !important; }
    body[data-mobile-tab="leads"] .filters-bar { display: none !important; }
    body[data-mobile-tab="leads"] .workspace-area {
        display: flex !important;
        flex-direction: column;
        flex: 1;
        padding: 8px 12px;
        overflow: hidden;
    }

    /* 2. Modo Métricas & Ads */
    body[data-mobile-tab="metrics"] .workspace-area { display: none !important; }
    body[data-mobile-tab="metrics"] .filters-bar { display: none !important; }
    body[data-mobile-tab="metrics"] .kpi-section {
        display: block !important;
        padding: 14px 12px 70px 12px;
        overflow-y: auto;
        flex: 1;
    }
    body[data-mobile-tab="metrics"] .kpi-grid {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    body[data-mobile-tab="metrics"] .kpi-card {
        padding: 14px;
        border-radius: var(--radius-md);
        gap: 12px;
    }
    body[data-mobile-tab="metrics"] .kpi-icon-wrapper {
        width: 40px;
        height: 40px;
        border-radius: var(--radius-md);
    }
    body[data-mobile-tab="metrics"] .kpi-icon-wrapper i { width: 20px; height: 20px; }
    body[data-mobile-tab="metrics"] .kpi-value {
        font-size: 1.35rem;
        margin-top: 2px;
    }
    body[data-mobile-tab="metrics"] .kpi-label {
        font-size: 0.74rem;
    }

    /* 3. Modo Filtros & Busca */
    body[data-mobile-tab="filters"] .workspace-area { display: none !important; }
    body[data-mobile-tab="filters"] .kpi-section { display: none !important; }
    body[data-mobile-tab="filters"] .filters-bar {
        display: flex !important;
        flex-direction: column;
        gap: 14px;
        padding: 16px 14px 75px 14px;
        overflow-y: auto;
        flex: 1;
    }
    body[data-mobile-tab="filters"] .filter-group {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        width: 100%;
    }
    body[data-mobile-tab="filters"] .filter-group-niche {
        display: flex !important;
        background: var(--bg-surface);
        padding: 12px;
        border-radius: var(--radius-lg);
        border: 1px solid var(--border-subtle);
        margin-bottom: 4px;
    }
    body[data-mobile-tab="filters"] .niche-segmented-control {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
    }
    body[data-mobile-tab="filters"] .niche-segmented-control .segment-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 7px !important;
        padding: 12px 10px !important;
        font-size: 0.82rem !important;
        font-weight: 700 !important;
        border-radius: var(--radius-md) !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border-subtle) !important;
        color: var(--text-secondary) !important;
    }
    body[data-mobile-tab="filters"] .niche-segmented-control .segment-btn.active {
        background: var(--blue-primary) !important;
        border-color: var(--blue-primary) !important;
        color: #ffffff !important;
        box-shadow: 0 2px 8px var(--blue-glow) !important;
    }
    body[data-mobile-tab="filters"] .segmented-control:not(.niche-segmented-control) {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
    }
    body[data-mobile-tab="filters"] .segment-btn {
        padding: 8px 4px;
        font-size: 0.75rem;
        text-align: center;
    }
    body[data-mobile-tab="filters"] .filter-select {
        width: 100%;
        padding: 10px 12px;
        font-size: 0.85rem;
        border-radius: var(--radius-md);
    }
    body[data-mobile-tab="filters"] .btn-clear-filters {
        width: 100%;
        justify-content: center;
        padding: 11px;
        font-size: 0.85rem;
    }
    body[data-mobile-tab="filters"] .btn-apply-mobile-filters {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        background: var(--blue-primary);
        color: #ffffff;
        border: none;
        padding: 13px;
        border-radius: var(--radius-md);
        font-size: 0.92rem;
        font-weight: 700;
        cursor: pointer;
        box-shadow: 0 4px 12px var(--blue-glow);
        margin-top: 4px;
    }

    /* Kanban no Mobile */
    .kanban-board {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        gap: 12px;
        flex: 1;
        height: 100%;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .kanban-col {
        min-width: 86vw;
        max-width: 90vw;
        scroll-snap-align: center;
        flex-shrink: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    .col-cards-dropzone {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 20px;
    }
    .card-quick-actions {
        opacity: 1 !important;
        transform: none !important;
    }

    /* Barra de Navegação Inferior (Bottom Nav) */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: var(--bg-surface);
        border-top: 1px solid var(--border-subtle);
        z-index: 1000;
        backdrop-filter: blur(16px);
        justify-content: space-around;
        align-items: center;
        padding: 0 10px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    }
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        background: transparent;
        border: none;
        color: var(--text-muted);
        font-size: 0.72rem;
        font-weight: 600;
        padding: 6px 20px;
        border-radius: var(--radius-md);
        cursor: pointer;
        position: relative;
        transition: var(--transition);
    }
    .mobile-nav-item i { width: 19px; height: 19px; }
    .mobile-nav-item.active {
        color: var(--blue-primary);
    }
    .mobile-nav-item.active::after {
        content: '';
        position: absolute;
        top: 0;
        width: 24px;
        height: 3px;
        background: var(--blue-primary);
        border-radius: 0 0 4px 4px;
    }
    .mobile-nav-badge {
        position: absolute;
        top: 4px;
        right: 14px;
        background: var(--blue-primary);
        color: #ffffff;
        font-size: 0.62rem;
        font-weight: 800;
        padding: 1px 5px;
        border-radius: var(--radius-pill);
    }

    /* Modal 360 Bottom Sheet Mobile */
    .modal-overlay {
        align-items: flex-end !important;
        padding: 0 !important;
        z-index: 2500 !important;
        overflow: hidden !important;
        width: 100vw !important;
        max-width: 100vw !important;
    }
    .modal-drawer {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 92dvh !important;
        max-height: 92dvh !important;
        border-radius: 20px 20px 0 0 !important;
        animation: slideUpModal 0.25s ease-out !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        touch-action: pan-y !important;
        border-left: none !important;
        border-top: 1px solid var(--border-hover) !important;
    }
    .modal-header {
        padding: 12px 14px !important;
        flex-shrink: 0 !important;
    }
    .modal-avatar {
        width: 38px !important;
        height: 38px !important;
        font-size: 0.9rem !important;
    }
    .modal-lead-name {
        font-size: 1.05rem !important;
    }
    .modal-tabs-nav {
        padding: 6px 10px !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
    }
    .modal-tab-btn {
        padding: 8px 6px !important;
        font-size: 0.76rem !important;
    }
    .modal-action-bar {
        padding: 8px 12px !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
    }
    .btn-action-whats, .btn-action-insta, .btn-action-site {
        flex: 1 1 auto;
        justify-content: center;
        font-size: 0.78rem !important;
        padding: 9px 10px !important;
        text-align: center;
    }
    #leadEditForm {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
        min-height: 0 !important;
        overflow: hidden !important;
        width: 100% !important;
    }
    .modal-content {
        padding: 14px !important;
        flex: 1 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .lead-highlight-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
    }
    .lead-highlight-box {
        padding: 10px !important;
    }
    .highlight-val {
        font-size: 0.88rem !important;
    }
    .pane-grid, .form-grid, .utm-pills-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .info-card.full-width, .form-group.full-width {
        grid-column: span 1 !important;
    }
    .modal-footer {
        padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        flex-shrink: 0 !important;
        position: sticky !important;
        bottom: 0 !important;
        z-index: 30 !important;
        background: var(--bg-card) !important;
        border-top: 1px solid var(--border-subtle) !important;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4) !important;
    }
    .modal-btn-group {
        width: 100% !important;
        display: flex !important;
        gap: 8px !important;
    }
    .btn-cancel {
        flex: 1 !important;
        padding: 11px 10px !important;
        font-size: 0.82rem !important;
        justify-content: center !important;
        text-align: center !important;
        border-radius: var(--radius-md) !important;
    }
    .btn-save {
        flex: 2 !important;
        padding: 11px 14px !important;
        font-size: 0.88rem !important;
        font-weight: 700 !important;
        justify-content: center !important;
        border-radius: var(--radius-md) !important;
    }
}

@keyframes slideUpModal {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ================= BADGE DE USUÁRIO AUTENTICADO NO CABEÇALHO ================= */
.user-pill-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 4px 6px 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.user-pill-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--blue-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
}

.user-pill-name {
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.btn-logout:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}
.btn-logout i { width: 14px; height: 14px; }

/* ================= TELA DE LOGIN OVERLAY ================= */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 15, 29, 0.94);
    backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: center;
    animation: scaleUpModal 0.25s ease-out;
}

.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.brand-logo-login {
    background: var(--blue-primary);
    color: #ffffff;
    font-weight: 900;
    font-size: 1.4rem;
    letter-spacing: -1px;
    padding: 8px 18px;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px var(--blue-glow);
    display: inline-block;
}

.login-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 4px 0 0;
}

.login-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}

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

.login-form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
}
.login-form-group label i { width: 14px; height: 14px; }

.login-input {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}
.login-input:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px var(--blue-glow);
}

.login-error-msg {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 10px;
    border-radius: var(--radius-md);
    text-align: center;
    animation: shake 0.3s ease;
}

.btn-login-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--blue-primary);
    color: #ffffff;
    border: none;
    padding: 13px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--blue-glow);
    transition: var(--transition);
    margin-top: 4px;
}
.btn-login-submit:hover {
    background: var(--blue-hover);
    transform: translateY(-1px);
}
.btn-login-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.login-footer i { width: 13px; height: 13px; color: var(--green-accent); }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
