/* === Analytics Page === */

.analytics-breadcrumb {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    margin-left: 8px;
}

.analytics-back-btn {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    transition: all 0.15s ease;
}
.analytics-back-btn:hover {
    background: var(--bg-overlay);
    color: var(--text-primary);
}

/* Period Bar */
.analytics-period-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
}

.analytics-page-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
}

.analytics-period-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.analytics-period-pills {
    display: flex;
    gap: 4px;
    background: var(--bg-base);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.analytics-period-btn {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.analytics-period-btn:hover { color: var(--text-secondary); }
.analytics-period-btn.active {
    background: var(--bg-overlay);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.analytics-custom-period {
    display: flex;
    gap: 4px;
}

.analytics-custom-input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', monospace;
}
.analytics-custom-input::placeholder { color: var(--text-muted); }
.analytics-custom-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.analytics-custom-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
}
.analytics-custom-btn:hover {
    background: var(--bg-overlay);
    color: var(--text-primary);
}

/* KPI Cards */
.analytics-kpis {
    display: flex;
    gap: 0;
    margin: 16px 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.analytics-kpi {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    border-right: 1px solid var(--border-subtle);
    transition: background 0.15s ease;
}
.analytics-kpi:last-child { border-right: none; }
.analytics-kpi:hover { background: var(--bg-elevated); }

.analytics-kpi-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
    line-height: 1;
}
.analytics-kpi.kpi-red .analytics-kpi-value { color: var(--status-red); }
.analytics-kpi.kpi-orange .analytics-kpi-value { color: var(--status-orange); }
.analytics-kpi.kpi-yellow .analytics-kpi-value { color: var(--status-yellow); }

.analytics-kpi-label {
    font-size: 0.72rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 6px;
}

/* Main Grid */
.analytics-main {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 16px;
    padding: 0 24px 24px;
}

/* Cards */
.analytics-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.analytics-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.analytics-card-header h2 {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
}

.analytics-card-subtitle {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.analytics-loading {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* Table */
.analytics-table-wrapper {
    overflow-x: auto;
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    font-family: 'Inter', sans-serif;
}

.analytics-table thead th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}
.analytics-table thead th:first-child {
    text-align: center;
    width: 40px;
}

.analytics-table tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.1s ease;
    cursor: pointer;
}
.analytics-table tbody tr:hover { background: var(--bg-elevated); }
.analytics-table tbody tr:last-child { border-bottom: none; }

.analytics-table td {
    padding: 10px 14px;
    color: var(--text-secondary);
    vertical-align: middle;
}
.analytics-table td:first-child {
    text-align: center;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.analytics-table .svc-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-table .svc-logo {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
}
.analytics-table .svc-logo-ph {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.analytics-table .svc-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.analytics-table .cat-tag {
    font-size: 0.62rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-overlay);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}

.analytics-table .inc-count {
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.analytics-table .downtime-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--status-yellow);
}

.analytics-table .uptime-val {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
}
.analytics-table .uptime-val.good { color: var(--status-green); }
.analytics-table .uptime-val.warn { color: var(--status-yellow); }
.analytics-table .uptime-val.bad { color: var(--status-red); }

.analytics-table .sev-pills {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}
.analytics-table .sev-pill {
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 0.62rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}
.sev-pill.critical { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.sev-pill.major { background: rgba(249, 115, 22, 0.15); color: #fdba74; }
.sev-pill.minor { background: rgba(251, 191, 36, 0.15); color: #fcd34d; }

.analytics-table .status-current {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
}
.status-current .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-current .dot.ok { background: var(--status-green); }
.status-current .dot.deg { background: var(--status-yellow); }
.status-current .dot.down { background: var(--status-red); }

/* Category Breakdown */
.analytics-categories {
    padding: 0;
}

.analytics-cat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-subtle);
}
.analytics-cat-item:last-child { border-bottom: none; }

.analytics-cat-name {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: capitalize;
}

.analytics-cat-bar-wrapper {
    flex: 2;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-cat-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-base);
    border-radius: 4px;
    overflow: hidden;
}

.analytics-cat-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}
.analytics-cat-bar-fill.normal { background: var(--accent-blue); }
.analytics-cat-bar-fill.has-critical { background: var(--status-red); }

.analytics-cat-count {
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
    min-width: 28px;
    text-align: right;
}

.analytics-cat-critical {
    font-size: 0.62rem;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

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

@media (max-width: 768px) {
    .analytics-period-bar {
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
        align-items: flex-start;
    }
    .analytics-period-right {
        width: 100%;
        flex-wrap: wrap;
    }
    .analytics-kpis {
        margin: 12px 12px;
        flex-wrap: wrap;
    }
    .analytics-kpi {
        min-width: calc(50% - 1px);
    }
    .analytics-main {
        padding: 0 12px 16px;
    }
    .analytics-page-title {
        font-size: 0.92rem;
    }
    .analytics-table td,
    .analytics-table thead th {
        padding: 8px 10px;
    }
    .analytics-table .sev-pills { display: none; }
}

@media (max-width: 480px) {
    .analytics-kpi {
        min-width: 100%;
    }
    .analytics-table .downtime-val { font-size: 0.65rem; }
}
