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

html,
body {
    min-height: 100%;
}

body {
    font-family: Arial, sans-serif;
    color: #e5e7eb;
    display: flex;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(30, 64, 175, 0.10), transparent 24%),
        linear-gradient(180deg, #020617 0%, #06101d 52%, #030712 100%);
    overflow-x: hidden;
}

.sidebar {
    width: 260px;
    min-width: 260px;
    background: rgba(7, 16, 31, 0.92);
    border-right: 1px solid rgba(148, 163, 184, 0.10);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
}

.logo-main {
    width: 100%;
    max-width: 154px;
    height: auto;
    display: block;
    object-fit: contain;
    background: transparent;
    border: none;
    box-shadow: none;
    filter: none;
}

.sidebar-brand-text {
    text-align: center;
    line-height: 1.25;
}

.sidebar-brand-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: rgba(255,255,255,0.96);
}

.sidebar-brand-subtitle {
    margin-top: 4px;
    font-size: 11px;
    color: rgba(255,255,255,0.52);
    letter-spacing: 0.2px;
}

.sidebar ul {
    list-style: none;
    margin-top: 8px;
    padding: 0;
}

.sidebar li {
    padding: 12px 12px;
    margin-bottom: 10px;
    border-radius: 10px;
    cursor: pointer;
    color: #dbeafe;
    transition: all 0.18s ease;
    border: 1px solid transparent;
    font-size: 15px;
}

.sidebar li a,
.sidebar li a:visited {
    color: #dbeafe;
}

.sidebar li.active a,
.sidebar li:hover a {
    color: #ffffff;
}

.sidebar li.active,
.sidebar li:hover {
    background: rgba(30, 41, 59, 0.88);
    color: #ffffff;
    border-color: rgba(148, 163, 184, 0.12);
}

.main {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.grid {
    display: grid;
    grid-template-columns: 2.1fr 0.9fr;
    gap: 20px;
}

.card {
    background: rgba(8, 15, 29, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.08);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(2, 8, 23, 0.24);
    position: relative;
    overflow: hidden;
    transition: all 0.18s ease;
}

.card:hover {
    border-color: rgba(148, 163, 184, 0.14);
    box-shadow: 0 14px 30px rgba(2, 8, 23, 0.28);
    transform: translateY(-1px);
}

.card h3 {
    margin-bottom: 15px;
    font-size: 16px;
    color: #f8fafc;
    letter-spacing: 0.1px;
}

.gauge-wrapper {
    position: relative;
    height: 250px;
    filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.12));
}

.gauge-center {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gauge-center h1 {
    font-size: 44px;
    font-weight: 700;
    letter-spacing: 1px;
}

.gauge-center span {
    font-size: 14px;
    color: #94a3b8;
}

.issues {
    list-style: none;
    margin-top: 10px;
}

.issues li {
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: 10px;
    font-size: 14px;
    border: 1px solid transparent;
}

.critical {
    background: rgba(127, 29, 29, 0.28);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.10);
}

.high {
    background: rgba(124, 45, 18, 0.28);
    color: #fdba74;
    border-color: rgba(249, 115, 22, 0.10);
}

.medium {
    background: rgba(113, 63, 18, 0.24);
    color: #fde047;
    border-color: rgba(250, 204, 21, 0.08);
}

.low {
    background: rgba(20, 83, 45, 0.24);
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.08);
}

canvas {
    max-height: 260px;
}

.view {
    display: none;
}

#view-dashboard {
    display: block;
}

.risk-score {
    font-weight: 700;
    color: #facc15;
}

.status-running {
    color: #4ade80;
    font-weight: 600;
}

.status-cooldown {
    color: #fbbf24;
    font-weight: 600;
}

.status-idle {
    color: #cbd5e1;
    font-weight: 600;
}

.status-unknown {
    color: #94a3b8;
}

/* ================= ATTACK SOURCES TABLE ================= */

.attack-table-header,
.attack-source-row {
    display: grid;
    grid-template-columns: 40px 120px 160px 100px 160px 100px 100px 140px 140px;
    align-items: center;
    padding: 10px 12px;
    font-size: 13px;
}

.attack-table-header {
    color: #64748b;
    text-transform: uppercase;
    font-size: 11px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.10);
    letter-spacing: 0.5px;
}

.attack-source-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(2, 6, 23, 0.18);
    transition: background 0.18s ease, transform 0.18s ease;
}

.attack-source-row:hover {
    background: rgba(15, 23, 42, 0.72);
    transform: translateX(1px);
}

.attack-source-row span:nth-child(3) {
    color: #7dd3fc;
    font-weight: 600;
    text-shadow: none;
}

