:root {
    font-family:
        system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    color: #222;
    background: #f4f6f8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

header {
    background: #1f2933;
    color: white;
    padding: 1.25rem 2rem;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 500;
}

main {
    padding: 2rem;
}

.report {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    padding: 16px 20px;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th {
    background: #eef1f4;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

th,
td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid #e1e5e8;
}

tbody tr:hover {
    background: #f7f9fa;
}

.number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ip {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    white-space: nowrap;
}

.empty {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.report-meta {
    padding: 1rem 1.25rem;
    color: #666;
    font-size: 0.9rem;
    border-bottom: 1px solid #e1e5e8;
}

.report table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}


.report col.col-ip { width: 14%; }
.report col.col-country { width: 6%; }
.report col.col-region { width: 12%; }
.report col.col-asn { width: 7%; }
.report col.col-isp { width: 14%; }
.report col.col-observations { width: 8%; }
.report col.col-state { width: 7%; }
.report col.col-blocked-by { width: 12%; }
.report col.col-date { width: 10%; }

.report th,
.report td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Allow long values to wrap where that improves readability. */
.report th:nth-child(1),
.report td:nth-child(1),
.report th:nth-child(9),
.report td:nth-child(9),
.report th:nth-child(10),
.report td:nth-child(10) {
    white-space: normal;
    overflow-wrap: anywhere;
}


th a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    color: inherit;
    text-decoration: none;
}

th a:hover {
    text-decoration: underline;
}

th a::after {
    content: "↕";
    opacity: 0.35;
    font-size: 0.8em;
}

th a[href*="dir=asc"]::after {
    content: "↑";
    opacity: 1;
}

th a[href*="dir=desc"]::after {
    content: "↓";
    opacity: 1;
}


.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid #e1e5e8;
    background: #f8fafb;
}

.pagination a {
    display: inline-block;
    padding: 0.45rem 0.8rem;
    border: 1px solid #cfd6dc;
    border-radius: 5px;
    color: #333;
    background: white;
    text-decoration: none;
}

.pagination a:hover {
    background: #eef1f4;
}

.pagination .disabled {
    display: inline-block;
    padding: 0.45rem 0.8rem;
    border: 1px solid #e1e5e8;
    border-radius: 5px;
    color: #aaa;
    background: #f4f6f8;
}

.pagination > div:nth-child(2) {
    color: #666;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.site-header {
    background: #1f2933;
    color: white;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0.25rem 1.5rem;
}

.brand {
    display: block;
}

.brand img {
    display: block;
    height: 50px;
    width: auto;
}

