:root {
    --bg-color: #0d0f14;
    --bg-gradient: linear-gradient(135deg, #0d0f14 0%, #111520 50%, #0a0c11 100%);
    --card-bg: rgba(255, 255, 255, 0.04);
    --card-bg-hover: rgba(255, 255, 255, 0.07);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-active: rgba(99, 102, 241, 0.4);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --accent-amber: #f59e0b;
    --accent-blue: #6366f1;
    --accent-cyan: #06b6d4;
    --accent-purple: #a855f7;
    --accent-green: #22c55e;
    --accent-pink: #ec4899;
    --font-family: 'Inter', -apple-system, sans-serif;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 1.5rem 2rem 2rem;
    line-height: 1.6;
    background-attachment: fixed;
}

/* Grid noise overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 80%, rgba(168, 85, 247, 0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.dashboard-container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

/* Glassmorphism */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ======== HEADER ======== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    animation: fadeInDown 0.6s ease-out;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.logo-badge {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(168, 85, 247, 0.3));
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #e2e8f0 0%, #a5b4fc 50%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-badge {
    padding: 0.2rem 0.7rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    font-size: 0.78rem;
    color: #a5b4fc;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.data-source-badge {
    padding: 0.4rem 1rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 20px;
    font-size: 0.82rem;
    color: #86efac;
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.3rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
    border: none;
    outline: none;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-icon { font-size: 1rem; }

.btn.primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.btn.outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn.outline:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ======== SUMMARY CARDS ======== */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
    background: var(--card-bg-hover);
}

.card-glow {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.25;
    top: -20px;
    right: -20px;
    pointer-events: none;
}
.card-glow.red { background: var(--accent-red); }
.card-glow.orange { background: var(--accent-orange); }
.card-glow.blue { background: var(--accent-blue); }
.card-glow.purple { background: var(--accent-purple); }

.card-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-content h3 {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.stat {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.card-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ======== TAB NAV ======== */
.tab-nav {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem;
    animation: fadeInUp 0.6s ease-out 0.2s both;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-family);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.2));
    border-color: rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
}

/* ======== TAB CONTENT ======== */
.tab-content {
    display: none;
    animation: fadeInUp 0.4s ease-out;
    padding: 1.5rem;
}

.tab-content.active {
    display: block;
}

/* ======== FILTERS ======== */
.filters-bar {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
    flex-wrap: wrap;
    animation: fadeInUp 0.4s ease-out;
}

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

.filter-group label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-count {
    margin-left: auto;
    padding: 0.4rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 20px;
    font-size: 0.82rem;
    color: #a5b4fc;
    font-weight: 600;
    align-self: flex-end;
}

input, select {
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-family: var(--font-family);
    transition: var(--transition);
    font-size: 0.88rem;
}

input:focus, select:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

input {
    width: 260px;
}

select {
    cursor: pointer;
    min-width: 160px;
}

option {
    background: #1a1c27;
    color: var(--text-primary);
}

/* ======== CHARTS ======== */
.charts-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.chart-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    min-height: 380px;
    display: flex;
    flex-direction: column;
}

.chart-container.full-width {
    grid-column: span 2;
}

.chart-container h3 {
    margin-bottom: 1.25rem;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-wrapper {
    position: relative;
    flex: 1;
    min-height: 280px;
}

/* ======== TABLE / DRILLDOWN ======== */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.drilldown-wrapper {
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-md);
    padding: 1rem;
    max-height: 650px;
    overflow-y: auto;
}

.drilldown-wrapper::-webkit-scrollbar { width: 6px; }
.drilldown-wrapper::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); border-radius: 3px; }
.drilldown-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
.drilldown-wrapper::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

.accordion-item {
    border: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.015);
    transition: var(--transition);
}

.accordion-item:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.accordion-header {
    padding: 0.9rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    user-select: none;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.accordion-content {
    display: none;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.15);
}

.accordion-item.active > .accordion-content {
    display: block;
}

.accordion-item.active > .accordion-header {
    background: rgba(99, 102, 241, 0.08);
}

.level-1 > .accordion-header { 
    font-weight: 700; 
    font-size: 1rem; 
}
.level-1 > .accordion-header .header-title { color: #a5b4fc; }

.level-2 > .accordion-header { 
    font-weight: 600; 
    font-family: monospace; 
    font-size: 0.88rem; 
    line-height: 1.5; 
    word-break: break-all; 
}
.level-2 > .accordion-header .header-title { color: #fca5a5; }

.level-3 > .accordion-header { 
    font-weight: 600; 
    font-size: 0.92rem; 
}
.level-3 > .accordion-header .header-title { color: var(--text-primary); }

.level-4 > .accordion-header { 
    font-weight: 500; 
    font-size: 0.88rem; 
}
.level-4 > .accordion-header .header-title { color: var(--text-secondary); }

.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.task-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.025);
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: var(--transition);
    gap: 1rem;
}

.task-row:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.task-row .task-id {
    font-family: monospace;
    font-size: 0.83rem;
    color: #93c5fd;
}

.task-row .task-bid {
    font-family: monospace;
    font-size: 0.8rem;
    color: #fcd34d;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge-count {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(168, 85, 247, 0.3));
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
    padding: 0.2rem 0.65rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.accordion-icon {
    font-size: 0.75rem;
    transition: transform 0.25s;
    flex-shrink: 0;
    opacity: 0.7;
}

.accordion-item.active > .accordion-header .accordion-icon {
    transform: rotate(90deg);
}

.hash-key {
    font-family: monospace;
    color: #fcd34d;
}

.group-container {
    padding-left: 1rem;
}

/* Copy to clipboard */
.copyable {
    cursor: pointer;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.25);
    transition: all 0.15s;
    border-radius: 3px;
}
.copyable:hover {
    background: rgba(99, 102, 241, 0.15);
    border-bottom-color: transparent;
    padding: 0 3px;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 1000;
    pointer-events: none;
    font-weight: 600;
    font-size: 0.88rem;
}
.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Loading state */
.loading-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

/* Error state */
.error-state {
    text-align: center;
    padding: 3rem;
    color: #fca5a5;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    border-top: 1px solid var(--border-color);
}

.footer a {
    color: #a5b4fc;
    text-decoration: none;
}
.footer a:hover { text-decoration: underline; }

/* Category color tags */
.cat-timeout { color: #ef4444; }
.cat-url { color: #f97316; }
.cat-oom { color: #a855f7; }
.cat-gpu { color: #22c55e; }
.cat-format { color: #ec4899; }
.cat-corrupt { color: #06b6d4; }
.cat-other { color: #f59e0b; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

#page-info {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1200px) {
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .charts-section { grid-template-columns: 1fr; }
    .chart-container.full-width { grid-column: auto; }
}

@media (max-width: 768px) {
    body { padding: 1rem; }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .header h1 { font-size: 1.5rem; }
    .summary-cards { grid-template-columns: 1fr 1fr; }
    .stat { font-size: 1.8rem; }
    
    .tab-nav { gap: 0.35rem; }
    .tab-btn { font-size: 0.78rem; padding: 0.5rem 0.8rem; }
    
    input { width: 100%; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .result-count { margin-left: 0; }
}

@media (max-width: 480px) {
    .summary-cards { grid-template-columns: 1fr; }
}