.attack-source-row button {
    background: rgba(15, 23, 42, 0.86);
    border: 1px solid rgba(148, 163, 184, 0.10);
    color: #cbd5e1;
    padding: 4px 8px;
    margin-right: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.attack-source-row button:hover {
    background: rgba(30, 41, 59, 0.96);
    color: #ffffff;
}

.risk-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.risk-critical {
    background: rgba(127, 29, 29, 0.30);
    color: #fca5a5;
}

.risk-high {
    background: rgba(124, 45, 18, 0.30);
    color: #fdba74;
}

.risk-medium {
    background: rgba(113, 63, 18, 0.28);
    color: #fde047;
}

.risk-low {
    background: rgba(20, 83, 45, 0.28);
    color: #86efac;
}

.risk-unknown {
    background: rgba(51, 65, 85, 0.40);
    color: #cbd5e1;
}

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

th,
td {
    padding: 12px 10px;
    text-align: left;
    font-size: 14px;
}

thead tr {
    border-bottom: 1px solid rgba(148, 163, 184, 0.10);
}

tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.18s ease;
}

tbody tr:hover {
    background: rgba(15, 23, 42, 0.44);
}

/* ================= DASHBOARD HARDENING PASS ================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.15fr) minmax(320px, 0.85fr);
    gap: 20px;
    align-items: stretch;
}

.card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.card-header h3 {
    margin-bottom: 0;
}

.card-kicker {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    font-weight: 700;
    white-space: nowrap;
}

.card-hero {
    min-height: 250px;
}

.card-issues {
    min-height: 250px;
}

.card-primary-source {
    min-height: 340px;
}

.card-attack-sources {
    min-height: 340px;
}

.card-trend {
    min-height: 340px;
}

.card-vuln {
    min-height: 220px;
}

.risk-hero-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 18px;
    align-items: stretch;
    min-height: 170px;
}

.gauge-wrapper {
    position: relative;
    min-height: 170px;
    height: 170px;
    border-radius: 18px;
    border: 1px solid rgba(56, 189, 248, 0.08);
    background:
        radial-gradient(circle at 50% 42%, rgba(15, 118, 110, 0.10), transparent 34%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.18), rgba(15, 23, 42, 0.04));
    filter: none;
}

.gauge-center {
    position: absolute;
    inset: 0;
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
}

.gauge-center h1 {
    font-size: 52px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #f8fafc;
    margin: 0;
}

.gauge-center span {
    display: block;
    font-size: 15px;
    color: #94a3b8;
    font-weight: 600;
}

#risk-delta {
    min-height: 18px;
}

.risk-side-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.risk-side-item {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: 14px;
    padding: 14px 14px;
}

.risk-side-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 6px;
}

.risk-side-value {
    display: block;
    font-size: 14px;
    color: #e2e8f0;
    font-weight: 600;
}


.issues {
    list-style: none;
    margin-top: 0;
}

.issues li {
    padding: 14px 16px;
    margin-bottom: 10px;
    border-radius: 12px;
    font-size: 14px;
    border: 1px solid transparent;
    font-weight: 600;
}

#attack-sources h3 {
    display: none;
}

.attack-table-header,
.attack-source-row {
    display: grid;
    grid-template-columns: 34px 1fr 1.15fr 0.9fr 1.45fr 0.72fr 0.88fr 1fr 76px;
}

.attack-table-header {
    padding: 0 10px 12px 10px;
    margin-bottom: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.attack-source-row {
    padding: 10px 10px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 13px;
    color: #cbd5e1;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.attack-source-row:hover {
    background: rgba(15, 23, 42, 0.58);
    border-color: rgba(148, 163, 184, 0.08);
    transform: translateY(-1px);
}

.attack-source-row .flag img {
    display: block;
    border-radius: 2px;
}

.attack-source-row span:nth-child(5) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.risk-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.risk-high {
    background: rgba(127, 29, 29, 0.36);
    color: #fca5a5;
}

.risk-medium {
    background: rgba(120, 53, 15, 0.32);
    color: #fdba74;
}

.risk-low {
    background: rgba(20, 83, 45, 0.30);
    color: #86efac;
}

.risk-unknown {
    background: rgba(30, 41, 59, 0.86);
    color: #cbd5e1;
}

.attack-source-row button {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.10);
    background: rgba(15, 23, 42, 0.7);
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.18s ease;
}

.attack-source-row button:hover {
    background: rgba(30, 41, 59, 0.92);
    border-color: rgba(148, 163, 184, 0.16);
}

.card canvas {
    width: 100% !important;
    height: 190px !important;
}

.card-trend canvas,
.card-vuln canvas {
    margin-top: 4px;
}

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

    .risk-hero-layout {
        grid-template-columns: 1fr;
    }

    .card-issues,
    .card-hero,
    .card-attack-sources,
    .card-trend,
    .card-vuln {
        min-height: auto;
    }
}

.full-width {
    grid-column: 1 / -1;
}

.demo-readonly-banner {
    margin: 0 0 18px 0;
    padding: 12px 16px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.86);
    color: #dbeafe;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 13px;
    line-height: 1.45;
}

.demo-readonly-banner strong {
    color: #93c5fd;
    font-weight: 800;
}

.demo-readonly-banner span {
    color: #cbd5e1;
}
