<?php

declare(strict_types=1);

include_once('../login.php');

$rtNonce = bin2hex(random_bytes(16));

function pcSendSecurityHeaders(string $nonce): void
{
    if (headers_sent()) {
        return;
    }

    header_remove('Content-Security-Policy');
    header('X-Content-Type-Options: nosniff');
    header('X-Frame-Options: SAMEORIGIN');
    header('Referrer-Policy: same-origin');
    header('Permissions-Policy: geolocation=(), microphone=(), camera=(), payment=(), usb=()');
    header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
    header('Pragma: no-cache');
    header('Expires: 0');

    $csp = implode('; ', [
        "default-src 'self'",
        "base-uri 'self'",
        "form-action 'self'",
        "frame-ancestors 'self'",
        "object-src 'none'",
        "img-src 'self' data: https:",
        "font-src 'self' data: https:",
        "media-src 'self' data: https:",
        "style-src 'self' 'nonce-{$nonce}'",
        "style-src-elem 'self' 'nonce-{$nonce}'",
        "script-src 'self' 'nonce-{$nonce}'",
        "script-src-elem 'self' 'nonce-{$nonce}'",
        "connect-src 'self' https:",
    ]);

    header('Content-Security-Policy: ' . $csp);
}

function pcEnsureSession(): void
{
    if (session_status() !== PHP_SESSION_ACTIVE) {
        session_start();
    }
}

function pcH(string $value): string
{
    return htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
}

function pcCsrfToken(): string
{
    pcEnsureSession();

    if (
        !isset($_SESSION['pc_csrf_token'])
        || !is_string($_SESSION['pc_csrf_token'])
        || $_SESSION['pc_csrf_token'] === ''
    ) {
        $_SESSION['pc_csrf_token'] = bin2hex(random_bytes(32));
    }

    return $_SESSION['pc_csrf_token'];
}

function pcVerifyCsrf(?string $token): bool
{
    pcEnsureSession();

    if (!is_string($token) || $token === '') {
        return false;
    }

    if (!isset($_SESSION['pc_csrf_token']) || !is_string($_SESSION['pc_csrf_token'])) {
        return false;
    }

    return hash_equals($_SESSION['pc_csrf_token'], $token);
}

function pcSelfPath(): string
{
    $scriptName = isset($_SERVER['SCRIPT_NAME']) && is_string($_SERVER['SCRIPT_NAME'])
        ? $_SERVER['SCRIPT_NAME']
        : '/clicks/';

    if (
        $scriptName === '' || preg_match('/[
]/', $scriptName) === 1
    ) {
        return '/clicks/';
    }

    return $scriptName;
}

/**
 * @return array{total: int, rows: array<int, mixed>}
 */
function pcReadJsonPage(string $filename, int $offset, int $limit): array
{
    if (!is_file($filename) || !is_readable($filename)) {
        return ['total' => 0, 'rows' => []];
    }

    $handle = fopen($filename, 'rb');
    if (!is_resource($handle)) {
        return ['total' => 0, 'rows' => []];
    }

    $total = 0;
    $rows = [];
    $inArray = false;
    $started = false;
    $complexElement = false;
    $depth = 0;
    $inString = false;
    $escaped = false;
    $element = '';

    while (!feof($handle)) {
        $chunk = fread($handle, 8192);
        if (!is_string($chunk) || $chunk === '') {
            continue;
        }

        $length = strlen($chunk);
        for ($index = 0; $index < $length; $index++) {
            $char = $chunk[$index];

            if (!$inArray) {
                if ($char === '[') {
                    $inArray = true;
                }
                continue;
            }

            if (!$started) {
                if ($char === ']' || $char === ',' || trim($char) === '') {
                    continue;
                }

                $started = true;
                $complexElement = $char === '{' || $char === '[';
                $depth = $complexElement ? 1 : 0;
                $inString = $char === '"';
                $escaped = false;
                $element = $char;
                continue;
            }

            if (!$complexElement && !$inString && ($char === ',' || $char === ']')) {
                pcCollectJsonElement($element, $total, $rows, $offset, $limit);
                $started = false;
                $element = '';
                if ($char === ']') {
                    break 2;
                }
                continue;
            }

            $element .= $char;

            if ($inString) {
                if ($escaped) {
                    $escaped = false;
                } elseif ($char === '\\') {
                    $escaped = true;
                } elseif ($char === '"') {
                    $inString = false;
                }
                continue;
            }

            if ($char === '"') {
                $inString = true;
                continue;
            }

            if ($complexElement && ($char === '{' || $char === '[')) {
                $depth++;
                continue;
            }

            if ($complexElement && ($char === '}' || $char === ']')) {
                $depth--;
                if ($depth === 0) {
                    pcCollectJsonElement($element, $total, $rows, $offset, $limit);
                    $started = false;
                    $element = '';
                }
            }
        }
    }

    fclose($handle);

    if ($started && trim($element) !== '') {
        pcCollectJsonElement($element, $total, $rows, $offset, $limit);
    }

    return ['total' => $total, 'rows' => $rows];
}

/**
 * @param array<int, mixed> $rows
 */
function pcCollectJsonElement(string $element, int &$total, array &$rows, int $offset, int $limit): void
{
    $position = $total;
    $total++;

    if ($position < $offset || count($rows) >= $limit) {
        return;
    }

    try {
        $decoded = json_decode($element, true, 32, JSON_THROW_ON_ERROR);
    } catch (Throwable $e) {
        return;
    }

    $rows[] = $decoded;
}

function pcCurrentPage(int $totalPages): int
{
    $rawPage = isset($_GET['page']) && is_scalar($_GET['page']) ? (string) $_GET['page'] : '1';

    if (preg_match('/\A\d{1,6}\z/', $rawPage) !== 1) {
        return 1;
    }

    return max(1, min($totalPages, (int) $rawPage));
}

function pcPageUrl(int $page): string
{
    return '?page=' . rawurlencode((string) max(1, $page));
}

function pcHandlePostLogout(): void
{
    if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
        return;
    }

    $action = isset($_POST['action']) && is_string($_POST['action']) ? $_POST['action'] : '';
    if ($action !== 'logout') {
        return;
    }

    if (!pcVerifyCsrf($_POST['csrf_token'] ?? null)) {
        http_response_code(403);
        echo 'Invalid CSRF token.';
        exit;
    }

    pcEnsureSession();
    $_SESSION = [];

    if (ini_get('session.use_cookies')) {
        $params = session_get_cookie_params();

        setcookie(
            (string) session_name(),
            '',
            [
                'expires' => time() - 42000,
                'path' => (string) $params['path'],
                'domain' => (string) $params['domain'],
                'secure' => (bool) $params['secure'],
                'httponly' => true,
                'samesite' => 'Strict',
            ],
        );
    }

    session_destroy();

    header('Location: ' . pcSelfPath());
    exit;
}

function pcSafeCountryCode(mixed $value): string
{
    $code = strtolower((string) $value);
    $code = preg_replace('/[^a-z]/', '', $code);

    if (!is_string($code) || $code === '') {
        return '--';
    }

    return substr($code, 0, 3);
}

function pcIconImg(string $src, string $label, int $size = 16): string
{
    $class = $size <= 13 ? 'pc-icon pc-icon-sm' : 'pc-icon';

    return '<img src="' . pcH(statAssetUrl($src)) . '" class="' . pcH($class) . '" alt="' . pcH($label) . '" title="' . pcH($label) . '" width="' . $size . '" height="' . $size . '">';
}

function pcRenderCountry(mixed $countryCode): string
{
    $code = pcSafeCountryCode($countryCode);
    $label = strtoupper($code === '--' ? '-' : $code);

    return '<span class="flag flag-' . pcH($code) . '"></span> <strong class="pc-country">' . pcH($label) . '</strong>';
}

function pcRenderUserAgent(mixed $userAgent): string
{
    $raw = strtoupper(trim((string) $userAgent));
    $key = strtolower(trim((string) $userAgent));

    $map = [
        'wap' => ['/dist/wap.svg', 'WAP'],
        'web' => ['/dist/web.svg', 'WEB'],
        'tablet' => ['/dist/tablet.svg', 'TABLET'],
    ];

    if (isset($map[$key])) {
        return pcIconImg($map[$key][0], $map[$key][1], 14);
    }

    return '<code>' . pcH($raw) . '</code>';
}

function pcRenderNetwork(mixed $info): string
{
    $raw = trim((string) $info);
    $key = strtolower($raw);

    $map = [
        'lospollos' => ['/dist/lp.svg', 'LosPollos'],
        'imonetizeit' => ['/dist/imo.svg', 'iMonetizeIt'],
        'imonetizeit-1' => ['/dist/imo.svg', 'iMonetizeIt-1'],
        'imonetizeit-2' => ['/dist/imo.svg', 'iMonetizeIt-2'],
        'trafee' => ['/dist/tf.svg', 'Trafee'],
        'custom' => ['/dist/custom.svg', 'Custom'],
        'torazzo' => ['/dist/custom.svg', 'Torazzo'],
    ];

    if (isset($map[$key])) {
        return pcIconImg($map[$key][0], $map[$key][1], 16);
    }

    return '<code>' . pcH($raw) . '</code>';
}

pcSendSecurityHeaders($rtNonce);
pcHandlePostLogout();

$pageName = basename(__DIR__);
$isPerformanceClick = $pageName === 'click';
$title = $isPerformanceClick ? 'PERFORMANCE CLICKS' : 'PERFORMANCE CLICKS';

$time = date('Y-m-d', strtotime('today'));

// Click log is always at {project_root}/statistics/temp/YYYY-MM-DD.json
$filename = dirname(__DIR__, 2) . '/statistics/temp/' . $time . '.json';

$perPage = 100;
$requestedPage = pcCurrentPage(1000000);
$offset = ($requestedPage - 1) * $perPage;
$pageData = pcReadJsonPage($filename, $offset, $perPage);
$total = $pageData['total'];
$totalPages = max(1, (int) ceil($total / $perPage));
$page = min($requestedPage, $totalPages);
$offset = ($page - 1) * $perPage;
$rows = $page === $requestedPage ? $pageData['rows'] : pcReadJsonPage($filename, $offset, $perPage)['rows'];
$self = pcSelfPath();

