:root {
    --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --card-border: rgba(226, 232, 240, 0.85);
    --card-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
    --card-shadow-hover: 0 16px 32px -4px rgba(15, 23, 42, 0.09), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --success: #10b981;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
/* Header & Hero */
.page-header {
    margin: 0;
    padding: 50px 5% 45px;
    background: linear-gradient(135deg, #0b1528 0%, #0f274a 50%, #173b6c 100%);
    position: relative;
    overflow: hidden;
    color: #ffffff;
}
.page-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 200%;
    background: radial-gradient(circle at 50% 30%, rgba(37, 99, 235, 0.18) 0%, transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.15) 0%, transparent 50%);
    pointer-events: none;
}
.header-container {
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}
.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}
.brand-wrapper h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-wrapper h1 a {
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: opacity 0.2s ease;
}
.brand-wrapper h1 a:hover {
    opacity: 0.9;
}
.brand-wrapper h1 img {
    height: 38px;
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.live-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1.1);
        opacity: 1;
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        opacity: 0.8;
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}
.header-subtitle {
    margin: 0 0 28px;
    color: #94a3b8;
    font-size: 15px;
    font-weight: 400;
    max-width: 700px;
    line-height: 1.5;
}
/* KPI Summary Cards */
.stats-ribbon {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}
.stat-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 16px 20px;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}
.stat-card-label {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stat-card-value {
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
    font-feature-settings: "tnum";
}
.stat-card-value span {
    font-size: 13px;
    font-weight: 500;
    color: #38bdf8;
    margin-left: 4px;
}
/* Main Container */
.container {
    max-width: 1600px;
    width: 95%;
    margin: 32px auto 48px;
    padding: 0;
}
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}
@media (min-width: 640px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 1100px) {
    .metrics-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
/* Metric Cards */
.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}
.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: rgba(148, 163, 184, 0.4);
}
.metric-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafbfc;
}
.metric-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}
.metric-badge {
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
    color: #64748b;
    padding: 3px 8px;
    border-radius: 6px;
}
.metric-card-body {
    padding: 20px 16px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}
.pie-chart {
    width: 100%;
    height: 220px;
}
/* Custom Interactive Legend */
.chart-legend {
    width: 100%;
    max-height: 145px;
    overflow-y: auto;
    margin-top: 14px;
    padding: 12px 4px 4px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    justify-content: center;
    align-content: flex-start;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.chart-legend::-webkit-scrollbar {
    width: 5px;
}
.chart-legend::-webkit-scrollbar-track {
    background: transparent;
}
.chart-legend::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-secondary);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
    user-select: none;
}
.legend-item:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
    transform: translateY(-1px);
}
.legend-item.legend-item-hidden {
    opacity: 0.4;
    background: #f1f5f9;
    text-decoration: line-through;
    border-color: #e2e8f0;
}
.legend-swatch {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}
/* C3 Tooltip Customization */
.c3-tooltip-container {
    z-index: 100;
}
.c3-tooltip {
    background: rgba(15, 23, 42, 0.92) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3) !important;
    color: #ffffff !important;
    font-family: var(--font-family) !important;
    font-size: 12px !important;
    overflow: hidden !important;
}
.c3-tooltip th {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
    font-weight: 600 !important;
    padding: 6px 12px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.c3-tooltip td {
    padding: 6px 12px !important;
    color: #e2e8f0 !important;
    border: none !important;
}
.c3-tooltip .value {
    font-weight: 700 !important;
    color: #38bdf8 !important;
}
/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 30px 10%;
    background: #ffffff;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid #e2e8f0;
}
footer p {
    margin: 6px 0;
    line-height: 1.6;
}
footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
footer a:hover {
    text-decoration: underline;
}