:root {
    /* Oregon Premium Design System */
    --bg-main: #0a0b0d;
    --sidebar-bg: rgba(18, 20, 24, 0.9);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --accent: #2ecc71; /* Verde Oregon */
    --accent-glow: rgba(46, 204, 113, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --nav-hover: rgba(46, 204, 113, 0.1);
    
    --radius-lg: 16px;
    --radius-md: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* --- SIDEBAR PREMIUM --- */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    z-index: 100;
}

.sidebar-header { margin-bottom: 2rem; }
.logo { display: flex; align-items: center; gap: 0.5rem; }
.logo-icon { font-size: 1.5rem; }
.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
}

.sidebar-nav { flex: 1; overflow-y: auto; -ms-overflow-style: none; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-group { margin-bottom: 1.5rem; }
.group-title { font-size: 0.65rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.75rem; display: block; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.nav-link:hover {
    background: var(--nav-hover);
    color: var(--accent);
}

.nav-link.active {
    background: var(--accent);
    color: #000;
    font-weight: 700;
    box-shadow: 0 4px 20px var(--accent-glow);
}

/* Sidebar Footer / User Profile */
.sidebar-footer {
    border-top: 1px solid var(--glass-border);
    padding-top: 1.5rem;
    margin-top: 1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-weight: 600; font-size: 0.85rem; }
.user-role { font-size: 0.7rem; color: var(--text-secondary); }

.btn-logout {
    width: 100%;
    padding: 0.6rem;
    background: rgba(255, 61, 87, 0.1);
    color: #ff3d57;
    border: 1px solid rgba(255, 61, 87, 0.2);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}
.btn-logout:hover { background: #ff3d57; color: #fff; }

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 2rem;
    position: relative;
    height: 100vh;
}

#page-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px; /* Espaço para a scrollbar */
}

#page-container::-webkit-scrollbar {
    width: 6px;
}

#page-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.main-content::before {
    content: '';
    position: absolute;
    top: -10%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: var(--accent);
    filter: blur(150px);
    opacity: 0.1;
    pointer-events: none;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    z-index: 10;
}

.page-title h1 { font-size: 1.8rem; font-weight: 700; }

