:root {
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    
    --primary: #3b82f6;
    --primary-light: #eff6ff;
    --success: #10b981;
    --success-light: #ecfdf5;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius: 12px;
    --font-main: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-main);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.dashboard-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    font-size: 2rem;
}

.brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.brand h1 span {
    font-weight: 400;
    color: var(--text-secondary);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.time-filter {
    display: flex;
    gap: 0.75rem;
}

.form-select, .form-input {
    appearance: none;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 2rem 0.5rem 1rem;
    font-size: 0.875rem;
    font-family: var(--font-main);
    color: var(--text-main);
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

.form-select:hover, .form-input:hover {
    border-color: #9ca3af;
}

.form-select:focus, .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.sync-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.sync-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.sync-timer {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

/* Overview Section */
.overview-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
}

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

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.bg-blue { background: var(--primary-light); color: var(--primary); }
.bg-green { background: var(--success-light); color: var(--success); }
.bg-purple { background: var(--purple-light); color: var(--purple); }

.stat-info {
    flex-grow: 1;
}

.w-full {
    width: 100%;
}

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

.syncing {
    animation: pulse 1.5s infinite ease-in-out;
    color: var(--primary) !important;
    font-size: 0.875rem !important;
}

.stat-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

/* Top Plans List Global */
.top-plans-list {
    list-style: none;
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.top-plans-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.top-plans-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.plan-name {
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.plan-qty {
    background: var(--bg-color);
    color: var(--text-main);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
}

/* Performance Section */
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-heading h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.toolbar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.role-buttons {
    display: flex;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.role-btn {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-family: var(--font-main);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    border-right: 1px solid var(--border-color);
}

.role-btn:last-child {
    border-right: none;
}

.role-btn:hover {
    background: var(--bg-color);
}

.role-btn.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.search-input {
    width: 250px;
    padding-left: 2.5rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3e%3c/svg%3e");
    background-position: 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
}

.employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Employee Card */
.emp-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.emp-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.emp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.emp-avatar-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.emp-initials {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

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

.emp-name {
    font-weight: 700;
    color: var(--text-main);
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    text-transform: uppercase;
    display: inline-block;
    margin-top: 0.25rem;
}

.badge.consultant {
    background: var(--primary-light);
    color: var(--primary);
}

.badge.intern {
    background: var(--success-light);
    color: var(--success);
}

/* Stats Row */
.emp-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-item-val {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.comp-badge {
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.comp-up { color: var(--success); }
.comp-down { color: var(--danger); }
.comp-neutral { color: var(--text-muted); }

/* Employee Plans */
.emp-plans {
    border-top: 1px dashed var(--border-color);
    padding-top: 1rem;
}

.emp-plans h4 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.emp-plans ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.emp-plans li {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px dashed var(--border-color);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    padding: 1.5rem;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 { font-size: 1.25rem; }

.close-modal {
    background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-secondary);
}

.modal-body {
    overflow-y: auto;
}

.team-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.team-item-name { font-weight: 500; }