include_once('../header.php');
?>
<style nonce="<?= pcH($rtNonce) ?>">
:root{color-scheme:light;--bg:#f8fafd;--surface:#f0f3f8;--panel:rgba(255,255,255,.72);--panel2:#fff;--line:#e2e8f0;--line2:rgba(68,71,70,.07);--text:#444746;--muted:#6e7370;--strong:#1f2221;--primary:#444746;--primary2:#1f2221;--accent:#444746;--accent-h:#1f2221;--accent-s:rgba(68,71,70,.10);--on:#fff;--bad:#6e7370;--good:#444746;--warn:#6e7370;--radius:.3rem;--shadow:none;--shadow-modal:none;--font:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;--mono:"SFMono-Regular",Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--panel-soft:var(--panel2);--panel-raised:var(--panel);--panel-fade:#f8f9fa;--line-soft:var(--line2);--text-strong:var(--strong);--dark:var(--strong);--light:var(--bg);--accent-hover:var(--accent-h);--accent-soft:var(--accent-s);--on-accent:var(--on);--danger:var(--bad);--danger-soft:rgba(108,117,125,.10);--success:var(--good);--success-soft:rgba(73,80,87,.10);--ok:var(--good);--ok-soft:rgba(73,80,87,.10);--blue-soft:var(--accent-s);--blue-line:rgba(68,71,70,.28);--nav:#fff;--btn:var(--text);--stroke:var(--line);--font-cursive:cursive;--font-mono:monospace}@media (prefers-color-scheme:dark){:root{color-scheme:dark;--bg:#212529;--surface:#343a40;--panel:#212529;--panel2:#343a40;--line:#495057;--line2:rgba(248,249,250,.06);--text:#e9ecef;--muted:#6e7370;--strong:#f8f9fa;--primary:#e9ecef;--primary2:#f8f9fa;--accent:#495057;--accent-h:#adb5bd;--accent-s:rgba(173,181,189,.12);--on:#212529;--bad:#6e7370;--good:#adb5bd;--warn:#6e7370;--shadow:none;--shadow-modal:none;--panel-soft:var(--panel2);--panel-raised:var(--panel);--panel-fade:#212529;--line-soft:var(--line2);--text-strong:var(--strong);--accent-hover:var(--accent-h);--accent-soft:var(--accent-s);--on-accent:var(--on);--danger:var(--bad);--danger-soft:rgba(108,117,125,.12);--success:var(--good);--success-soft:rgba(173,181,189,.12);--ok:var(--good);--ok-soft:rgba(173,181,189,.12);--blue-soft:var(--accent-s);--blue-line:rgba(173,181,189,.30);--nav:#212529;--btn:var(--text);--stroke:var(--line)}}*{box-sizing:border-box}html,body{width:100%;height:100dvh;margin:0;}html{background:var(--bg);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}body{font-family:var(--font);padding:58px 8px 18px!important;background:radial-gradient(circle at 50% 8%,rgba(255,90,10,.12),transparent 28rem),radial-gradient(circle at 10% 80%,rgba(15,23,42,.06),transparent 22rem),#f8fafc!important;color:var(--text)!important;font-family:monospace!important;font-size:13px;line-height:1.45;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}a{color:inherit;text-decoration:none}.container{width:100%;max-width:1180px;margin:0 auto}code{font-family:Consolas,Monaco,'Courier New',monospace;font-size:11.5px;color:var(--text);background:var(--panel-soft);border:1px solid var(--line-soft);border-radius:var(--radius);padding:1px 4px}.navbar.navbar-default{min-height:44px;border:0!important;border-bottom:0!important;background:#fff!important;box-shadow:var(--shadow)!important}.navbar .container{max-width:1180px}.navbar-brand{height:44px!important;padding:12px 10px!important;color:var(--text-strong)!important;font-size:13px;line-height:20px}.navbar-nav>li>a{padding-top:12px!important;padding-bottom:12px!important;line-height:20px!important;color:var(--text)!important;font-size:12px}.navbar-nav>li>a:hover,.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{background:var(--accent)!important;color:var(--on-accent)!important}.navbar-toggle{margin-top:5px!important;margin-bottom:5px!important;border-color:var(--line)!important;border-radius:var(--radius)!important;background:var(--panel)!important}.navbar-toggle .icon-bar{background:var(--text)!important}.panel,.panel-default,.well,.modal-content{border:0!important;border-radius:var(--radius)!important;background:var(--panel)!important;color:var(--text)!important;box-shadow:var(--shadow)!important;overflow:hidden}.panel-heading,.panel-footer,.modal-header,.modal-footer{padding:8px 10px!important;background:#f5f5f5!important;border:0!important;color:var(--text-strong)!important}.panel-body,.modal-body{padding:10px!important;background:transparent!important;color:var(--text)!important}.pull-right{display:flex;align-items:center;gap:6px}.modal-content{box-shadow:var(--shadow-modal)!important}.modal-title{font-size:14px;font-weight:700;color:var(--text-strong)}.close{color:var(--text)!important;opacity:.78;text-shadow:none}.form-group{margin-bottom:8px}.control-label,label{margin-bottom:4px;color:var(--text-strong);font-size:12px}.form-control,input[type=text],input[type=number],input[type=password],input[type=search],select,textarea{height:31px;min-height:31px;border:1px solid var(--line)!important;border-radius:var(--radius)!important;background:var(--panel)!important;color:var(--text)!important;font-family:inherit!important;font-size:12px!important;line-height:1.4!important;box-shadow:none!important; }.form-control:focus,input:focus,select:focus,textarea:focus{outline:none;border-color:var(--accent)!important;box-shadow:none!important}.form-control::placeholder,textarea::placeholder{color:color-mix(in srgb,var(--text) 54%,transparent)}.form-control[readonly],input[readonly],textarea[readonly]{background:var(--panel-soft)!important;color:var(--text)!important}textarea.form-control{height:auto;min-height:114px;resize:none}.input-group-addon{height:31px;padding:5px 8px;background:transparent!important;border-color:var(--line)!important;color:var(--text)!important;border-radius:var(--radius)!important;font-size:11.5px}.btn,button,.btn-sm,.btn-xs{display:inline-flex;align-items:center;justify-content:center;gap:5px;border:1px solid var(--line)!important;border-radius:var(--radius)!important;background:var(--panel)!important;color:var(--text)!important;font-size:11.5px;font-weight:700;line-height:1.2;box-shadow:none!important;outline:none;transition:background .12s ease,border-color .12s ease,color .12s ease}.btn:hover,button:hover,.btn-sm:hover,.btn-xs:hover{background:var(--panel-soft)!important;border-color:var(--line)!important;color:var(--text-strong)!important}.btn-primary,.btn-primary:focus,.btn-primary:active,.btn.active{background:var(--accent)!important;border-color:var(--accent)!important;color:var(--on-accent)!important}.btn-primary:hover{background:var(--accent-hover)!important;border-color:var(--accent-hover)!important;color:var(--on-accent)!important}.btn-danger,.btn-danger:focus{background:var(--danger-soft)!important;border-color:rgba(108,117,125,.34)!important;color:var(--danger)!important}.btn-danger:hover{background:rgba(108,117,125,.16)!important;color:var(--danger)!important}.glyphicon{top:1px;color:currentColor}.action-ico{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.action-ico svg{display:block}.table-responsive{border:0!important}.table{width:100%;margin:4px 0 0;border-collapse:separate;border-spacing:0;border:0;border-radius:var(--radius);overflow:hidden;background:var(--panel)!important}.table>thead>tr>th{position:sticky;top:0;z-index:20;padding:7px 8px!important;border-bottom:1px solid var(--line)!important;background:#f5f5f5!important;color:var(--text-strong)!important;font-size:10.5px!important;line-height:1.2;text-transform:uppercase;letter-spacing:.035em;white-space:nowrap}.table>tbody>tr>td{padding:6px 8px!important;border-top:1px solid var(--line-soft)!important;color:var(--text);font-size:11.5px;vertical-align:middle;word-break:break-word;background:var(--panel)!important}.table-hover>tbody>tr:hover>td{background:var(--panel-soft)!important}.bootgrid-table th>.column-header-anchor{color:var(--text-strong)!important}.bootgrid-header,.bootgrid-footer{margin:6px 0!important;color:var(--text)!important}.bootgrid-header .search .form-control{height:31px}.bootgrid-header .actionBar{text-align:right}.pagination>li>a,.pagination>li>span{border-color:var(--line)!important;background:var(--panel)!important;color:var(--text)!important}.pagination>.active>a,.pagination>.active>span{background:var(--accent)!important;border-color:var(--accent)!important;color:var(--on-accent)!important}.dropdown-menu{border:0!important;border-radius:var(--radius)!important;background:#fff!important;box-shadow:var(--shadow-modal)!important}.dropdown-menu>li>a{color:var(--text)!important;font-size:12px}.dropdown-menu>li>a:hover{background:var(--panel-soft)!important;color:var(--text-strong)!important}.alert{border-radius:var(--radius)!important}.alert-danger,.error{background:var(--danger-soft)!important;border-color:rgba(108,117,125,.28)!important;color:var(--danger)!important}.alert-success,.success{background:var(--blue-soft)!important;border-color:var(--blue-line)!important;color:var(--text)!important}.label{border-radius:var(--radius)!important}.label-default{background:var(--panel-soft)!important;color:var(--text)!important;border:1px solid var(--line)}blockquote{margin:0 0 10px;padding:7px 10px;border-left:2px solid var(--line)!important;background:var(--panel-fade);border-radius:var(--radius);font-size:12px}.text-warning{margin:0 0 2px;color:var(--text-strong)!important;font-weight:700}.text-muted{color:var(--text)!important}.flag{border-radius:var(--radius)}.admin-toast-root{position:fixed;right:12px;bottom:12px;z-index:10050;display:flex;flex-direction:column;gap:6px;align-items:flex-end}.admin-toast{font-family:var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);max-width:340px;padding:8px 10px;border:1px solid var(--line);border-radius:var(--radius);background:var(--panel);color:var(--text);box-shadow:var(--shadow-modal);font-size:12px;line-height:1.35}.admin-toast strong{display:block;margin-bottom:2px;color:var(--text-strong)}.admin-toast--error{border-color:rgba(108,117,125,.34);background:var(--danger-soft);color:var(--danger)}.admin-toast--success{border-color:var(--blue-line);background:var(--blue-soft);color:var(--text)}.admin-fallback-backdrop{position:fixed;inset:0;z-index:10040;display:flex;align-items:center;justify-content:center;padding:12px;background:rgba(33,37,41,.36)}.admin-fallback-dialog{width:min(420px,100%);border:1px solid var(--line);border-radius:var(--radius);background:var(--panel);color:var(--text);box-shadow:var(--shadow-modal);overflow:hidden}.admin-fallback-head{padding:10px;border-bottom:1px solid var(--line-soft);font-weight:800;color:var(--text-strong);background:#f0f4f9}.admin-fallback-body{padding:10px;font-size:12px}.admin-fallback-actions{display:flex;gap:6px;justify-content:flex-end;padding:10px;border-top:1px solid var(--line-soft);background:#f0f4f9}@media screen and (max-width:768px){body{padding:58px 6px 12px!important;font-size:12.5px}.container{width:100%!important;max-width:100%!important;padding-left:6px!important;padding-right:6px!important}.panel-heading,.panel-body,.panel-footer{padding:7px!important;background:#f5f5f5!important}.navbar .container{padding-left:8px!important;padding-right:8px!important}.navbar-collapse{border-color:var(--line)!important;background:var(--panel)!important}.pull-right{float:none!important;justify-content:flex-end}.input-group{display:block}.input-group>.form-control,.input-group>.input-group-addon,.input-group>.input-group-btn,.input-group-btn>.btn{display:block;width:100%!important}.input-group-addon{border-bottom:0!important;border-radius:var(--radius) var(--radius) 0 0!important}.input-group>.form-control{border-radius:0 0 var(--radius) var(--radius)!important}.input-group-btn>.btn{margin-top:5px}.table{display:block;overflow-x:auto;white-space:nowrap}.modal-dialog{width:auto!important;margin:8px}}#tbl_trackers{table-layout:fixed;width:100%;min-width:800px}#tbl_trackers th:nth-child(1),#tbl_trackers td:nth-child(1){width:50px;text-align:center;padding-left:4px!important;padding-right:4px!important}#tbl_trackers th:nth-child(2),#tbl_trackers td:nth-child(2){width:120px}#tbl_trackers th:nth-child(3),#tbl_trackers td:nth-child(3){width:120px}#tbl_trackers th:nth-child(5),#tbl_trackers td:nth-child(5){width:120px}.td-num{display:block;font-size:11.5px;font-weight:600;font-family:Consolas,Monaco,monospace;color:color-mix(in srgb,var(--text) 44%,transparent);text-align:center}.td-tracker{display:inline-block;width:100%;padding:2px 8px;border-radius:.3rem;border:1px solid var(--line);background:var(--panel-soft);font-family:Consolas,Monaco,monospace;font-size:11.5px;font-weight:700;letter-spacing:.03em;white-space:nowrap}.td-subdomain{display:inline-block;padding:2px 8px;border-radius:.3rem!important;width:100%;border:1px solid var(--line);background:var(--panel-soft);font-family:Consolas,Monaco,monospace;font-size:11.5px;font-weight:700;letter-spacing:.03em;white-space:nowrap}.td-url{display:block;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:Consolas,Monaco,monospace;font-size:11.5px}.td-pass{font-family:Consolas,Monaco,monospace;font-size:11.5px;color:color-mix(in srgb,var(--text) 60%,transparent)}
/* bootgrid toolbar search/select fix */.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{background:color-mix(in srgb,var(--accent) 5%,transparent)!important;color:var(--text-strong)!important;box-shadow:none!important}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{background:transparent!important;color:var(--text-strong)!important;box-shadow:none!important}.panel,.panel-default{overflow:visible!important}.panel-body{overflow:visible!important}.table-responsive{overflow-x:auto!important;overflow-y:visible!important}.bootgrid-header{position:relative!important;z-index:80!important;display:block!important;margin:8px 0 7px!important;color:var(--text)!important}.bootgrid-header .actionBar{display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:8px!important;float:none!important;width:100%!important;margin:0!important;text-align:right!important;white-space:nowrap!important}.bootgrid-header .search{position:relative!important;display:inline-flex!important;align-items:center!important;float:none!important;width:220px!important;min-width:220px!important;max-width:260px!important;margin:0!important;vertical-align:middle!important}.bootgrid-header .search .input-group{display:flex!important;align-items:stretch!important;width:100%!important;border-collapse:separate!important}.bootgrid-header .search .input-group-addon{display:flex!important;align-items:center!important;justify-content:center!important;flex:0 0 34px!important;width:34px!important;min-width:34px!important;height:32px!important;padding:0!important;border:1px solid var(--line)!important;border-right:0!important;border-radius:var(--radius) 0 0 var(--radius)!important;background:var(--panel-soft)!important;color:var(--text)!important;line-height:1!important}.bootgrid-header .search .input-group-addon .glyphicon{top:0!important;font-size:12px!important}.bootgrid-header .search .search-field,.bootgrid-header .search .form-control{display:block!important;flex:1 1 auto!important;width:100%!important;height:32px!important;min-height:32px!important;padding:5px 9px!important;border:1px solid var(--line)!important;border-left:0!important;border-radius:0 var(--radius) var(--radius) 0!important;background:var(--panel)!important;color:var(--text)!important;font-size:12px!important;line-height:1.4!important;box-shadow:none!important}.bootgrid-header .search .search-field:focus,.bootgrid-header .search .form-control:focus{border-color:var(--accent)!important;border-left:0!important;box-shadow:none!important}.bootgrid-header .actions{position:relative!important;display:inline-flex!important;align-items:center!important;gap:6px!important;float:none!important;margin:0!important;vertical-align:middle!important}.bootgrid-header .actions>.btn-group{position:relative!important;display:inline-flex!important;float:none!important;margin:0!important;vertical-align:middle!important}.bootgrid-header .actions .btn,.bootgrid-header .actions .dropdown-toggle{display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:6px!important;height:32px!important;min-width:38px!important;padding:5px 10px!important;line-height:1.2!important;border-radius:var(--radius)!important}.bootgrid-header .actions .dropdown-toggle{min-width:64px!important}.bootgrid-header .actions .dropdown-toggle .caret{margin-left:2px!important}.bootgrid-header .actions .dropdown-menu{position:absolute!important;top:calc(100% + 4px)!important;right:0!important;left:auto!important;z-index:3000!important;display:none;min-width:112px!important;width:112px!important;margin:0!important;padding:4px!important;border:1px solid var(--line)!important;border-radius:var(--radius)!important;background:var(--panel)!important;box-shadow:var(--shadow-modal)!important;list-style:none!important}.bootgrid-header .actions .open>.dropdown-menu{display:block!important}.bootgrid-header .actions .dropdown-menu>li{display:block!important;float:none!important;width:100%!important;margin:0!important;padding:0!important;text-align:left!important}.bootgrid-header .actions .dropdown-menu>li>a{display:block!important;width:100%!important;min-width:0!important;padding:6px 9px!important;border-radius:var(--radius)!important;background:transparent!important;color:var(--text)!important;font-size:12px!important;line-height:1.25!important;text-align:left!important;white-space:nowrap!important}.bootgrid-header .actions .dropdown-menu>li>a:hover,.bootgrid-header .actions .dropdown-menu>li>a:focus{background:var(--panel-soft)!important;color:var(--text-strong)!important}.bootgrid-header .actions .dropdown-menu>.active>a,.bootgrid-header .actions .dropdown-menu>.active>a:hover,.bootgrid-header .actions .dropdown-menu>.active>a:focus{background:var(--accent-soft)!important;color:var(--text-strong)!important;box-shadow:none!important}.bootgrid-footer{position:relative!important;z-index:20!important}.bootgrid-footer .pagination{margin:0!important}@media screen and (max-width:768px){.bootgrid-header .actionBar{align-items:stretch!important;justify-content:stretch!important;flex-wrap:wrap!important;gap:6px!important}.bootgrid-header .search{width:100%!important;min-width:0!important;max-width:none!important;flex:1 0 100%!important}.bootgrid-header .actions{margin-left:auto!important}.bootgrid-header .actions .dropdown-menu{right:0!important;left:auto!important}}
input:focus,textarea:focus,select:focus,button:focus,.form-control:focus,.btn:focus,a:focus{outline:none!important}
/* final action icon render fix */#tbl_trackers th:last-child,#tbl_trackers td:last-child{text-align:center!important;white-space:nowrap!important;width:108px!important;min-width:108px!important;max-width:108px!important}.bootgrid-table td:last-child{overflow:visible!important}.action-btn,.bootgrid-table .command-edit,.bootgrid-table .command-delete{display:inline-flex!important;align-items:center!important;justify-content:center!important;width:32px!important;height:26px!important;min-width:32px!important;min-height:26px!important;padding:0!important;margin:0 2px!important;border:1px solid var(--line)!important;border-radius:var(--radius)!important;background:var(--panel)!important;color:var(--text)!important;font-size:0!important;line-height:1!important;text-indent:0!important;vertical-align:middle!important;opacity:1!important;visibility:visible!important;box-shadow:none!important;overflow:visible!important}.action-btn:hover,.bootgrid-table .command-edit:hover{background:var(--accent-soft)!important;border-color:var(--line)!important;color:var(--text-strong)!important}.bootgrid-table .command-delete{color:var(--danger)!important}.bootgrid-table .command-delete:hover{background:var(--danger-soft)!important;border-color:color-mix(in srgb,var(--danger) 34%,var(--line))!important;color:var(--danger)!important}.bootgrid-table .command-edit[disabled],.bootgrid-table .command-delete[disabled]{opacity:.58!important;cursor:not-allowed!important}.action-btn .action-ico,.bootgrid-table .command-edit .action-ico,.bootgrid-table .command-delete .action-ico{display:inline-flex!important;align-items:center!important;justify-content:center!important;width:16px!important;height:16px!important;min-width:16px!important;min-height:16px!important;color:currentColor!important;opacity:1!important;visibility:visible!important;overflow:visible!important;pointer-events:none!important}.action-btn svg,.bootgrid-table .command-edit svg,.bootgrid-table .command-delete svg{display:block!important;width:16px!important;height:16px!important;min-width:16px!important;min-height:16px!important;overflow:visible!important;color:currentColor!important;opacity:1!important;visibility:visible!important;pointer-events:none!important}.action-btn svg *,.bootgrid-table .command-edit svg *,.bootgrid-table .command-delete svg *{vector-effect:non-scaling-stroke!important;stroke:currentColor!important;stroke-width:2!important;stroke-linecap:round!important;stroke-linejoin:round!important;fill:none!important;opacity:1!important;visibility:visible!important}.btn-icon svg,.btn-primary svg{display:block!important;width:13px!important;height:13px!important;fill:currentColor!important;color:currentColor!important;opacity:1!important;visibility:visible!important}input:focus,textarea:focus,select:focus,button:focus,.form-control:focus,.btn:focus,a:focus{outline:none!important}
body,.table,input,select,textarea{font-family:monospace!important}body::before{content:'NGIX\2022 XCTD';position:fixed;top:12px;left:14px;z-index:0;font:600 11px/1 Inter,ui-sans-serif,system-ui,-apple-system,sans-serif;letter-spacing:.24em;text-transform:uppercase;color:rgba(68,71,70,.06);pointer-events:none}body::after{content:'';position:fixed;inset:0;z-index:0;pointer-events:none;background-image:url('/assets/favicon.svg'),url('/assets/bg.png');background-repeat:no-repeat,no-repeat;background-position:right 14px bottom 12px,center center;background-size:28px 28px,cover;opacity:.28;filter:saturate(.68) contrast(.84) brightness(1.03) blur(.32px);transform:translateZ(0)}
.table{width:100%;border-collapse:collapse;font-size:12.5px;margin:0!important;border:0!important;border-radius:0!important;background:transparent!important}
.table>thead>tr>th{height:34px;padding:0 12px!important;text-align:left;font-size:11px;font-weight:600;color:var(--text-strong);text-transform:uppercase;letter-spacing:.06em;border-bottom:1px solid var(--line)!important;border-top:0!important;background:var(--panel-soft)!important;white-space:nowrap;position:static}
.table>tbody>tr>td{padding:6px 12px!important;vertical-align:middle;border-bottom:1px solid var(--line-soft)!important;border-top:0!important;font-size:12.5px;font-weight:400;color:var(--text)!important;word-break:break-word;background:transparent!important}
.table>tbody>tr:last-child>td{border-bottom:0!important}
.table-hover>tbody>tr:hover>td{background:var(--panel-soft)!important}
.table-striped>tbody>tr:nth-of-type(odd)>td{background:transparent!important}
.tbl-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px;flex-wrap:wrap;border-bottom:1px solid #eee;background:#f5f5f5}
.tbl-toolbar-left{display:flex;align-items:center;gap:6px}
.tbl-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px;border-top:1px solid #eee;font-size:12px;color:var(--text);flex-wrap:wrap;background:#f5f5f5}
#tbl_trackers td.url-cell{max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.form-control:focus,input:focus,select:focus,textarea:focus{outline:none;color:var(--text-strong)!important}
.panel,.panel-default{box-shadow:none!important}
.modal-content{box-shadow:none!important}
.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{box-shadow:none!important;background:transparent!important;color:var(--text-strong)!important}
.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{background:transparent!important;color:var(--text-strong)!important;box-shadow:none!important}
input:focus,textarea:focus,select:focus,button:focus,.form-control:focus,.btn:focus,a:focus{outline:none!important}
.form-control:focus,input:focus,select:focus,textarea:focus{box-shadow:none!important}.bootgrid-header .search .search-field:focus,.bootgrid-header .search .form-control:focus{box-shadow:none!important}*:focus,*:focus-visible{outline:none!important;box-shadow:none!important}
/* realtime page local fixes */
.panel_m{margin-top:4px}.panel-heading .panel-title{gap:10px}.panel-heading .searchbox{display:flex!important;align-items:stretch!important;flex:1 1 auto!important;max-width:520px!important;width:100%!important}.panel-heading .searchbox>.input-group-addon{display:flex!important;align-items:center!important;justify-content:center!important;flex:0 0 34px!important;width:34px!important;min-width:34px!important;height:31px!important;padding:0!important;border-right:0!important;border-radius:var(--radius) 0 0 var(--radius)!important}.panel-heading .searchbox>.form-control{display:block!important;flex:1 1 auto!important;width:auto!important;min-width:0!important;border-left:0!important;border-right:0!important;border-radius:0!important}.panel-heading .searchbox>.input-group-btn{display:flex!important;flex:0 0 auto!important;width:auto!important}.panel-heading .searchbox>.input-group-btn>.btn{height:31px!important;margin:0!important;border-radius:0 var(--radius) var(--radius) 0!important;white-space:nowrap!important}.pre-colon{font-weight:700;color:var(--text-strong)}.post-colon{font-family:Consolas,Monaco,'Courier New',monospace;color:var(--text)}#notifications{position:fixed;right:12px;bottom:12px;z-index:10060;display:flex;flex-direction:column;gap:6px;align-items:flex-end}.notice{max-width:420px;padding:8px 10px;border:1px solid var(--blue-line);border-radius:var(--radius);background:var(--panel);color:var(--text);box-shadow:var(--shadow-modal);font-size:12px;line-height:1.35}.notice .close{float:right;margin-left:8px;width:14px;height:14px;border:0!important;border-radius:var(--radius)!important;background:var(--panel-soft)!important}#logout-toast{position:fixed;right:12px;bottom:12px;z-index:10070;display:none;padding:8px 10px;border:1px solid var(--line);border-radius:var(--radius);background:var(--panel);color:var(--text);box-shadow:var(--shadow-modal);font-size:12px}#logout-toast.show{display:block}.navbar-btn.btn-link{margin:0!important;border:0!important;background:transparent!important;box-shadow:none!important}@media screen and (max-width:768px){.panel-heading .panel-title{display:block!important}.panel-heading .searchbox{max-width:none!important}.panel-heading .searchbox>.input-group-addon,.panel-heading .searchbox>.form-control,.panel-heading .searchbox>.input-group-btn,.panel-heading .searchbox>.input-group-btn>.btn{display:flex!important;width:auto!important}.panel-heading .searchbox>.form-control{flex:1 1 auto!important}.panel-heading .searchbox>.input-group-btn>.btn{margin-top:0!important}.navbar-btn.btn-link{padding:12px 10px!important}.table{width:100%!important;min-width:860px!important}}

/* ngix xctd backdrop */
.ngix-backdrop{position:relative;width:100%;max-width:1180px;min-height:168px;margin:0 auto 8px;border-radius:var(--radius);overflow:hidden;background:linear-gradient(180deg,#f8f9fa 0%,#fff 100%);border:1px solid var(--line-soft);isolation:isolate}
.ngix-backdrop:before{content:"";position:absolute;inset:-18px;background:linear-gradient(118deg,transparent 0 13%,rgba(255,112,0,.94) 13% 16%,rgba(33,37,41,.94) 16% 21%,transparent 21%),linear-gradient(298deg,transparent 0 12%,rgba(255,112,0,.94) 12% 15%,rgba(33,37,41,.94) 15% 20%,transparent 20%),radial-gradient(circle at 50% 38%,rgba(33,37,41,.035),transparent 44%);opacity:.96;z-index:0}
.ngix-backdrop:after{content:"";position:absolute;left:50%;top:51%;width:360px;height:360px;transform:translate(-50%,-50%);background:linear-gradient(45deg,transparent 42%,rgba(33,37,41,.055) 43% 57%,transparent 58%),linear-gradient(-45deg,transparent 42%,rgba(33,37,41,.045) 43% 57%,transparent 58%);clip-path:polygon(50% 8%,64% 29%,83% 10%,91% 56%,70% 84%,57% 92%,43% 92%,30% 84%,9% 56%,17% 10%,36% 29%);opacity:.75;z-index:0}
.ngix-backdrop-inner{position:relative;z-index:1;display:flex;align-items:center;justify-content:center;min-height:168px;padding:24px;text-align:center}
.ngix-backdrop-title{margin:0;color:#1f2221;font-family:Consolas,Monaco,"Courier New",monospace;font-size:34px;font-weight:800;line-height:1;letter-spacing:.32em;text-transform:uppercase}
.ngix-backdrop-title span{color:#b8bbbe;font-weight:400}.ngix-backdrop-title i{font-style:normal;color:#ff7000;letter-spacing:.08em}
.ngix-backdrop-sub{margin:12px 0 0;color:#6e7370;font-family:Consolas,Monaco,"Courier New",monospace;font-size:11px;font-weight:400;line-height:1.4;letter-spacing:.32em;text-transform:uppercase}
.ngix-backdrop-sub i{font-style:normal;color:#ff7000;font-weight:800;letter-spacing:.08em}
@media (prefers-color-scheme:dark){.ngix-backdrop{background:linear-gradient(180deg,#212529 0%,#2b3035 100%);border-color:rgba(248,249,250,.06)}.ngix-backdrop-title{color:#f8f9fa}.ngix-backdrop-title span{color:#6e7370}.ngix-backdrop-sub{color:#adb5bd}.ngix-backdrop:after{opacity:.30;filter:invert(1)}}
@media screen and (max-width:768px){.ngix-backdrop{min-height:132px;margin-bottom:6px}.ngix-backdrop-inner{min-height:132px;padding:18px}.ngix-backdrop-title{font-size:24px;letter-spacing:.22em}.ngix-backdrop-sub{font-size:9px;letter-spacing:.22em}.ngix-backdrop:after{width:260px;height:260px}}

/* performance click shared-layout patch */.pc-toolbar{margin-bottom:6px}.pc-search{display:flex!important;align-items:stretch!important;flex-wrap:nowrap!important;width:100%!important}.pc-search .input-group-addon{display:flex!important;align-items:center!important;justify-content:center!important;flex:0 0 34px!important;width:34px!important;min-width:34px!important;height:31px!important;border-right:0!important;border-radius:var(--radius) 0 0 var(--radius)!important}.pc-search .form-control{flex:1 1 auto!important;width:auto!important;min-width:0!important;border-left:0!important;border-radius:0 var(--radius) var(--radius) 0!important}.pc-table-wrap{display:none}.pc-icon{display:inline-block;width:16px;height:16px;vertical-align:middle}.pc-icon-sm{width:13px;height:13px}.pc-country{color:var(--danger)!important}.pc-click{font-family:Consolas,Monaco,'Courier New',monospace;font-weight:700;color:var(--text-strong)}.pc-page-meta{color:var(--text);font-size:11px;margin-left:8px}.pc-pagination{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:10px 0 4px}.pc-pagination .pagination{margin:0!important;display:flex;flex-wrap:wrap}.logout-form{margin:0}.logout-btn{padding:12px 10px!important;color:var(--text)!important;text-decoration:none!important;background:transparent!important;border:0!important}.rg-source .pre-colon{font-weight:800;color:var(--text-strong)}.rg-source .post-colon{font-family:Consolas,Monaco,'Courier New',monospace}.is-hidden{display:none!important}#logout-toast{position:fixed;right:12px;bottom:12px;z-index:10050;display:none;padding:8px 10px;border:1px solid var(--line);border-radius:var(--radius);background:var(--panel);color:var(--text);box-shadow:var(--shadow-modal);font-size:12px}#logout-toast.show{display:block}@media screen and (max-width:768px){.pc-search{display:flex!important}.pc-search .input-group-addon{width:34px!important}.pc-search .form-control{width:auto!important}#perf-click-table{min-width:860px!important}.pc-page-meta{display:block;width:100%;margin-left:0}.navbar-btn.logout-btn{padding:9px 10px!important}}
:root{font-size:10.5px!important}.table>tbody>tr>td{font-family:var(--font-mono-old)!important;font-size:12px!important}.form-control,input,select,textarea,.btn,button{font-family:var(--font-mono-old)!important;font-size:11.5px!important}
/* click #perf-click-table column alignment */
#perf-click-table th:nth-child(1),#perf-click-table td:nth-child(1){width:44px!important;min-width:44px!important;max-width:44px!important;text-align:left!important;padding-left:12px!important;padding-right:8px!important;font-variant-numeric:tabular-nums}
.app-sign{text-align:right;padding:3px 0 2px}.app-sign footer{font-family:'Caveat','Dancing Script',cursive;font-size:17px;font-weight:600;color:#444746;text-decoration:none;letter-spacing:.02em;line-height:1}select hr{border:none;border-top:1px solid rgba(68,71,70,.06)!important;color:rgba(68,71,70,.06)!important;opacity:.45;margin:1px 4px}input[type=url]{font-family:Consolas,Monaco,"Courier New",monospace!important}
/* tighten search ↔ table gap */
.panel_m .panel-body{padding:0 0 2px!important}
#perf-click-table{margin-top:0!important}
/* sortable headers */
#perf-click-table thead th{cursor:pointer;user-select:none;white-space:nowrap}
#perf-click-table thead th::after{content:'\2195';margin-left:6px;font-size:9px;opacity:.3}
#perf-click-table thead th.sort-asc::after{content:'\2191';opacity:.9}
#perf-click-table thead th.sort-desc::after{content:'\2193';opacity:.9}
/* footer + rg-source block */
.app-footer{width:100%;max-width:1180px;margin:12px auto 0;padding:7px 8px 3px;border-top:1px solid var(--line-soft);text-align:right;line-height:1.3}
.app-footer .app-sign{padding:0;font-family:'Caveat','Dancing Script',cursive;font-size:17px;font-weight:600;color:#444746;letter-spacing:.02em;line-height:1}
.app-footer .rg-source{margin-top:3px;font-size:11px;color:var(--muted)}
.app-footer .rg-source .pre-colon{font-weight:800;color:var(--text-strong)}
.app-footer .rg-source .post-colon{font-family:Consolas,Monaco,'Courier New',monospace;color:var(--text)}
/* centered content backdrop override */
.panel_m.panel{position:relative!important;overflow:hidden!important;isolation:isolate!important}
.panel_m.panel>.ngix-backdrop{position:absolute!important;inset:0!important;width:auto!important;max-width:none!important;min-height:0!important;margin:0!important;border:0!important;border-radius:var(--radius)!important;background:transparent!important;pointer-events:none!important;z-index:0!important;isolation:auto!important}
.panel_m.panel>.ngix-backdrop:before{content:""!important;position:absolute!important;inset:0!important;background:radial-gradient(circle at 50% 50%,rgba(33,37,41,.045),transparent 44%),linear-gradient(116deg,transparent 0 18%,rgba(255,112,0,.11) 18% 20%,rgba(33,37,41,.08) 20% 24%,transparent 24%),linear-gradient(296deg,transparent 0 18%,rgba(255,112,0,.11) 18% 20%,rgba(33,37,41,.08) 20% 24%,transparent 24%)!important;opacity:1!important;z-index:0!important}
.panel_m.panel>.ngix-backdrop:after{content:""!important;position:absolute!important;left:50%!important;top:53%!important;width:min(470px,76vw)!important;height:min(470px,76vw)!important;transform:translate(-50%,-50%)!important;background:linear-gradient(45deg,transparent 42%,rgba(33,37,41,.055) 43% 57%,transparent 58%),linear-gradient(-45deg,transparent 42%,rgba(33,37,41,.045) 43% 57%,transparent 58%)!important;clip-path:polygon(50% 8%,64% 29%,83% 10%,91% 56%,70% 84%,57% 92%,43% 92%,30% 84%,9% 56%,17% 10%,36% 29%)!important;opacity:.62!important;z-index:0!important}
.panel_m.panel>.ngix-backdrop>.ngix-backdrop-inner{position:absolute!important;inset:0!important;z-index:1!important;display:flex!important;align-items:center!important;justify-content:center!important;min-height:0!important;height:100%!important;padding:0!important;text-align:center!important}
.panel_m.panel .ngix-backdrop-title{margin:0!important;color:#1f2221!important;font-family:Consolas,Monaco,"Courier New",monospace!important;font-size:30px!important;font-weight:800!important;line-height:1!important;letter-spacing:.30em!important;text-transform:uppercase!important;opacity:.095!important}
.panel_m.panel .ngix-backdrop-title span{color:#1f2221!important;font-weight:400!important}.panel_m.panel .ngix-backdrop-title i{font-style:normal!important;color:#ff7000!important;letter-spacing:.08em!important}
.panel_m.panel .ngix-backdrop-sub{margin:11px 0 0!important;color:#1f2221!important;font-family:Consolas,Monaco,"Courier New",monospace!important;font-size:10px!important;font-weight:400!important;line-height:1.4!important;letter-spacing:.28em!important;text-transform:uppercase!important;opacity:.10!important}
.panel_m.panel .ngix-backdrop-sub i{font-style:normal!important;color:#ff7000!important;font-weight:800!important;letter-spacing:.08em!important}
.panel_m.panel>.panel-heading,.panel_m.panel>.panel-body{position:relative!important;z-index:2!important}
@media (prefers-color-scheme:dark){.panel_m.panel>.ngix-backdrop:before{background:radial-gradient(circle at 50% 50%,rgba(248,249,250,.04),transparent 44%),linear-gradient(116deg,transparent 0 18%,rgba(255,112,0,.12) 18% 20%,rgba(248,249,250,.07) 20% 24%,transparent 24%),linear-gradient(296deg,transparent 0 18%,rgba(255,112,0,.12) 18% 20%,rgba(248,249,250,.07) 20% 24%,transparent 24%)!important}.panel_m.panel>.ngix-backdrop:after{filter:invert(1)!important;opacity:.26!important}.panel_m.panel .ngix-backdrop-title,.panel_m.panel .ngix-backdrop-sub{color:#f8f9fa!important}}
@media screen and (max-width:768px){.panel_m.panel .ngix-backdrop-title{font-size:22px!important;letter-spacing:.20em!important}.panel_m.panel .ngix-backdrop-sub{font-size:8px!important;letter-spacing:.18em!important}.panel_m.panel>.ngix-backdrop:after{width:280px!important;height:280px!important}}

/* ngix xctd image backdrop final */
.panel_m.panel{position:relative!important;overflow:hidden!important;isolation:isolate!important;background:rgba(255,255,255,.74)!important}
.panel_m.panel>.ngix-image-backdrop{position:absolute!important;inset:0!important;z-index:0!important;pointer-events:none!important;background-image:linear-gradient(rgba(255,255,255,.82),rgba(255,255,255,.82)),url('<?= statH(statAssetUrl('/dist/ngix-backdrop.png')) ?>')!important;background-repeat:no-repeat,no-repeat!important;background-position:center center,center center!important;background-size:100% 100%,cover!important;opacity:.42!important;filter:saturate(.72) contrast(.86) blur(.22px)!important;transform:translateZ(0)!important}
.panel_m.panel>.panel-heading,.panel_m.panel>.panel-body{position:relative!important;z-index:2!important}
.panel_m.panel>.panel-heading{background:rgba(245,245,245,.82)!important;backdrop-filter:saturate(110%) blur(1px)!important}
.panel_m.panel>.panel-body{background:rgba(255,255,255,.46)!important}
#perf-click-table{position:relative!important;z-index:3!important;background:rgba(255,255,255,.58)!important}
#perf-click-table>thead>tr>th{background:rgba(245,245,245,.86)!important}
#perf-click-table>tbody>tr>td{background:rgba(255,255,255,.34)!important}
#perf-click-table.table-hover>tbody>tr:hover>td{background:rgba(245,245,245,.72)!important}
@media (prefers-color-scheme:dark){.panel_m.panel{background:rgba(33,37,41,.78)!important}.panel_m.panel>.ngix-image-backdrop{background-image:linear-gradient(rgba(33,37,41,.78),rgba(33,37,41,.78)),url('<?= statH(statAssetUrl('/dist/ngix-backdrop.png')) ?>')!important;opacity:.46!important;filter:saturate(.70) contrast(.84) blur(.18px)!important}.panel_m.panel>.panel-heading{background:rgba(33,37,41,.84)!important}.panel_m.panel>.panel-body{background:rgba(33,37,41,.50)!important}#perf-click-table{background:rgba(33,37,41,.50)!important}#perf-click-table>thead>tr>th{background:rgba(52,58,64,.86)!important}#perf-click-table>tbody>tr>td{background:rgba(33,37,41,.34)!important}#perf-click-table.table-hover>tbody>tr:hover>td{background:rgba(52,58,64,.72)!important}}
@media screen and (max-width:768px){.panel_m.panel>.ngix-image-backdrop{background-size:100% 100%,cover!important;background-position:center center,center center!important;opacity:.34!important}}
.navbar-fixed-top{overflow:visible!important;z-index:1040!important}.navbar-collapse{overflow:visible!important}.pc-nav-dropdown{position:relative!important}.pc-nav-dropdown>.pc-nav-toggle{display:flex!important;align-items:center!important;gap:6px!important;min-height:44px!important}.pc-nav-dropdown>.pc-nav-toggle .caret{margin-left:2px!important}.pc-nav-dropdown.open>.pc-nav-toggle,.pc-nav-dropdown>.pc-nav-toggle:hover,.pc-nav-dropdown>.pc-nav-toggle:focus{background:var(--panel-soft)!important;color:var(--text-strong)!important}.pc-nav-menu{position:absolute!important;top:100%!important;right:0!important;left:auto!important;z-index:5000!important;display:none;min-width:230px!important;width:230px!important;margin:2px 0 0!important;padding:6px!important;border:1px solid var(--line)!important;border-radius:var(--radius)!important;background:var(--panel2)!important;box-shadow:0 10px 24px rgba(0,0,0,.10)!important;list-style:none!important}.pc-nav-dropdown.open>.pc-nav-menu{display:block!important}.pc-nav-menu>li{display:block!important;float:none!important;width:100%!important;margin:0!important;padding:0!important}.pc-nav-menu>li>a,.pc-nav-menu>.dropdown-header{display:flex!important;align-items:center!important;gap:6px!important;width:100%!important;min-height:30px!important;padding:7px 9px!important;border-radius:var(--radius)!important;color:var(--text)!important;font-size:12px!important;line-height:1.25!important;white-space:nowrap!important}.pc-nav-menu>li>a:hover,.pc-nav-menu>li>a:focus{background:var(--panel-soft)!important;color:var(--text-strong)!important}.pc-nav-menu>li.active>a,.pc-nav-menu>li.active>a:hover,.pc-nav-menu>li.active>a:focus{background:var(--accent-soft)!important;color:var(--text-strong)!important}.pc-nav-menu>.divider{height:1px!important;min-height:1px!important;margin:4px 2px!important;overflow:hidden!important;background:var(--line-soft)!important}.pc-nav-menu>.dropdown-header{color:var(--muted)!important;font-weight:700!important;text-transform:uppercase!important;letter-spacing:.04em!important}@media screen and (max-width:768px){.pc-nav-dropdown>.pc-nav-toggle{justify-content:space-between!important}.pc-nav-menu{position:static!important;width:100%!important;min-width:0!important;margin:0 0 8px!important;box-shadow:none!important}.pc-nav-dropdown.open>.pc-nav-menu{display:block!important}}
</style>
<style nonce="<?= pcH($rtNonce) ?>">
/* unified statistics template override */
body{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif!important;background:linear-gradient(180deg,#fff 0%,#f8fafd 100%)!important;color:var(--text)!important;font-size:13px!important;line-height:1.45!important}
.navbar.navbar-default{min-height:44px!important;background:rgba(255,255,255,.96)!important;border:0!important;box-shadow:none!important}
.navbar-brand,.navbar-nav>li>a,.navbar-btn.btn-link,.logout-btn{height:44px!important;min-height:44px!important;padding:12px 10px!important;font-size:12px!important;line-height:20px!important;color:var(--text)!important;background:transparent!important;border:0!important;text-decoration:none!important}
.navbar-brand strong,.navbar-nav strong,.logout-btn strong{font-weight:800!important;letter-spacing:.02em!important}
.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{background:transparent!important;color:var(--text-strong)!important;box-shadow:none!important}
.container{width:100%!important;max-width:1180px!important;margin:0 auto!important}
.panel_m.panel{margin-top:4px!important;border:0!important;border-radius:var(--radius)!important;background:rgba(255,255,255,.74)!important;box-shadow:none!important;overflow:hidden!important;isolation:isolate!important}
.panel_m.panel>.panel-heading{padding:8px 10px!important;background:rgba(245,245,245,.86)!important;border:0!important;color:var(--text-strong)!important}
.panel_m.panel>.panel-body{padding:0 0 2px!important;background:rgba(255,255,255,.46)!important}
.pn-toolbar,.pc-toolbar{display:flex!important;align-items:flex-start!important;justify-content:space-between!important;gap:8px!important;flex-wrap:wrap!important}
.pn-toolbar .searchbox,.pc-search{display:flex!important;align-items:stretch!important;flex:1 1 540px!important;max-width:540px!important;min-width:280px!important;margin:0!important}
.pn-toolbar .input-group,.pc-search{display:flex!important;width:100%!important;flex-wrap:nowrap!important}
.pn-toolbar .input-group-addon,.pc-search .input-group-addon{display:flex!important;align-items:center!important;justify-content:center!important;flex:0 0 34px!important;width:34px!important;height:31px!important;padding:0!important;border:1px solid var(--line)!important;border-right:0!important;border-radius:var(--radius) 0 0 var(--radius)!important;background:var(--panel-soft)!important}
.pn-toolbar .form-control,.pc-search .form-control{display:block!important;flex:1 1 auto!important;width:auto!important;min-width:0!important;height:31px!important;border:1px solid var(--line)!important;border-left:0!important;border-radius:0 var(--radius) var(--radius) 0!important;background:var(--panel)!important;color:var(--text)!important;font-size:12px!important}
.pn-toolbar .input-group-btn>.btn,.pn-refresh-btn{display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:5px!important;height:31px!important;margin:0!important;padding:0 10px!important;border:1px solid var(--line)!important;border-left:0!important;border-radius:0 var(--radius) var(--radius) 0!important;background:var(--panel)!important;color:var(--text)!important;font-size:11.5px!important;white-space:nowrap!important}
.pn-export,#pc-export,#rt-export{display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:6px!important;flex:0 0 auto!important}
.table{width:100%!important;margin:0!important;border-collapse:collapse!important;border-spacing:0!important;background:transparent!important}
.table>thead>tr>th{height:34px!important;padding:0 12px!important;background:rgba(245,245,245,.86)!important;border-top:0!important;border-bottom:1px solid var(--line)!important;color:var(--text-strong)!important;font-size:11.5px!important;font-weight:700!important;letter-spacing:.06em!important;text-transform:uppercase!important;white-space:nowrap!important}
.table>tbody>tr>td,.table>tfoot>tr>th{padding:6px 12px!important;border-top:0!important;border-bottom:1px solid var(--line-soft)!important;background:rgba(255,255,255,.34)!important;color:var(--text)!important;font-size:12px!important;vertical-align:middle!important}
.table-hover>tbody>tr:hover>td{background:rgba(245,245,245,.72)!important}
.app-footer{width:100%!important;max-width:1180px!important;margin:12px auto 0!important;padding:7px 8px 3px!important;border-top:1px solid var(--line-soft)!important;text-align:right!important;line-height:1.3!important}
.app-footer .app-sign{padding:0!important;font-family:'Caveat','Dancing Script',cursive!important;font-size:17px!important;font-weight:600!important;color:#444746!important;letter-spacing:.02em!important;line-height:1!important}
.app-footer .rg-source{margin-top:3px!important;font-size:11px!important;color:var(--muted)!important}.rt-click-id,.rt-country-code,.rt-notice-line span,.rt-notice-line code,.rt-notice-line strong,.rt-notice-line b{font-weight: 400!important;font-family: monospace;}
@media screen and (max-width:768px){.container{max-width:100%!important;padding-left:6px!important;padding-right:6px!important}.pn-toolbar .searchbox,.pc-search{flex:1 1 100%!important;max-width:none!important;min-width:0!important}.pn-export,#pc-export,#rt-export{width:100%!important}.table{display:block!important;overflow-x:auto!important;white-space:nowrap!important}}
</style>
    <!-- Fixed navbar -->
    <nav class="navbar navbar-default navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button> 
          <a class="navbar-brand" href="#"><strong><?= pcIconImg('/dist/chart.svg', '', 13) ?> <?= pcH($title) ?></strong></a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
            <li class="dropdown active pc-nav-dropdown">
              <a href="#" class="dropdown-toggle pc-nav-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><strong><?= pcH($title) ?> <?= pcIconImg('/dist/chart.svg', '', 13) ?></strong> <span class="caret"></span></a>
              <ul class="dropdown-menu pc-nav-menu">
                <li class="dropdown-header">PERFORMANCE CLICKS</li>
                <li role="separator" class="divider"></li>
                <li><a href="<?= statH(statUrl('/realtime/?date=rt_1')) ?>"><strong>TODAY</strong></a></li>
                <li role="separator" class="divider"></li>
                <li><a href="<?= statH(statUrl('/realtime/?date=rt_2')) ?>"><strong>YESTERDAY</strong></a></li>
                <li role="separator" class="divider"></li>
                <li class="active"><a href="#"><strong>PERFORMANCE CLICKS <?= pcIconImg('/dist/chart.svg', '', 13) ?></strong></a></li>
              </ul>
            </li>
            <li><a></a></li>
            <li><a href="<?= statH(statUrl('/performance/')) ?>"><strong>PERFORMANCE NETWORK</strong> </a></li>
            <li>
              <form method="post" action="<?= pcH($self) ?>" id="logout-form" class="logout-form">
                <input type="hidden" name="csrf_token" value="<?= pcH(pcCsrfToken()) ?>">
                <input type="hidden" name="action" value="logout">
                <button type="submit" id="btn-logout" class="btn btn-link navbar-btn logout-btn"><strong>LOGOUT</strong></button>
              </form>
            </li>
          </ul>
        </div>
      </div>
    </nav>
    <div class="container">
        <div class="panel_m panel panel-default">
            <div class="ngix-image-backdrop" aria-hidden="true"></div>

            <div class="panel-heading">
                <div class="pn-toolbar">
                    <div class="input-group search searchbox pc-search">
                        <span class="input-group-addon"><?= pcIconImg('/dist/search.svg', '', 13) ?></span>
                        <input type="text" class="form-control input-sm filter" id="search" placeholder="Search for ID.." title="Type in a name" autocomplete="off">
                        <span class="input-group-btn">
                            <button type="button" id="refresh" class="btn btn-default btn-sm pn-refresh-btn" onclick="window.location.reload()">
                                <?= pcIconImg('/dist/refresh.svg', '', 13) ?> <strong>Refresh</strong>
                            </button>
                        </span>
                    </div>
                    <div id="pc-export" class="pn-export"></div>
                </div>
            </div>
            <div class="panel-body">
                <table class="table table-condensed table-hover table-striped" id="perf-click-table">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>CLICKID</th>
                            <th>COUNTRY</th>
                            <th>TRAFFIC</th>
                            <th>IP ADDRESS</th>
                            <th>NETWORK</th>
                        </tr>
                    </thead>
                    <tbody>
                    <?php foreach ($rows as $row) : ?>
                        <?php
                        if (!is_array($row)) {
                            continue;
                        }

                        $id = isset($row['id']) ? (int) $row['id'] : 0;
                        $clickId = strtoupper(trim((string) ($row['click_id'] ?? '')));
                        $countryCode = pcRenderCountry($row['country_code'] ?? '');
                        $userAgent = pcRenderUserAgent($row['user_agent'] ?? '');
                        $ipAddress = trim((string) ($row['ip_address'] ?? ''));
                        $network = pcRenderNetwork($row['info'] ?? '');
                        ?>
                        <tr class="pc-row" data-click-id="<?= pcH(strtolower($clickId)) ?>">
                            <td><?= (int) $id ?></td>
                            <td><span class="pc-click"><?= pcH($clickId) ?></span></td>
                            <td><?= $countryCode ?></td>
                            <td><?= $userAgent ?></td>
                            <td><code><?= pcH($ipAddress) ?></code></td>
                            <td><?= $network ?></td>
                        </tr>
                    <?php endforeach; ?>

                    <?php if (count($rows) === 0) : ?>
                        <tr>
                            <td colspan="6">There are currently no clicks available for this page.</td>
                        </tr>
                    <?php endif; ?>
                    </tbody>
                </table>
            </div>
        </div>

        <?php if ($totalPages > 1) : ?>
            <nav class="pc-pagination">
                <ul class="pagination pagination-sm">
                    <li class="<?= $page <= 1 ? 'disabled' : '' ?>">
                        <a href="<?= pcH(pcPageUrl($page - 1)) ?>">&laquo;</a>
                    </li>
                    <?php
                    $startPage = max(1, $page - 4);
            $endPage = min($totalPages, $page + 4);
            ?>

                    <?php if ($startPage > 1) : ?>
                        <li class="disabled"><a href="#">…</a></li>
                    <?php endif; ?>

                    <?php for ($p = $startPage; $p <= $endPage; $p++) : ?>
                        <li class="<?= $p === $page ? 'active' : '' ?>">
                            <a href="<?= pcH(pcPageUrl($p)) ?>"><?= (int) $p ?></a>
                        </li>
                    <?php endfor; ?>

                    <?php if ($endPage < $totalPages) : ?>
                        <li class="disabled"><a href="#">…</a></li>
                    <?php endif; ?>

                    <li class="<?= $page >= $totalPages ? 'disabled' : '' ?>">
                        <a href="<?= pcH(pcPageUrl($page + 1)) ?>">&raquo;</a>
                    </li>
                </ul>
                <small class="pc-page-meta">
                    <?= number_format($total > 0 ? $offset + 1 : 0) ?>–<?= number_format(min($offset + $perPage, $total)) ?>
                    of <?= number_format($total) ?>
                </small>
            </nav>
        <?php endif; ?>
    </div>

<script type="text/javascript">
$(document).ready(function () {
    'use strict';

    $('.pc-nav-toggle').on('click', function (e) {
        var $dropdown = $(this).closest('.pc-nav-dropdown');

        if ($dropdown.length < 1) {
            return;
        }

        e.preventDefault();
        e.stopPropagation();

        $('.pc-nav-dropdown').not($dropdown).removeClass('open')
            .find('.pc-nav-toggle').attr('aria-expanded', 'false');

        $dropdown.toggleClass('open');
        $(this).attr('aria-expanded', $dropdown.hasClass('open') ? 'true' : 'false');
    });

    $(document).on('click', function () {
        $('.pc-nav-dropdown').removeClass('open')
            .find('.pc-nav-toggle').attr('aria-expanded', 'false');
    });

    $('.pc-nav-menu').on('click', function (e) {
        e.stopPropagation();
    });

    if ($.fn.tableExport) {
        $('#perf-click-table').tableExport({
            headers: true,
            footers: false,
            formats: ['xlsx'],
            fileName: 'click-' + new Date().toISOString().slice(0, 10),
            bootstrap: false,
            exportButtons: true,
            position: 'bottom',
            ignoreRows: null,
            ignoreCols: null,
            trimWhitespace: false,
            RTL: false,
            sheetname: 'id'
        });
        var $pcButtons = $('#perf-click-table').find('caption').children().detach();
        $pcButtons.appendTo('#pc-export');
    }

    $('.filter').on('input', function () {
        var needle = String($(this).val() || '').toLowerCase();

        $('.pc-row').each(function () {
            var $row = $(this);
            var clickId = String($row.attr('data-click-id') || '');

            if (clickId.indexOf(needle) !== -1) {
                $row.removeClass('is-hidden');
            } else {
                $row.addClass('is-hidden');
            }
        });
    });

    // column sorting (current page rows; keeps filter + export intact)
    (function () {
        var table = document.getElementById('perf-click-table');
        if (!table) {
            return;
        }

        var tbody = table.querySelector('tbody');
        var ths = Array.prototype.slice.call(table.querySelectorAll('thead th'));
        var numericCols = {0: true};

        ths.forEach(function (th, idx) {
            th.addEventListener('click', function () {
                var dir = th.classList.contains('sort-asc') ? 'desc' : 'asc';
                ths.forEach(function (o) {
                    o.classList.remove('sort-asc', 'sort-desc');
                });
                th.classList.add(dir === 'asc' ? 'sort-asc' : 'sort-desc');

                var mult = dir === 'asc' ? 1 : -1;
                var rows = Array.prototype.slice.call(tbody.querySelectorAll('tr.pc-row'));

                rows.sort(function (a, b) {
                    var av = a.children[idx] ? a.children[idx].textContent.trim() : '';
                    var bv = b.children[idx] ? b.children[idx].textContent.trim() : '';

                    if (numericCols[idx]) {
                        var an = parseFloat(av.replace(/[^0-9.\-]/g, '')) || 0;
                        var bn = parseFloat(bv.replace(/[^0-9.\-]/g, '')) || 0;
                        return (an - bn) * mult;
                    }

                    return av.toLowerCase().localeCompare(bv.toLowerCase()) * mult;
                });

                rows.forEach(function (r) {
                    tbody.appendChild(r);
                });
            });
        });
    })();

    $(document).on('submit', '#logout-form', function(e) {
    e.preventDefault();

    var form = this;
    var toast = document.getElementById('logout-toast');

    if (toast) {
        toast.classList.add('show');
    }

    window.setTimeout(function() {
        form.submit();
    }, 900);
});
});
</script>
<div id="logout-toast">Logging out…</div>
<footer class="app-footer">
    <div class="app-sign">Ngix · xctd</div>
    <div class="rg-source"><span class="pre-colon">SOURCE</span>: <span class="post-colon">NGIX ⸺ XCTD</span></div>
</footer>
<style nonce="<?= pcH($rtNonce) ?>">
/* NGIX patch: fullscreen background/backdrop override */
html,body{min-height:100svh!important}
body{background-color:var(--bg,#f8fafc)!important;background-attachment:fixed!important}
body::after{content:""!important;position:fixed!important;inset:0!important;width:100vw!important;min-width:100vw!important;height:100vh!important;height:100dvh!important;z-index:0!important;pointer-events:none!important;background-image:url('/assets/favicon.svg'),url('/assets/bg.png')!important;background-repeat:no-repeat,no-repeat!important;background-position:right 14px bottom 12px,center center!important;background-size:28px 28px,cover!important;opacity:.30!important;filter:saturate(.68) contrast(.84) brightness(1.03) blur(.32px)!important;transform:translateZ(0)!important}
body>.container,body>.app-shell,body>.navbar,body>.panel,body>.panel_m,main,.container,.navbar,.panel,.panel_m,.app-footer{position:relative;z-index:1}
.panel_m.panel>.ngix-image-backdrop{position:fixed!important;inset:0!important;width:100vw!important;min-width:100vw!important;height:100vh!important;height:100dvh!important;z-index:0!important;pointer-events:none!important;background-repeat:no-repeat,no-repeat!important;background-position:center center,center center!important;background-size:100% 100%,cover!important;opacity:.40!important;filter:saturate(.72) contrast(.86) blur(.22px)!important;transform:translateZ(0)!important}
.panel_m.panel>.panel-heading,.panel_m.panel>.panel-body{position:relative!important;z-index:2!important}
@media (prefers-color-scheme:dark){body::after{opacity:.24!important;filter:saturate(.62) contrast(.78) brightness(.88) blur(.34px)!important}.panel_m.panel>.ngix-image-backdrop{opacity:.34!important;filter:saturate(.66) contrast(.80) blur(.24px)!important}}
@media screen and (max-width:768px){body::after{background-position:right 10px bottom 10px,center center!important;background-size:24px 24px,cover!important;opacity:.24!important}.panel_m.panel>.ngix-image-backdrop{background-size:100% 100%,cover!important;opacity:.30!important}}

/* NGIX patch: viewport/navbar correction */
html{width:100%!important;min-width:100%!important;max-width:none!important;min-height:100%!important;margin:0!important;padding:0!important;overflow-x:hidden!important;background:var(--bg,#f8fafc)!important;zoom:1!important}
body{width:100%!important;min-width:100vw!important;max-width:none!important;min-height:100vh!important;min-height:100svh!important;min-height:100dvh!important;margin:0!important;overflow-x:hidden!important;background-color:var(--bg,#f8fafc)!important;background-attachment:fixed!important}
body::after{top:0!important;right:0!important;bottom:0!important;left:0!important;inset:0!important;width:100vw!important;min-width:100vw!important;max-width:none!important;height:100vh!important;height:100svh!important;height:100dvh!important;background-size:28px 28px,cover!important;background-position:right 14px bottom 12px,center center!important}
.navbar.navbar-fixed-top,.navbar-fixed-top{position:fixed!important;top:0!important;right:0!important;left:0!important;width:100vw!important;max-width:none!important;margin:0!important;border-radius:0!important;transform:none!important;z-index:1055!important}
body>.navbar.navbar-fixed-top{position:fixed!important;z-index:1055!important}.navbar.navbar-default.navbar-fixed-top{top:0!important}
.panel_m.panel{overflow:visible!important;isolation:auto!important}.panel_m.panel>.ngix-image-backdrop,.ngix-image-backdrop{position:fixed!important;top:0!important;right:0!important;bottom:0!important;left:0!important;width:100vw!important;min-width:100vw!important;max-width:none!important;height:100vh!important;height:100svh!important;height:100dvh!important;z-index:0!important;background-size:100% 100%,cover!important;background-position:center center,center center!important;pointer-events:none!important}.panel_m.panel>.panel-heading,.panel_m.panel>.panel-body,.panel_m.panel>.table-responsive{position:relative!important;z-index:2!important}
@supports (height:100lvh){body{min-height:100lvh!important}body::after,.panel_m.panel>.ngix-image-backdrop,.ngix-image-backdrop{height:100lvh!important;min-height:100lvh!important}}
@media screen and (max-width:768px){html{zoom:1!important}.navbar.navbar-fixed-top,.navbar-fixed-top{top:0!important;width:100vw!important}.panel_m.panel>.ngix-image-backdrop,.ngix-image-backdrop{width:100vw!important;height:100svh!important;height:100dvh!important;min-height:100svh!important;background-size:100% 100%,cover!important}}
</style>
<style nonce="<?= pcH($rtNonce) ?>">
/* NGIX patch: statistics modal/logout/spinner correction */
@keyframes ngixStatSpin{to{transform:rotate(360deg)}}
.modal{z-index:1090!important;padding:0!important;text-align:center!important}
.modal:before{content:"";display:inline-block;height:100%;vertical-align:middle}
.modal-dialog{display:inline-block!important;width:min(560px,calc(100vw - 24px))!important;max-width:calc(100vw - 24px)!important;margin:0 auto!important;text-align:left!important;vertical-align:middle!important;transform:none!important}
.modal.in .modal-dialog,.modal.show .modal-dialog{transform:none!important}
.modal-content{max-height:calc(100vh - 24px)!important;max-height:calc(100dvh - 24px)!important;display:flex!important;flex-direction:column!important;overflow:hidden!important}
.modal-header,.modal-footer{flex:0 0 auto!important}.modal-body{flex:1 1 auto!important;overflow:auto!important;-webkit-overflow-scrolling:touch!important}.modal-backdrop{z-index:1080!important}
.swal-overlay,.swal2-container{z-index:11000!important;display:flex!important;align-items:center!important;justify-content:center!important;padding:12px!important;overflow:auto!important}.swal-modal,.swal2-modal,.swal2-popup{position:relative!important;top:auto!important;right:auto!important;bottom:auto!important;left:auto!important;width:min(360px,calc(100vw - 24px))!important;max-width:calc(100vw - 24px)!important;max-height:calc(100vh - 24px)!important;max-height:calc(100dvh - 24px)!important;margin:0!important;transform:none!important;overflow:auto!important}.swal2-actions,.swal2-buttonswrapper{display:flex!important;align-items:center!important;justify-content:center!important;gap:8px!important;min-height:32px!important}.swal2-loader{display:inline-block!important;width:22px!important;height:22px!important;min-width:22px!important;min-height:22px!important;margin:0 8px!important;border:3px solid currentColor!important;border-right-color:transparent!important;border-bottom-color:transparent!important;border-radius:50%!important;animation:ngixStatSpin .72s linear infinite!important;box-shadow:none!important}.swal2-loading .swal2-confirm{display:none!important}
#logout-form,.logout-form{display:flex!important;align-items:center!important;justify-content:center!important;margin:0!important}.navbar-nav>li>#logout-form,.navbar-nav>li>.logout-form{height:44px!important}.navbar-btn.btn-link,#btn-logout,.logout-btn{display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:7px!important;height:44px!important;min-height:44px!important;margin:0!important;padding:12px 10px!important;border:0!important;border-radius:0!important;background:transparent!important;color:var(--text,#444746)!important;text-decoration:none!important;box-shadow:none!important;line-height:20px!important;white-space:nowrap!important}.navbar-btn.btn-link:hover,#btn-logout:hover,.logout-btn:hover{background:var(--panel-soft,rgba(68,71,70,.06))!important;color:var(--text-strong,#1f2221)!important}.navbar-btn.btn-link:disabled,#btn-logout:disabled,.logout-btn:disabled{opacity:.76!important;cursor:wait!important}.btn.is-loading,.navbar-btn.is-loading,#btn-logout.is-loading,.logout-btn.is-loading{cursor:wait!important;pointer-events:none!important}.btn.is-loading:before,.navbar-btn.is-loading:before,#btn-logout.is-loading:before,.logout-btn.is-loading:before{content:""!important;display:inline-block!important;width:12px!important;height:12px!important;min-width:12px!important;margin-right:2px!important;border:2px solid currentColor!important;border-right-color:transparent!important;border-bottom-color:transparent!important;border-radius:50%!important;animation:ngixStatSpin .72s linear infinite!important}.pn-refresh-btn.is-loading img,#refresh.is-loading img{display:none!important}#logout-toast{position:fixed!important;right:12px!important;bottom:12px!important;z-index:11020!important;display:block!important;width:min(320px,calc(100vw - 24px))!important;padding:9px 11px!important;border:1px solid var(--line,rgba(68,71,70,.18))!important;border-left:3px solid var(--accent,#444746)!important;border-radius:var(--radius,.3rem)!important;background:var(--panel2,#fff)!important;color:var(--text,#444746)!important;box-shadow:0 8px 28px rgba(31,34,33,.14)!important;font:12px/1.35 var(--mono,Consolas,Monaco,'Courier New',monospace)!important;opacity:0!important;transform:translateY(8px)!important;pointer-events:none!important;transition:opacity .16s ease,transform .16s ease!important}#logout-toast.show{opacity:1!important;transform:translateY(0)!important;pointer-events:auto!important}
@media screen and (max-width:768px){.modal:before{display:none!important}.modal-dialog{display:block!important;width:auto!important;max-width:none!important;margin:10px!important;vertical-align:top!important}.modal-content{max-height:calc(100vh - 20px)!important;max-height:calc(100dvh - 20px)!important}.navbar-collapse #logout-form,.navbar-collapse .logout-form{justify-content:flex-start!important}.navbar-collapse #btn-logout,.navbar-collapse .logout-btn{width:100%!important;justify-content:flex-start!important;border-radius:var(--radius,.3rem)!important}#logout-toast{right:8px!important;left:8px!important;bottom:8px!important;width:auto!important}}
</style>
<script nonce="<?= pcH($rtNonce) ?>">
/* NGIX patch: statistics logout and loading state */
(function(){
    'use strict';

    function closest(node, selector) {
        return node && typeof node.closest === 'function' ? node.closest(selector) : null;
    }

    function ensureLogoutToast() {
        var toast = document.getElementById('logout-toast');

        if (!toast) {
            toast = document.createElement('div');
            toast.setAttribute('nonce', '<?= pcH($rtNonce) ?>');
            toast.id = 'logout-toast';
            toast.textContent = 'Logging out…';
            document.body.appendChild(toast);
        }

        toast.setAttribute('role', 'status');
        toast.setAttribute('aria-live', 'polite');
        return toast;
    }

    function setLoading(button) {
        if (!button) {
            return;
        }

        if (!button.dataset.ngixOriginalLabel) {
            button.dataset.ngixOriginalLabel = button.innerHTML;
        }

        button.classList.add('is-loading');
        button.setAttribute('aria-busy', 'true');
        button.disabled = true;
    }

    document.addEventListener('submit', function(event) {
        var form = closest(event.target, '#logout-form,.logout-form');

        if (!form) {
            return;
        }

        event.preventDefault();
        event.stopPropagation();

        if (typeof event.stopImmediatePropagation === 'function') {
            event.stopImmediatePropagation();
        }

        if (form.dataset.ngixSubmitting === '1') {
            return;
        }

        form.dataset.ngixSubmitting = '1';

        var button = form.querySelector('#btn-logout,.logout-btn,button[type="submit"],input[type="submit"]');
        setLoading(button);

        var toast = ensureLogoutToast();
        toast.classList.add('show');

        window.setTimeout(function() {
            HTMLFormElement.prototype.submit.call(form);
        }, 600);
    }, true);

    document.addEventListener('click', function(event) {
        var button = closest(event.target, '.pn-refresh-btn,#refresh,[data-spinner]');

        if (!button || button.classList.contains('is-loading')) {
            return;
        }

        button.classList.add('is-loading');
        button.setAttribute('aria-busy', 'true');
    }, true);
}());
</script>
<style nonce="<?= pcH($rtNonce) ?>">
/* NGIX patch: statistics bg/backdrop deglitch */
html{width:100%!important;min-width:0!important;max-width:100%!important;min-height:100%!important;margin:0!important;padding:0!important;overflow-x:hidden!important;background:#f8fafd!important;zoom:1!important}
body{position:relative!important;width:100%!important;min-width:0!important;max-width:100%!important;min-height:100vh!important;min-height:100svh!important;min-height:100dvh!important;margin:0!important;overflow-x:hidden!important;background:linear-gradient(rgba(255,255,255,.74),rgba(255,255,255,.88)),url('/assets/favicon.svg') right 14px bottom 12px/28px 28px no-repeat fixed,url('/assets/bg.png') center center/cover no-repeat fixed,#f8fafd!important;color:var(--text,#444746)!important}
body::after{content:none!important;display:none!important;background:none!important}
body::before{z-index:1!important}
body>.container,.container{position:relative!important;z-index:2!important;max-width:1180px!important;overflow:visible!important}
.navbar.navbar-fixed-top,.navbar-fixed-top{position:fixed!important;top:0!important;right:0!important;left:0!important;width:100%!important;max-width:100%!important;margin:0!important;border-radius:0!important;transform:none!important;z-index:1055!important}
.panel_m.panel{position:relative!important;overflow:hidden!important;isolation:isolate!important;background:rgba(255,255,255,.62)!important}
.panel_m.panel>.ngix-image-backdrop,.ngix-image-backdrop{position:absolute!important;inset:0!important;top:0!important;right:0!important;bottom:0!important;left:0!important;width:100%!important;min-width:0!important;max-width:100%!important;height:100%!important;min-height:100%!important;max-height:none!important;z-index:0!important;pointer-events:none!important;background-image:linear-gradient(rgba(255,255,255,.86),rgba(255,255,255,.86)),url('<?= statH(statAssetUrl('/dist/ngix-backdrop.png')) ?>')!important;background-repeat:no-repeat,no-repeat!important;background-position:center center,center center!important;background-size:100% 100%,min(980px,120%) auto!important;opacity:.22!important;filter:saturate(.62) contrast(.84) blur(.12px)!important;transform:none!important;contain:paint!important}
.panel_m.panel>.panel-heading,.panel_m.panel>.panel-body,.panel_m.panel>.table-responsive,.panel_m.panel>form{position:relative!important;z-index:2!important}
.table-responsive{max-width:100%!important;overflow-x:auto!important;overflow-y:visible!important}
@supports (height:100lvh){body{min-height:100lvh!important}}
@media (prefers-color-scheme:dark){html{background:#212529!important}body{background:linear-gradient(rgba(33,37,41,.78),rgba(33,37,41,.88)),url('/assets/favicon.svg') right 14px bottom 12px/28px 28px no-repeat fixed,url('/assets/bg.png') center center/cover no-repeat fixed,#212529!important}.panel_m.panel{background:rgba(33,37,41,.72)!important}.panel_m.panel>.ngix-image-backdrop,.ngix-image-backdrop{background-image:linear-gradient(rgba(33,37,41,.84),rgba(33,37,41,.84)),url('<?= statH(statAssetUrl('/dist/ngix-backdrop.png')) ?>')!important;opacity:.20!important;filter:saturate(.58) contrast(.78) blur(.16px)!important}}
@media screen and (max-width:768px){body{background-position:0 0,right 10px bottom 10px,center center!important;background-size:auto,24px 24px,cover!important}.navbar.navbar-fixed-top,.navbar-fixed-top{width:100%!important}.panel_m.panel>.ngix-image-backdrop,.ngix-image-backdrop{background-size:100% 100%,min(760px,140%) auto!important;background-position:center center,center center!important;opacity:.18!important}}
/* NGIX patch: enable right-click + remove dropdown blue highlight */
html,
body {
    -webkit-touch-callout: default !important;
    -webkit-tap-highlight-color: transparent !important;
}

button,
.btn,
a,
.navbar-nav > li > a,
.dropdown-toggle,
.dropdown-menu > li > a,
.rt-period-toggle,
.rt-period-menu > li > a,
.pc-nav-toggle,
.pc-nav-menu > li > a {
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

.dropdown-menu,
.dropdown-menu *,
.rt-period-menu,
.rt-period-menu *,
.pc-nav-menu,
.pc-nav-menu * {
    -webkit-user-select: none !important;
    user-select: none !important;
}

input,
textarea,
select,
code,
pre,
table,
.table,
.td-url,
.td-tracker,
.td-subdomain,
.td-pass,
.pc-country {
    -webkit-user-select: text !important;
    user-select: text !important;
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus,
.dropdown-menu > li > a:active,
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus,
.rt-period-menu > li > a:hover,
.rt-period-menu > li > a:focus,
.rt-period-menu > li > a:active,
.pc-nav-menu > li > a:hover,
.pc-nav-menu > li > a:focus,
.pc-nav-menu > li > a:active {
    background: var(--panel-soft) !important;
    color: var(--text-strong) !important;
    outline: none !important;
    box-shadow: none !important;
}

.btn:focus,
.btn:active,
button:focus,
button:active,
a:focus,
a:active,
.dropdown-toggle:focus,
.dropdown-toggle:active {
    outline: none !important;
    box-shadow: none !important;
}

::selection {
    background: rgba(68, 71, 70, .14);
    color: inherit;
}

::-moz-selection {
    background: rgba(68, 71, 70, .14);
    color: inherit;
}
</style>
<script nonce="<?= pcH($rtNonce) ?>">
/* NGIX patch: enable native right-click even when a global blocker exists */
(function () {
    'use strict';

    function clearInlineContextBlockers(root) {
        if (!root || !root.querySelectorAll) {
            return;
        }

        var nodes = [];

        if (root.documentElement) {
            nodes.push(root.documentElement);
        }

        if (root.body) {
            nodes.push(root.body);
        }

        Array.prototype.forEach.call(
            root.querySelectorAll('[oncontextmenu], [onselectstart]'),
            function (node) {
                nodes.push(node);
            }
        );

        nodes.forEach(function (node) {
            node.oncontextmenu = null;
            node.onselectstart = null;
            node.removeAttribute('oncontextmenu');
            node.removeAttribute('onselectstart');
        });
    }

    function allowContextMenu(event) {
        event.stopImmediatePropagation();
    }

    window.oncontextmenu = null;
    document.oncontextmenu = null;

    window.addEventListener('contextmenu', allowContextMenu, true);
    document.addEventListener('contextmenu', allowContextMenu, true);

    clearInlineContextBlockers(document);

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', function () {
            clearInlineContextBlockers(document);
        }, {once: true});
    } else {
        clearInlineContextBlockers(document);
    }
}());
</script>
</body></html>
