:root {
    --bg: #0b1220;
    --panel: #111827;
    --panel-2: #1f2937;
    --panel-3: #0f172a;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #374151;
    --accent: #60a5fa;
    --danger: #ef4444;
    --shadow: 0 10px 30px rgba(0,0,0,.28);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 22px;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0b1220, #111827 45%, #0f172a);
}

.login-wrap {
    width: 100%;
    max-width: 440px;
    padding: 24px;
}

.login-card {
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(17, 24, 39, 0.94);
    box-shadow: var(--shadow);
}

.login-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.sub {
    color: var(--muted);
    margin-bottom: 10px;
}

.version-line {
    color: #93c5fd;
    font-size: 13px;
}

.footer-note {
    margin-top: 18px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.error-box {
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid rgba(239, 68, 68, .35);
    border-radius: 10px;
    background: rgba(239, 68, 68, .12);
    color: #fecaca;
}

h1 {
    margin: 0;
    font-size: 30px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

input,
select,
button {
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel-3);
    color: var(--text);
}

input::placeholder {
    color: #94a3b8;
}

button {
    border: none;
    background: var(--accent);
    color: #08111f;
    font-weight: 700;
    cursor: pointer;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.brand .meta {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.logo {
    max-width: 180px;
    max-height: 62px;
    object-fit: contain;
}

.userbox {
    color: var(--muted);
    font-size: 14px;
}

.nav-btn,
.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
}

.nav-btn {
    border: 1px solid #2563eb;
    background: #1e3a8a;
    color: #dbeafe;
}

.nav-btn.secondary {
    border-color: #047857;
    background: #065f46;
}

.nav-btn.cleanup {
    border-color: #b45309;
    background: #92400e;
    color: #ffedd5;
}

.nav-btn.refresh {
    border-color: #0ea5e9;
    background: #0369a1;
    color: #e0f2fe;
}

.nav-btn.export {
    border-color: #7c3aed;
    background: #5b21b6;
    color: #ede9fe;
}

.secondary-btn {
    border: 1px solid #4b5563;
    background: #374151;
    color: var(--text);
}

.stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.card {
    min-width: 190px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.card .label {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
}

.card .value {
    font-size: 24px;
    font-weight: 700;
}

.latest-value {
    font-size: 15px !important;
    font-weight: 600 !important;
}

.stat-link-card {
    text-decoration: none;
    color: inherit;
    transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.stat-link-card:hover {
    transform: translateY(-2px);
    border-color: #60a5fa;
}

.stat-active {
    border-color: #93c5fd;
    box-shadow: 0 0 0 1px rgba(147,197,253,.35), var(--shadow);
}

.stat-critical.stat-active {
    border-color: #ef4444;
}

.stat-error.stat-active {
    border-color: #f87171;
}

.stat-warning.stat-active {
    border-color: #f59e0b;
}

.filter-wrap {
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    min-width: 300px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

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

th,
td {
    padding: 12px;
    border-bottom: 1px solid #243041;
    text-align: left;
    vertical-align: top;
}

th {
    position: sticky;
    top: 0;
    background: var(--panel-2);
    color: #dbeafe;
}

tr:hover td {
    background: rgba(255,255,255,.02);
}

.badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.sev-critical { background: #7f1d1d; color: #fff; }
.sev-error    { background: #b91c1c; color: #fff; }
.sev-warning  { background: #f59e0b; color: #111; }
.sev-notice   { background: #2563eb; color: #fff; }
.sev-info     { background: #0f766e; color: #fff; }
.sev-debug    { background: #6b7280; color: #fff; }

.host-main {
    font-weight: 700;
}

.host-label {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.small {
    color: var(--muted);
    font-size: 12px;
}

.no-data {
    padding: 18px;
    color: var(--muted);
}

.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.pagination a,
.pagination span {
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text);
    text-decoration: none;
}

.pagination .active {
    border-color: #2563eb;
    background: #1d4ed8;
    color: #fff;
}

.footer-bar {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #243041;
    color: var(--muted);
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

mark {
    padding: 1px 4px;
    border-radius: 4px;
    color: #111;
}

.kw-failed   { background: #fecaca; }
.kw-error    { background: #fecaca; }
.kw-critical { background: #fca5a5; }
.kw-warning  { background: #fde68a; }
.kw-denied   { background: #fdba74; }
.kw-attack   { background: #fda4af; }
.kw-login    { background: #bfdbfe; }

@media (max-width: 900px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .top-actions {
        width: 100%;
        justify-content: space-between;
    }

    .footer-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-input {
        min-width: 100%;
    }
}