.site-title {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.product-name {
    font-size: 1.55rem;
    font-weight: 600;
}

.report-title {
    font-size: 1.15rem;
    opacity: 0.8;
}

.site-nav {
    background: #374151;
}

.nav-inner {
    display: flex;
    gap: 0;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.site-nav a {
    display: block;
    padding: 0.65rem 1rem;
    color: #fff;
    text-decoration: none;
}

.site-nav a:hover {
    background: #4b5563;
}

main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
}



/* Expandable attacker details */

.report .ip-detail-toggle {
    display: none;
}

.report .ip-detail-summary {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    gap: 0.35rem;
}

.report .ip-detail-triangle {
    display: inline-block;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid #333;
}

.report .ip-detail-toggle:checked + .ip-detail-summary
.ip-detail-triangle {
    transform: rotate(90deg);
}

.report .attacker-detail-row {
    display: none;
}

.report tr:has(.ip-detail-toggle:checked)
+ .attacker-detail-row {
    display: table-row;
}

.report .attacker-detail-row > td {
    padding: 1rem;
}

.report .ip-detail-content {
    width: 100%;
}

.report .attack-details {
    width: 100%;
    table-layout: fixed;
}


.report .attack-details th,
.report .attack-details td {
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Detail-table column widths */
.report .attack-details th:nth-child(1),
.report .attack-details td:nth-child(1) {
    width: 13%;
}

.report .attack-details th:nth-child(2),
.report .attack-details td:nth-child(2) {
    width: 10%;
}

.report .attack-details th:nth-child(3),
.report .attack-details td:nth-child(3) {
    width: 30%;
}

.report .attack-details th:nth-child(4),
.report .attack-details td:nth-child(4) {
    width: 6%;
}

.report .attack-details th:nth-child(5),
.report .attack-details td:nth-child(5) {
    width: 6%;
}

.report .attack-details th:nth-child(6),
.report .attack-details td:nth-child(6) {
    width: 23%;
}

.report .attack-details th:nth-child(7),
.report .attack-details td:nth-child(7) {
    width: 5%;
}

.report .attack-details th:nth-child(8),
.report .attack-details td:nth-child(8) {
    width: 7%;
}


/* Dynamic reporting menu */

.menu-section {
    position: relative;
}

.menu-section-title {
    display: block;
    padding: 0.65rem 1rem;
    color: #fff;
    cursor: default;
    white-space: nowrap;
}

.menu-items {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #374151;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.menu-section:hover .menu-items {
    display: block;
}

.menu-items a {
    display: block;
    white-space: nowrap;
}

.menu-section:hover .menu-section-title {
    background: #4b5563;
}



/* Dashboard statistic cards */

.cards {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.card {
    background: #fff;
    border: 1px solid #d9dee5;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    text-align: left;
}

.card .number {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.35rem;
    text-align: left;
}

.card .label {
    color: #64748b;
    font-size: 0.95rem;
    text-align: left;
}



.promotion-table {
    table-layout: fixed;
    width: 100%;
}

.promotion-table th:nth-child(1),
.promotion-table td:nth-child(1) {
    width: 5%;
}

.promotion-table th:nth-child(2),
.promotion-table td:nth-child(2) {
    width: 12%;
}

.promotion-table th:nth-child(3),
.promotion-table td:nth-child(3) {
    width: 12%;
}

.promotion-table th:nth-child(4),
.promotion-table td:nth-child(4) {
    width: 13%;
}

.promotion-table th:nth-child(5),
.promotion-table td:nth-child(5) {
    width: 13%;
}

.promotion-table th:nth-child(6),
.promotion-table td:nth-child(6) {
    width: 45%;
}

.promotion-evidence pre {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.character-icon {
    width: 31px !important;
    height: 29px !important;
    object-fit: contain;
    vertical-align: middle;
    margin-left: 6px;
}

.ip-detail-summary img.character-icon {
    display: inline-block;
    width: 31px !important;
    height: 29px !important;
    max-width: 31px !important;
    max-height: 29px !important;
    object-fit: contain;
    vertical-align: middle;
    margin-left: 6px;
    flex: 0 0 auto;
}


/* Attack Queue: prioritise diagnostic information */
.attack-queue-jobs {
    width: 100%;
    table-layout: fixed;
}


.attack-queue-jobs th,
.attack-queue-jobs td {
    overflow-wrap: anywhere;
    vertical-align: top;
}

.attack-queue-jobs .job-id,
.attack-queue-jobs .job-attempts,
.attack-queue-jobs .job-status {
    white-space: normal;
}

.attack-queue-jobs .job-time {
    font-size: 0.85em;
    overflow-wrap: anywhere;
}

.attack-queue-jobs .job-payload pre {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-width: 100%;
}



/* Attack Queue: diagnostic table column widths */
.report table.attack-queue-jobs {
    width: 100%;
    table-layout: fixed;
}

.report table.attack-queue-jobs col.col-id       { width: 3%; }
.report table.attack-queue-jobs col.col-job-type { width: 5%; }
.report table.attack-queue-jobs col.col-status   { width: 5%; }
.report table.attack-queue-jobs col.col-created  { width: 7%; }
.report table.attack-queue-jobs col.col-started  { width: 7%; }
.report table.attack-queue-jobs col.col-finished { width: 7%; }
.report table.attack-queue-jobs col.col-attempts { width: 6%; }
.report table.attack-queue-jobs col.col-key      { width: 14%; }
.report table.attack-queue-jobs col.col-error    { width: 20%; }
.report table.attack-queue-jobs col.col-payload  { width: 20%; }

.report table.attack-queue-jobs th,
.report table.attack-queue-jobs td {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: top;
}

.report table.attack-queue-jobs td.job-payload pre {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}



@media (max-width: 1000px) {
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

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



@media (max-width: 900px) {
    main {
        padding: 1rem;
    }

    .report {
        overflow-x: auto;
    }

    table {
        min-width: 1050px;
    }
}
