:root {
    --bg: #080b10;
    --sidebar: #0b0f15;
    --panel: #10151d;
    --panel-hover: #141b24;
    --border: #202936;
    --border-soft: #1a222d;
    --text: #e7edf5;
    --muted: #7f8b9b;
    --green: #25d366;
    --cyan: #25c7e8;
    --blue: #4d8dff;
    --red: #ff5964;
    --yellow: #f5c451;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    font-size: 14px;
}

.app {
    display: flex;
    min-height: 100vh;
}


/* SIDEBAR */

.sidebar {
    width: 245px;
    min-width: 245px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.brand {
    height: 82px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px;
    border-bottom: 1px solid var(--border);
}

.brand-mark {
    width: 38px;
    height: 38px;
    border: 1px solid #2b3949;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cyan);
    font-size: 20px;
    font-weight: 800;
}

.brand-name {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.brand-sub {
    color: var(--muted);
    font-size: 8px;
    letter-spacing: 1.1px;
    margin-top: 3px;
}

nav {
    padding: 22px 12px;
}

.nav-section {
    color: #566273;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
    padding: 16px 12px 8px;
}

.nav-section:first-child {
    padding-top: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 42px;
    padding: 0 12px;
    margin: 3px 0;
    color: #8995a5;
    text-decoration: none;
    border-radius: 7px;
    transition: .15s;
}

.nav-item span {
    width: 18px;
    text-align: center;
    color: #647183;
}

.nav-item:hover {
    background: var(--panel-hover);
    color: var(--text);
}

.nav-item.active {
    background: #151e29;
    color: var(--text);
    border-left: 2px solid var(--cyan);
}

.nav-item.active span {
    color: var(--cyan);
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-footer strong {
    display: block;
    font-size: 12px;
}

.sidebar-footer small {
    color: var(--muted);
    font-size: 10px;
}


/* MAIN */

.main {
    flex: 1;
    min-width: 0;
}

.topbar {
    height: 82px;
    padding: 0 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0a0e14;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
}

.page-subtitle {
    color: var(--muted);
    font-size: 12px;
    margin-top: 5px;
}

.top-status {
    display: flex;
    align-items: center;
    gap: 18px;
}

.status-pill,
.panel-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #aab5c3;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .8px;
}

.status-dot,
.online-dot {
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 9px rgba(37, 211, 102, .55);
}

.clock {
    color: #8b97a8;
    font-family: monospace;
    font-size: 12px;
}


/* CONTENT */

.content {
    padding: 25px 30px 35px;
    max-width: 1800px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.metric-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 19px 20px;
    min-height: 125px;
}

.metric-card.anomaly-card {
    border-color: #28313d;
}

.metric-label {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.1px;
}

.metric-value {
    margin-top: 13px;
    font-size: 29px;
    font-weight: 700;
    letter-spacing: -.5px;
}

.metric-foot {
    color: #626e7e;
    font-size: 10px;
    margin-top: 9px;
}

.state-good {
    color: var(--green);
}

.state-warning {
    color: var(--yellow);
}

.state-danger {
    color: var(--red);
}


/* PANELS */

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 9px;
    overflow: hidden;
}

.traffic-panel {
    margin-top: 15px;
}

.anomaly-panel,
.health-panel {
    margin-top: 15px;
}

.panel-header {
    min-height: 68px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.1px;
}

.panel-subtitle {
    color: var(--muted);
    font-size: 10px;
    margin-top: 4px;
}


/* CHART */

.chart-wrap {
    height: 300px;
    padding: 20px;
    position: relative;
}

#trafficChart {
    width: 100%;
    height: 100%;
    display: block;
}


/* TABLES */

.lower-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.table {
    min-height: 280px;
    padding: 5px 20px 12px;
}

.table-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    min-height: 38px;
    border-bottom: 1px solid var(--border-soft);
    gap: 10px;
}

.table-row:last-child {
    border-bottom: 0;
}

.rank {
    color: #566273;
    font-family: monospace;
    font-size: 11px;
}

.domain,
.client {
    color: #c9d2dd;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.count {
    color: #7e8b9c;
    font-family: monospace;
    font-size: 11px;
}

.row-meta {
    color: #596575;
    font-size: 9px;
    margin-left: 8px;
}

.empty {
    color: var(--muted);
    padding: 35px 0;
    text-align: center;
    font-size: 12px;
}


/* ANOMALIES */

.anomaly-list {
    min-height: 70px;
}

.anomaly-row {
    display: grid;
    grid-template-columns: 82px 150px minmax(0, 1fr) 120px;
    gap: 15px;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-soft);
}

.anomaly-row:last-child {
    border-bottom: 0;
}

.severity {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .8px;
}

.severity-critical,
.severity-high {
    color: var(--red);
}

.severity-medium {
    color: var(--yellow);
}

.severity-low {
    color: var(--cyan);
}

.anomaly-type {
    color: #c9d2dd;
    font-size: 10px;
    font-weight: 700;
}

.anomaly-description {
    color: #7f8b9b;
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.anomaly-time {
    color: #596575;
    font-family: monospace;
    font-size: 9px;
    text-align: right;
}


/* HEALTH */

.health-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.health-item {
    padding: 19px 20px;
    border-right: 1px solid var(--border);
    min-height: 105px;
}

.health-item:last-child {
    border-right: 0;
}

.health-label {
    display: block;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 11px;
}

.health-item strong {
    display: block;
    font-size: 12px;
}

.health-item small {
    display: block;
    color: #626e7e;
    font-size: 9px;
    margin-top: 6px;
}

.health-good {
    color: var(--green);
}

.health-warning {
    color: var(--yellow);
}

.health-danger {
    color: var(--red);
}


/* ERROR */

.error-banner {
    margin-bottom: 15px;
    padding: 11px 15px;
    border: 1px solid rgba(255, 89, 100, .35);
    background: rgba(255, 89, 100, .07);
    color: #ff8a92;
    border-radius: 7px;
    font-size: 11px;
}

.hidden {
    display: none !important;
}


/* REFRESH */

.refresh-line {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #596575;
    font-size: 9px;
    padding: 13px 2px 0;
}

.refresh-line .online-dot {
    width: 5px;
    height: 5px;
}


/* RESPONSIVE */

@media (max-width: 1100px) {

    .cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .health-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .health-item:nth-child(2) {
        border-right: 0;
    }

    .health-item:nth-child(-n+2) {
        border-bottom: 1px solid var(--border);
    }

    .anomaly-row {
        grid-template-columns: 75px 130px minmax(0, 1fr);
    }

    .anomaly-time {
        display: none;
    }
}

@media (max-width: 800px) {

    .sidebar {
        width: 205px;
        min-width: 205px;
    }

    .content {
        padding: 20px;
    }

    .topbar {
        padding: 0 20px;
    }

    .lower-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {

    .sidebar {
        display: none;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .health-grid {
        grid-template-columns: 1fr;
    }

    .health-item {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .health-item:last-child {
        border-bottom: 0;
    }

    .top-status {
        gap: 8px;
    }

    .status-pill {
        display: none;
    }

    .topbar {
        height: 72px;
    }

    .page-title {
        font-size: 17px;
    }

    .anomaly-row {
        grid-template-columns: 70px 1fr;
    }

    .anomaly-description {
        grid-column: 1 / -1;
    }
}
