:root {
    color-scheme: dark;

    --background: #0d1117;
    --topbar: #10151c;
    --panel: #161b22;
    --panel-hover: #1b222c;
    --border: #30363d;

    --text: #e6edf3;
    --muted: #8b949e;
    --subtle: #6e7681;

    --green: #7ee787;
    --green-medium: #2ea043;
    --green-dark: #238636;
    --green-background: #12261a;

    --yellow: #d29922;
    --red: #f85149;
}

* {
    box-sizing: border-box;
}

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

body {
    min-height: 100vh;

    background-color: var(--background);

    background-image:
        linear-gradient(
            rgba(48, 54, 61, 0.08) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(48, 54, 61, 0.08) 1px,
            transparent 1px
        );

    background-size:
        32px 32px,
        32px 32px;

    color: var(--text);

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

.topbar {
    background:
        rgba(16, 21, 28, 0.97);

    border-bottom:
        1px solid var(--border);
}

.topbar-inner {
    display: grid;
    grid-template-columns:
        auto 1fr auto;
    align-items: center;

    width: min(1180px, 100%);
    min-height: 62px;
    margin: auto;
    padding: 0 22px;

    gap: 18px;
}

.brand {
    color: var(--text);

    font-size: 25px;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
    text-decoration: none;
}

.brand span {
    color: var(--green);
}

.brand:focus-visible {
    outline:
        2px solid var(--green);

    outline-offset: 5px;
}

.page-title {
    display: flex;
    align-items: baseline;

    gap: 10px;
}

.page-title strong {
    font-size: 15px;
}

.page-title span {
    color: var(--muted);
    font-size: 12px;
}

.connection-state {
    display: inline-flex;
    align-items: center;

    min-width: 112px;

    color: var(--muted);

    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.1em;

    gap: 7px;
}

.status-dot,
.health-dot {
    flex: 0 0 auto;

    width: 8px;
    height: 8px;

    background: var(--subtle);
    border-radius: 50%;
}

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

.connection-state.online .status-dot,
.health-dot {
    background: var(--green);

    box-shadow:
        0 0 10px rgba(126, 231, 135, 0.55);
}

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

.connection-state.offline .status-dot {
    background: var(--red);

    box-shadow:
        0 0 10px rgba(248, 81, 73, 0.45);
}

.dashboard {
    width: min(1180px, 100%);
    margin: auto;
    padding: 28px 22px 10px;
}

.dashboard-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    margin-bottom: 18px;

    gap: 20px;
}

.dashboard-heading h1 {
    margin: 0;

    font-size: 25px;
    letter-spacing: -0.025em;
}

.dashboard-heading p {
    margin: 5px 0 0;

    color: var(--muted);
    font-size: 13px;
}

.refresh-status {
    text-align: right;
}

.refresh-status span {
    display: block;

    color: var(--subtle);

    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.refresh-status strong {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.widget-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 12px;
}

.widget {
    min-width: 0;

    padding: 16px;

    background:
        rgba(22, 27, 34, 0.96);

    border:
        1px solid var(--border);

    border-radius: 5px;

    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.12);
}

.widget:hover {
    background: var(--panel-hover);
    border-color: #3b444f;
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 14px;

    gap: 10px;
}

.widget-header h2 {
    margin: 0;

    color: var(--text);

    font-size: 13px;
    font-weight: 700;
}

