/* ---------- RESET & BASE ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background: #0b0d10;
    background-image: radial-gradient(circle at 2px 2px, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    display: flex;
    justify-content: center;
    padding: 24px;
    min-height: 100vh;
    color: #f0f4f8;
}

.dashboard {
    max-width: 1440px;
    width: 100%;
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
    align-items: flex-start;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
    flex: 0 0 240px;
    background: rgba(18, 22, 28, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 255, 100, 0.15);
    border-radius: 28px;
    padding: 28px 20px;
    position: sticky;
    top: 24px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(0, 255, 100, 0.3); border-radius: 10px; }

.sidebar-title {
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #d0dce8;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0, 255, 100, 0.12);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title .version {
    font-size: 11px;
    font-weight: 400;
    color: rgba(0, 255, 100, 0.7);
    border: 1px solid rgba(0, 255, 100, 0.25);
    padding: 0 12px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.client-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 16px;
}

.client-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    font-weight: 400;
    color: #c8d4e0;
    gap: 12px;
    letter-spacing: 0.2px;
}

.client-item:hover {
    background: rgba(0, 255, 100, 0.08);
    color: #ffffff;
}

.client-item.active {
    background: rgba(0, 255, 100, 0.10);
    color: #00ff88;
    border-left: 2px solid #00ff88;
    border-radius: 12px 0 0 12px;
    box-shadow: inset 0 0 24px rgba(0, 255, 100, 0.05);
}

.client-rank {
    font-size: 11px;
    font-weight: 300;
    color: #8a9aaa;
    min-width: 20px;
    text-align: right;
}

.client-item.active .client-rank {
    color: #00ff88;
}

.client-name {
    flex: 1;
    font-weight: 500;
}

.client-orders {
    font-size: 12px;
    font-weight: 400;
    color: #8a9aaa;
    background: rgba(255,255,255,0.06);
    padding: 0 12px;
    border-radius: 40px;
}

.client-item.active .client-orders {
    color: #00ff88;
    background: rgba(0, 255, 100, 0.12);
}

.sidebar-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 255, 100, 0.08);
    font-size: 12px;
    font-weight: 300;
    color: #8a9aaa;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-footer .dot {
    color: #00ff88;
    font-size: 8px;
    animation: pulse-dot 2s ease-in-out infinite;
}

.sidebar-footer .logout-link {
    margin-left: auto;
    color: #6a7a8a;
    text-decoration: none;
    font-size: 11px;
    transition: color 0.2s;
}
.sidebar-footer .logout-link:hover {
    color: #ff6b6b;
}

/* ---------- MAIN CONTENT ---------- */
.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.card {
    background: rgba(18, 22, 28, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 255, 100, 0.09);
    border-radius: 28px;
    padding: 28px 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.header-card {
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-card h1 {
    font-size: 24px;
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: lowercase;
    color: #ffffff;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 255, 100, 0.06);
    padding: 4px 14px;
    border-radius: 40px;
    border: 1px solid rgba(0, 255, 100, 0.10);
    font-size: 10px;
    font-weight: 300;
    color: #b0c4d4;
    letter-spacing: 0.25px;
    white-space: nowrap;
}

.badge-separator {
    color: #3a4a5a;
    font-size: 10px;
    font-weight: 100;
}

#last-updated {
    color: #8a9aaa;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header .label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #9aabbb;
}

/* ---------- KPI GRID ---------- */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.metric-item {
    background: rgba(255,255,255,0.04);
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 100, 0.06);
    transition: border-color 0.2s;
}

.metric-item:hover {
    border-color: rgba(0, 255, 100, 0.20);
}

.metric-item .metric-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #b0c4d4;
    margin-bottom: 4px;
}

.metric-item .metric-value {
    font-size: 28px;
    font-weight: 400;
    color: #ffffff;
    letter-spacing: -0.5px;
}

/* ---------- CHARTS ---------- */
.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.chart-box {
    padding: 20px 24px 16px;
}

.chart-box h4 {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #b0c4d4;
    margin-bottom: 12px;
}

.chart-container {
    height: 160px;
    position: relative;
}

.full-width {
    grid-column: 1 / -1;
}

/* ---------- TABLE ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-weight: 400;
    color: #dce4ec;
}

table thead tr {
    border-bottom: 1px solid rgba(0, 255, 100, 0.08);
}

table th {
    text-align: left;
    padding: 10px 8px 10px 0;
    font-weight: 500;
    color: #b0c4d4;
    font-size: 10px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

table td {
    padding: 10px 8px 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: #dce4ec;
}

table tbody tr:last-child td {
    border-bottom: none;
}

table tbody tr:hover {
    background: rgba(0, 255, 100, 0.04);
}

/* ---------- LIVE INDICATOR (blinking dot) ---------- */
.live-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: #00ff88;
    border-radius: 50%;
    margin-left: 6px;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
    animation: blink-live 1.5s ease-in-out infinite;
}

@keyframes blink-live {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.2; transform: scale(0.7); }
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
    .sidebar {
        flex: 1 1 100%;
        position: relative;
        top: 0;
        max-height: 320px;
        overflow-y: auto;
    }
    .chart-row {
        grid-template-columns: 1fr;
    }
    .dashboard {
        gap: 18px;
    }
}

@media (max-width: 600px) {
    body {
        padding: 12px;
    }
    .card {
        padding: 18px 16px;
    }
    .header-card {
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .header-card h1 {
        font-size: 20px;
    }
    .header-badge {
        align-self: flex-start;
        font-size: 9px;
        padding: 3px 10px;
        flex-wrap: wrap;
        gap: 4px;
        white-space: normal;
    }
    .metric-grid {
        grid-template-columns: 1fr 1fr;
    }
    .metric-item .metric-value {
        font-size: 22px;
    }
}

/* scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 100, 0.2);
    border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 100, 0.35);
}