:root {
    --primary: #00878e;
    --primary-dark: #006b71;
    --primary-light: #e6f4f5;
    --bg-app: #f5f7fa;
    --bg-card: #ffffff;
    --text-primary: #1a2c3e;
    --text-secondary: #5a6e7c;
    --text-muted: #8a9aa8;
    --border-color: #e2e8f0;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --radius-md: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
}

/* scrollbarr */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.logo {
    padding: 1.75rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: -0.3px;
}

.logo p {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.nav-menu {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-icon {
    font-size: 1rem;
    font-weight: 500;
}

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

.connection-status {
    font-size: 0.7rem;
    text-align: center;
    margin-bottom: 0.75rem;
    color: var(--accent-success);
}

.refresh-btn {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    overflow-y: auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
}

.section-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

.source-selector, .btn-secondary {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.source-selector:hover, .btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-info h3 {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-info p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Filters */
.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-input, .filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: var(--bg-card);
    width: 220px;
}

.filter-input:focus, .filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 135, 142, 0.1);
}

.filter-inline {
    display: flex;
    gap: 0.5rem;
}

.clear-filter {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 1rem;
}

.clear-filter:hover {
    background: #fee2e2;
    border-color: var(--accent-danger);
    color: var(--accent-danger);
}

/* Table */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
}

.leads-table th {
    text-align: left;
    padding: 0.875rem 1rem;
    background: #f8fafc;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.leads-table td {
    padding: 0.875rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.leads-table tr:hover {
    background: #fafcff;
}

/* Status Badge */
.status-select-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    background: #e2e8f0;
    color: var(--text-secondary);
}

.badge-nuovo { background: #e0f2fe; color: #0369a1; }
.badge-vinto { background: #dcfce7; color: #15803d; }
.badge-non-interessato { background: #f1f5f9; color: #475569; }
.badge-perso { background: #fee2e2; color: #b91c1c; }
.badge-chiamato { background: #ecfeff; color: #0e7490; }
.badge-tentativo { background: #f5f3ff; color: #6d28d9; }

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.chart-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.chart-card canvas {
    max-height: 280px;
    width: 100%;
}

/* Settings */
.settings-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.settings-card h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.settings-item {
    display: flex;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item label {
    width: 180px;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.settings-item span {
    flex: 1;
    font-size: 0.85rem;
    word-break: break-all;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 1000;
    animation: fadeUp 0.2s ease;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    .sidebar .logo p, .nav-item span:last-child {
        display: none;
    }
    .main-content {
        margin-left: 70px;
        padding: 1rem;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .filters-bar {
        flex-direction: column;
    }
    .filter-input, .filter-select {
        width: 100%;
    }
}
/* Sidebar Logo - Versione compatta */
.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
    justify-content: center;
    text-align: center;
}

.logo-img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    border-radius: 8px;

}

.sidebar .logo h2 {
    font-size: 3px;
    font-weight: 600;
    margin: 0;
    color: white;
    line-height: 1.2;
}

.sidebar .logo p {
    display: none; /* Nasconde il sottotitolo per compattezza */
}