.top-actions { display: flex; align-items: center; gap: 1rem; }
.date-filter {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-refresh {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}
.btn-refresh:hover { background: var(--accent); color: #000; }

/* --- KANBAN REFINADO (SEM BARRA) --- */
.kanban-wrapper {
    flex: 1;
    overflow-x: auto;
    padding-bottom: 2rem;
    cursor: grab;
    -ms-overflow-style: none; /* Oculta IE */
    scrollbar-width: none; /* Oculta Firefox */
}

.kanban-wrapper::-webkit-scrollbar {
    display: none; /* Oculta Chrome/Safari/Edge */
}

.kanban-board {
    display: flex;
    gap: 1.5rem;
    height: 100%;
    min-width: max-content;
    padding-right: 2rem;
}

.kanban-column {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 320px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    backdrop-filter: blur(10px);
}

.column-header {
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.column-title { display: flex; align-items: center; gap: 0.5rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; }

.lead-count-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* --- STATS BAR --- */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.stat-trend {
    font-size: 0.7rem;
    font-weight: 600;
}

.trend-up { color: var(--accent); }
.trend-down { color: #ff3d57; }

.cards-container {
    padding: 1.25rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* --- LEAD CARD PREMIUM --- */
.lead-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
}

.lead-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    background: rgba(255, 255, 255, 0.05);
}

.card-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.card-name { font-weight: 700; font-size: 0.95rem; }

.card-actions-mini { display: flex; gap: 0.4rem; }
.btn-mini {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.btn-mini:hover { background: var(--accent); color: #000; }

.card-info-row { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.card-phone-mini {
    color: var(--accent);
    font-family: monospace;
    font-size: 0.8rem;
}

.card-tag {
    background: var(--nav-hover);
    color: var(--accent);
    font-size: 0.65rem;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.btn-whatsapp-mini {
    background: #25d366 !important;
    color: #fff !important;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    transition: 0.3s;
}
.btn-whatsapp-mini:hover { transform: scale(1.05); background: #128c7e !important; }

/* --- RESPONSIVIDADE (MOBILE) --- */
@media (max-width: 768px) {
    body { overflow: hidden; position: fixed; width: 100%; }

    .app-container {
        flex-direction: column !important;
        height: 100vh !important;
        width: 100vw !important;
        overflow: hidden !important;
    }
    
    .sidebar {
        width: 100% !important;
        height: 60px !important;
        min-height: 60px !important;
        padding: 0 1rem !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        border-right: none !important;
        border-bottom: 1px solid var(--glass-border) !important;
        position: relative !important;
        z-index: 1000 !important;
    }
    
    .sidebar-header {
        margin-bottom: 0 !important;
        margin-right: 1rem !important;
    }
    
    .sidebar-header h2 { font-size: 0.85rem !important; margin-left: 5px; }
    .logo-icon { font-size: 1.2rem !important; }
    
    .sidebar-label, .group-title { display: none !important; }
    
    .sidebar-footer { 
        display: flex !important; 
        border-top: none !important; 
        padding: 0 !important;
        margin-left: 0.5rem;
    }
    .user-profile { display: none !important; } /* Esconde o perfil no mobile para dar espaço */
    .btn-logout {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.7rem !important;
        margin: 0 !important;
        white-space: nowrap;
    }
    
    .sidebar-nav {
        margin-top: 0 !important;
        display: flex !important;
        flex-direction: row !important;
        gap: 0.4rem;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 !important;
        flex: 1;
        scrollbar-width: none;
    }
    .sidebar-nav::-webkit-scrollbar { display: none; }
    
    .nav-group {
        margin-bottom: 0 !important;
        display: flex !important;
        flex-direction: row !important;
    }
    
    .nav-link {
        padding: 0.4rem 0.8rem !important;
        white-space: nowrap;
        font-size: 0.75rem !important;
        margin-bottom: 0 !important;
        background: rgba(255,255,255,0.05);
    }
    
    .main-content {
        padding: 0.75rem !important;
        flex: 1 !important;
        height: calc(100vh - 60px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    
    #current-page-title { font-size: 1.2rem !important; }
    .page-title { margin-bottom: 0.5rem !important; }
    .page-title span { font-size: 1.5rem !important; }

    .top-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        margin-bottom: 1rem !important;
    }
    
    .header-actions {
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 0.5rem !important;
        padding-bottom: 5px;
        scrollbar-width: none;
    }
    .header-actions::-webkit-scrollbar { display: none; }
    
    /* Esconder filtros secundários no mobile para limpar */
    .date-filter, .btn-refresh { display: none !important; }

    .btn-primary, .toggle-btn {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.75rem !important;
        white-space: nowrap;
    }

    .stats-bar {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
        margin-bottom: 1rem !important;
    }
    
    .stat-card { padding: 0.75rem !important; }
    .stat-value { font-size: 1rem !important; }

    .kanban-board {
        flex-direction: column !important;
        gap: 1rem !important;
        width: 100% !important;
        padding-bottom: 4rem;
    }
    
    .kanban-column {
        width: 100% !important;
        min-width: 100% !important;
        background: rgba(255,255,255,0.02) !important;
    }

    .table-responsive {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .table-responsive td, .table-responsive th {
        white-space: nowrap !important;
        padding: 0.75rem 0.5rem !important;
    }

    .btn-whatsapp-mini {
        padding: 4px 6px !important;
        font-size: 0.65rem !important;
    }

    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

/* --- CLASSES AUXILIARES --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

/* --- COLUNA DE VENDA --- */
.column-destaque-venda {
    border: 1.5px solid var(--accent) !important;
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.15);
}

/* --- MODAL E FORMS --- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8);
    display: none; align-items: flex-start; justify-content: center; 
    z-index: 1000; overflow-y: auto; padding: 2rem 0;
    -webkit-overflow-scrolling: touch;
}
.modal-overlay.active { display: flex; }

.modal-content {
    background: var(--bg-main);
    width: 500px;
    max-width: 90%;
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.5rem; border-bottom: 1px solid var(--glass-border);
    background: var(--glass-bg);
    flex-shrink: 0;
}

.btn-close-modal { background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }
.btn-close-modal:hover { color: #ff3d57; }

.modal-body { 
    padding: 1.5rem; 
}

.notes-input {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 0.8rem;
    border-radius: 8px;
    outline: none;
}
.notes-input:focus { border-color: var(--accent); }

.btn-primary {
    background: var(--accent); color: #000; border: none;
    padding: 0.8rem 1.5rem; border-radius: 8px; font-weight: 700;
    cursor: pointer; transition: var(--transition);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 5px 15px var(--accent-glow); }

.btn-secondary {
    background: transparent; border: 1px solid var(--glass-border);
    color: #fff; padding: 0.8rem 1.5rem; border-radius: 8px;
    font-weight: 600; cursor: pointer; transition: var(--transition);
}
.btn-secondary:hover { background: rgba(255,255,255,0.05); }

/* --- PORTAL MODE --- */
.portal-mode .admin-only {
    display: none !important;
}

/* --- LOGIN SCREEN --- */
.login-container {
    position: fixed;
    inset: 0;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* Efeito de luz sutil no fundo do login */
    background-image: radial-gradient(circle at 50% 0%, rgba(46, 204, 113, 0.15) 0%, transparent 50%);
}

.login-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 3rem 2.5rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    backdrop-filter: blur(20px);
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}