.widget-badge {
    color: var(--subtle);

    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.metric-value {
    color: var(--green);

    font-size: 37px;
    font-weight: 750;
    line-height: 1;
    letter-spacing: -0.04em;
}

.metric-value small {
    margin-left: 2px;

    color: var(--muted);

    font-size: 16px;
    font-weight: 650;
}

.progress-track {
    overflow: hidden;

    height: 5px;
    margin-top: 16px;

    background: #252c34;
    border-radius: 999px;
}

.progress-fill {
    width: 0;
    height: 100%;

    background:
        linear-gradient(
            90deg,
            var(--green-dark),
            var(--green)
        );

    border-radius: inherit;

    transition:
        width 300ms ease,
        background 300ms ease;
}

.progress-fill.warning {
    background: var(--yellow);
}

.progress-fill.critical {
    background: var(--red);
}

.metric-footer {
    overflow: hidden;

    margin-top: 9px;

    color: var(--muted);

    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.load-widget,
.processor-widget,
.system-widget {
    grid-column: span 2;
}

.health-widget {
    grid-column: span 2;
}

.load-values {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    margin-top: 2px;
}

.load-value {
    padding: 4px 15px;

    border-right:
        1px solid var(--border);
}

.load-value:first-child {
    padding-left: 0;
}

.load-value:last-child {
    padding-right: 0;
    border-right: none;
}

.load-value span {
    display: block;

    color: var(--green);

    font-family:
        Consolas,
        Monaco,
        monospace;

    font-size: 29px;
    font-weight: 700;
}

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

.load-normalized {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-top: 15px;
    padding-top: 12px;

    border-top:
        1px solid var(--border);

    color: var(--muted);
    font-size: 11px;
}

.load-normalized strong {
    color: var(--green);
    font-size: 13px;
}

.health-state {
    display: flex;
    align-items: center;

    min-height: 62px;
    padding: 12px 14px;

    background: var(--green-background);

    border:
        1px solid rgba(35, 134, 54, 0.65);

    border-radius: 4px;

    gap: 12px;
}

.health-dot {
    width: 11px;
    height: 11px;
}

.health-state div {
    min-width: 0;
}

.health-state strong {
    display: block;

    color: var(--green);

    font-size: 14px;
    letter-spacing: 0.05em;
}

.health-state span {
    display: block;

    margin-top: 2px;

    color: #9bc8a1;
    font-size: 11px;
}

.compact-list,
.detail-grid,
.system-list {
    margin: 13px 0 0;
}

.compact-list div,
.system-list div {
    display: grid;
    grid-template-columns:
        120px minmax(0, 1fr);

    padding: 7px 0;

    border-bottom:
        1px solid rgba(48, 54, 61, 0.72);

    gap: 14px;
}

.compact-list div:last-child,
.system-list div:last-child {
    border-bottom: none;
}

dt {
    color: var(--muted);
    font-size: 11px;
}

dd {
    min-width: 0;
    margin: 0;

    color: var(--text);

    font-size: 11px;
    font-weight: 600;

    overflow-wrap: anywhere;
}

.processor-model {
    min-height: 42px;

    color: var(--text);

    font-family:
        Consolas,
        Monaco,
        monospace;

    font-size: 14px;
    line-height: 1.45;
}

.detail-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 10px;
}

.detail-grid div {
    padding: 11px 12px;

    background: #11161d;

    border:
        1px solid rgba(48, 54, 61, 0.75);

    border-radius: 4px;
}

.detail-grid dd {
    margin-top: 5px;

    color: var(--green);

    font-size: 20px;
}

.dashboard-message {
    min-height: 20px;
    margin-top: 13px;

    color: var(--red);

    font-size: 12px;
    text-align: center;
}

.site-footer {
    width: min(1180px, 100%);
    margin: 12px auto 0;
    padding: 11px 22px 24px;

    color: var(--subtle);

    font-size: 11px;
    text-align: center;
}

@media (max-width: 900px) {
    .widget-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .topbar-inner {
        grid-template-columns:
            auto 1fr;
        padding: 0 16px;
    }

    .page-title span {
        display: none;
    }

    .connection-state {
        grid-column: 1 / -1;

        min-width: 0;
        margin-top: -11px;
        padding-bottom: 10px;
    }

    .dashboard {
        padding:
            22px 14px 8px;
    }

    .dashboard-heading {
        align-items: flex-start;
        flex-direction: column;

        gap: 10px;
    }

    .refresh-status {
        text-align: left;
    }

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

    .load-widget,
    .health-widget,
    .processor-widget,
    .system-widget {
        grid-column: auto;
    }

    .metric-widget {
        min-height: 155px;
    }

    .load-value {
        padding:
            4px 10px;
    }

    .load-value span {
        font-size: 24px;
    }

    .compact-list div,
    .system-list div {
        grid-template-columns: 1fr;
        gap: 3px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .progress-fill {
        transition: none;
    }
}
