:root {
    --bg: #071318;
    --header: #061015;
    --panel: #0c1c24;
    --panel-2: #0e222c;
    --line: #1c3a48;
    --text: #e8f3f1;
    --muted: #7d96a6;
    --mint: #2ee8a0;
    --teal: #38a3a5;
    --blue: #1aa8ff;
    --warn: #e8b84a;
    --down: #ef5b5b;
    --ok: #2ee8a0;
    --sans: "Sora", "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;
    --r: 12px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { color-scheme: dark; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
}

body {
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.45;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    width: min(980px, calc(100% - 48px));
    margin: 0 auto;
}

main.wrap {
    flex: 1 0 auto;
    padding-top: 8px;
}

.skip {
    position: absolute;
    left: 12px;
    top: -48px;
    z-index: 40;
    background: var(--teal);
    color: #021516;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 6px;
}
.skip:focus { top: 12px; }

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

/* header */

.top {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--header) 88%, transparent);
    backdrop-filter: blur(14px);
    flex-shrink: 0;
}

.top-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 68px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.brand strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

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

.brand small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.04em;
}

.top-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--muted);
    font-size: 12px;
}

.live {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--mint);
    font-weight: 500;
}

.live i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 0 0 rgba(46, 232, 160, 0.5);
    animation: pulse 2.2s ease-out infinite;
}

#clock {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

.atlas {
    margin: 18px 0 0;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--muted);
    font-size: 13px;
}
.atlas[hidden] { display: none; }

/* banner */

.banner {
    margin: 24px 0 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-radius: var(--r);
    border: 1px solid color-mix(in srgb, var(--tone, var(--teal)) 38%, var(--line));
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--tone, var(--teal)) 16%, transparent), transparent 42%),
        var(--panel);
}

.banner[data-tone="listen"] { --tone: var(--teal); }
.banner[data-tone="ok"] { --tone: var(--ok); }
.banner[data-tone="warn"] { --tone: var(--warn); }
.banner[data-tone="down"] { --tone: var(--down); }

.banner-ico {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--tone, var(--teal));
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--tone, var(--teal)) 18%, transparent);
    position: relative;
}

.banner-ico::after {
    content: "";
    position: absolute;
    inset: 8px 7px 9px;
    border: 2px solid #021516;
    border-top: 0;
    border-right: 0;
    transform: rotate(-45deg);
}

.banner[data-tone="warn"] .banner-ico::after,
.banner[data-tone="listen"] .banner-ico::after {
    inset: 7px 12px 7px;
    border: 0;
    border-left: 2px solid #021516;
    border-radius: 1px;
    transform: none;
    background: #021516;
    width: 2px;
}

.banner[data-tone="down"] .banner-ico::after {
    inset: 8px;
    border: 0;
    background:
        linear-gradient(45deg, transparent 42%, #021516 42%, #021516 58%, transparent 58%),
        linear-gradient(-45deg, transparent 42%, #021516 42%, #021516 58%, transparent 58%);
    transform: none;
}

.banner h1 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.banner p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

/* metrics */

.metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 30px;
}

.metric {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px 16px 12px;
    min-height: 118px;
    display: flex;
    flex-direction: column;
}

.metric header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.metric header > span:first-child {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.metric header b {
    font-family: var(--mono);
    font-weight: 500;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}

.metric-read {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.metric-read small {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted);
    font-weight: 400;
}

.spark {
    width: 100%;
    height: 48px;
    display: block;
    margin-top: auto;
}

.spark-line {
    fill: none;
    stroke-width: 1.75;
    vector-effect: non-scaling-stroke;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#cpu-spark .spark-line { stroke: var(--blue); }
#ram-spark .spark-line { stroke: var(--teal); }
#net-spark .spark-line { stroke: var(--mint); }

/* components */

h2 {
    margin: 0 0 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.group {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: 12px;
    overflow: hidden;
}

.group-h {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    font-size: 13px;
    background: var(--panel-2);
}

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

.row {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) 72px 118px;
    gap: 12px 14px;
    align-items: center;
    padding: 13px 16px;
    border-top: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
    transition: background 0.12s ease;
}

.group .row:first-of-type { border-top: 0; }

.row:hover { background: color-mix(in srgb, var(--panel-2) 70%, var(--panel)); }

.row[data-tone="down"] {
    background: color-mix(in srgb, var(--down) 6%, var(--panel));
}

.row[data-tone="warn"] {
    background: color-mix(in srgb, var(--warn) 5%, var(--panel));
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3a5560;
    justify-self: center;
}

.dot.is-ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.dot.is-warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 18%, transparent); }
.dot.is-down { background: var(--down); box-shadow: 0 0 0 3px color-mix(in srgb, var(--down) 18%, transparent); }
.dot.is-off { background: #4a6570; }

.row-name { min-width: 0; }

.row-name strong {
    display: block;
    font-size: 14px;
    font-weight: 500;
}

.row-name span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ping {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.ping.is-slow { color: var(--warn); }

.state {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    text-align: right;
}

.state.is-ok { color: var(--ok); }
.state.is-warn { color: var(--warn); }
.state.is-down { color: var(--down); }

.empty {
    padding: 18px 16px;
    color: var(--muted);
    font-size: 14px;
}

#komponenty { margin-bottom: 40px; }

/* footer */

.foot {
    flex-shrink: 0;
    margin-top: auto;
    border-top: 1px solid var(--line);
    background: var(--header);
    padding: 18px 20px 22px;
}

.foot-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    color: #6b8a9a;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.foot-brand p { margin: 0; }
.foot-brand span { color: var(--teal); }

.foot-brand img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(46, 232, 160, 0.45); }
    70% { box-shadow: 0 0 0 7px rgba(46, 232, 160, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 232, 160, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .live i { animation: none; }
    .row { transition: none; }
}

@media (max-width: 800px) {
    .metrics { grid-template-columns: 1fr; }
    .metric { min-height: 0; }
    .row {
        grid-template-columns: 10px minmax(0, 1fr) auto;
    }
    .ping { display: none; }
}

@media (max-width: 520px) {
    .wrap, main.wrap { width: calc(100% - 28px); }
    .top-inner { min-height: 62px; }
    .banner { padding: 14px 16px; }
    .banner h1 { font-size: 1.15rem; }
    .top-meta { flex-direction: column; align-items: flex-end; gap: 4px; }
}
