:root {
    --bg: #f3f5f8;
    --panel: #fff;
    --panel-2: #f7f9fb;
    --ink: #16202a;
    --ink-2: #5b6773;
    --ink-3: #8a96a3;
    --line: #dde3ea;
    --line-2: #e9edf1;
    --sb: #16202a;
    --sb-ink: #b4bfcb;
    --sb-on: #fff;
    --hd: #fff;
    --accent: #1f8f6a;
    --accent-ink: #fff;
    --up: #12805a;
    --up-bg: #e1f4ea;
    --down: #b42323;
    --down-bg: #fbe6e6;
    --warn: #8a5b00;
    --warn-bg: #fff2d4;
    --c1: #1D9E75;
    --c2: #7F77DD;
    --c3: #D85A30;
    --c4: #378ADD;
    --c5: #EF9F27;
    --grid: #e6ebf0;
    --sans: "IBM Plex Sans",system-ui,sans-serif;
    --mono: "IBM Plex Mono",ui-monospace,monospace;
    color-scheme: light
}

[data-theme="dark"] {
    --bg: #0f1419;
    --panel: #171d24;
    --panel-2: #1d242c;
    --ink: #e6ebf0;
    --ink-2: #a3aeb9;
    --ink-3: #6f7b87;
    --line: #2a333d;
    --line-2: #222a33;
    --sb: #0b0f13;
    --sb-ink: #8d9aa7;
    --sb-on: #fff;
    --hd: #121820;
    --accent: #34b384;
    --accent-ink: #06130e;
    --up: #4ad395;
    --up-bg: #103426;
    --down: #f07b7b;
    --down-bg: #3b1717;
    --warn: #f2c14e;
    --warn-bg: #3a2c0b;
    --c1: #5DCAA5;
    --c2: #AFA9EC;
    --c3: #F0997B;
    --c4: #85B7EB;
    --c5: #FAC775;
    --grid: #242d37;
    color-scheme: dark
}

* {
    box-sizing: border-box
}

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

body {
    font: 14px/1.5 var(--sans);
    color: var(--ink);
    background: var(--bg);
    display: flex;
    min-height: 100vh
}

a {
    color: inherit
}

h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap
}

h2 {
    font-size: 14px;
    font-weight: 500;
    margin: 0
}

.muted {
    color: var(--ink-3)
}

.up {
    color: var(--up)
}

.down {
    color: var(--down)
}

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

.sb {
    width: 220px;
    flex: none;
    background: var(--sb);
    color: var(--sb-ink);
    display: flex;
    flex-direction: column;
    padding: 18px 0 14px;
    position: sticky;
    top: 0;
    height: 100vh
}

.logo {
    color: var(--sb-on);
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 22px;
    text-decoration: none
}

    .logo i {
        width: 26px;
        height: 26px;
        border-radius: 7px;
        background: var(--accent);
        display: grid;
        place-items: center;
        color: var(--accent-ink);
        font-style: normal;
        font-size: 12px;
        font-weight: 600
    }

.grp {
    font-size: 11px;
    color: #6f7b87;
    padding: 12px 20px 4px
}

.sb a.nav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    text-decoration: none;
    border-left: 3px solid transparent
}

    .sb a.nav svg {
        width: 16px;
        height: 16px;
        stroke: currentColor;
        fill: none;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
        flex: none
    }

    .sb a.nav:hover {
        color: var(--sb-on);
        background: rgba(255,255,255,.04)
    }

    .sb a.nav.on {
        color: var(--sb-on);
        border-left-color: var(--accent);
        background: rgba(255,255,255,.06)
    }

.sb .foot {
    margin-top: auto;
    padding: 12px 20px 0;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: 12px
}

    .sb .foot b {
        display: block;
        color: var(--sb-on);
        font-weight: 500;
        font-size: 13px
    }

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

.hdr {
    height: 56px;
    background: var(--hd);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 5
}

    .hdr .live {
        color: var(--ink-2);
        font-size: 13px;
        display: flex;
        align-items: center;
        gap: 6px;
        white-space: nowrap
    }

        .hdr .live i {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--up);
            display: inline-block
        }

.right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px
}

.srch {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 240px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--panel);
    color: var(--ink-3);
    padding: 0 10px
}

    .srch input {
        border: 0;
        background: none;
        outline: 0;
        color: var(--ink);
        font: inherit;
        width: 100%;
        padding: 0
    }

.tg {
    width: 58px;
    height: 30px;
    border-radius: 15px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    position: relative;
    cursor: pointer;
    padding: 0
}

    .tg b {
        position: absolute;
        top: 3px;
        left: 4px;
        width: 22px;
        height: 22px;
        border-radius: 50%;
        background: var(--accent);
        transition: left .18s;
        display: grid;
        place-items: center;
        color: var(--accent-ink);
        font-size: 12px
    }

[data-theme="dark"] .tg b {
    left: 30px
}

.av {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-ink);
    display: grid;
    place-items: center;
    font-weight: 500;
    font-size: 12px;
    cursor: pointer;
    position: relative;
    user-select: none
}

.menu {
    position: absolute;
    right: 0;
    top: 40px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 190px;
    display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 10;
    font-weight: 400;
    text-align: left;
    color: var(--ink)
}

    .menu a, .menu button {
        display: block;
        width: 100%;
        padding: 9px 14px;
        text-decoration: none;
        font-size: 13px;
        background: none;
        border: 0;
        text-align: left;
        font: inherit;
        color: inherit;
        cursor: pointer
    }

        .menu a:hover, .menu button:hover {
            background: var(--panel-2)
        }

    .menu .who {
        padding: 10px 14px;
        border-bottom: 1px solid var(--line-2);
        color: var(--ink-2);
        font-size: 12px
    }

        .menu .who b {
            display: block;
            color: var(--ink);
            font-size: 13px
        }

.av.open .menu {
    display: block
}

.body {
    padding: 20px 24px 40px
}

main.bare {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 24px
}

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

    .ph p {
        margin: 0;
        color: var(--ink-2);
        max-width: 80ch
    }

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(160px,1fr));
    gap: 12px;
    margin-bottom: 14px
}

.tile {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px 16px
}

    .tile small {
        color: var(--ink-2);
        font-size: 12px
    }

    .tile b {
        display: block;
        font-size: 22px;
        font-family: var(--mono);
        font-weight: 500;
        margin-top: 2px;
        line-height: 1.2
    }

        .tile b span {
            font-size: 13px;
            color: var(--ink-3);
            font-weight: 400
        }

.row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
    margin-bottom: 12px
}

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 12px
}

    .card .ch {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 11px 16px;
        border-bottom: 1px solid var(--line-2)
    }

        .card .ch span {
            color: var(--ink-3);
            font-size: 12px
        }

    .card .cb {
        padding: 14px 16px
    }

.chart {
    position: relative;
    height: 200px
}

.card .tw {
    border: 0;
    border-radius: 0 0 8px 8px
}

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

th, td {
    padding: 9px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line-2);
    white-space: nowrap;
    vertical-align: middle
}

th {
    color: var(--ink-2);
    font-weight: 500;
    font-size: 13px;
    background: var(--panel-2)
}

tbody tr:last-child td {
    border-bottom: 0
}

tbody tr:hover {
    background: var(--panel-2)
}

td.num, th.num {
    text-align: right;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums
}

td.wrap {
    white-space: normal;
    max-width: 460px
}

td a {
    color: var(--accent);
    text-decoration: none
}

    td a:hover {
        text-decoration: underline
    }

.tw {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: auto;
    background: var(--panel)
}

tr.total td {
    background: var(--panel-2);
    font-weight: 600
}

.pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
    vertical-align: middle
}

    .pill.on {
        background: var(--up-bg);
        color: var(--up)
    }

    .pill.off {
        background: var(--down-bg);
        color: var(--down)
    }

    .pill.warn {
        background: var(--warn-bg);
        color: var(--warn)
    }

    .pill.none {
        background: var(--line-2);
        color: var(--ink-2)
    }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    padding: 7px 13px;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 6px;
    cursor: pointer;
    color: var(--ink);
    text-decoration: none;
    line-height: 1.2
}

    .btn:hover {
        border-color: var(--ink-3);
        background: var(--panel-2)
    }

    .btn.primary {
        background: var(--accent);
        color: var(--accent-ink);
        border-color: var(--accent)
    }

        .btn.primary:hover {
            filter: brightness(1.05)
        }

    .btn.danger {
        color: var(--down);
        border-color: color-mix(in srgb,var(--down) 40%,var(--line))
    }

        .btn.danger:hover {
            background: var(--down-bg)
        }

    .btn.sm {
        padding: 4px 9px;
        font-size: 12px
    }

form.inline {
    display: inline
}

input, select {
    font: inherit;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--ink);
    width: 100%
}

    input:focus, select:focus, .btn:focus-visible, button:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 1px
    }

    input.invalid, select.invalid {
        border-color: var(--down);
        background: color-mix(in srgb,var(--down-bg) 40%,var(--panel))
    }

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px
}

    .field label {
        font-size: 12px;
        color: var(--ink-2)
    }

    .field .hint {
        font-size: 12px;
        color: var(--ink-3)
    }

.field-error {
    font-size: 12px;
    color: var(--down)
}

.filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 14px 16px
}

    .filters .field {
        margin: 0;
        min-width: 120px
    }

.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end
}

    .form-row .field {
        margin: 0;
        min-width: 180px
    }

.kv {
    padding: 4px 16px
}

    .kv div {
        display: flex;
        justify-content: space-between;
        gap: 16px;
        padding: 8px 0;
        border-bottom: 1px solid var(--line-2)
    }

        .kv div:last-child {
            border-bottom: 0
        }

    .kv span:first-child {
        color: var(--ink-2)
    }

    .kv span:last-child {
        font-family: var(--mono);
        font-variant-numeric: tabular-nums;
        text-align: right
    }

.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 14px
}

    .flash.ok {
        background: var(--up-bg);
        color: var(--up)
    }

    .flash.err {
        background: var(--down-bg);
        color: var(--down)
    }

    .flash .mono {
        user-select: all
    }

.crumbs {
    font-size: 13px;
    color: var(--ink-3);
    margin-bottom: 6px
}

    .crumbs a {
        text-decoration: none
    }

        .crumbs a:hover {
            text-decoration: underline
        }

.empty {
    padding: 32px;
    text-align: center;
    color: var(--ink-2);
    background: var(--panel);
    border: 1px dashed var(--line);
    border-radius: 8px
}

.login {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 32px;
    width: 360px
}

    .login h1 {
        margin-bottom: 4px
    }

    .login .sub {
        color: var(--ink-2);
        margin: 0 0 22px
    }

    .login .btn {
        width: 100%;
        justify-content: center;
        margin-top: 6px
    }

    .login .theme-row {
        margin-top: 18px;
        display: flex;
        justify-content: center
    }

@media(max-width:900px) {
    body {
        flex-direction: column
    }

    .sb {
        width: auto;
        height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 8px;
        align-items: center
    }

        .sb .grp, .sb .foot {
            display: none
        }

        .sb a.nav {
            border-left: 0;
            padding: 6px 10px
        }

        .sb .logo {
            padding: 6px 10px
        }

    .row, .grid2 {
        grid-template-columns: 1fr
    }

    .srch {
        display: none
    }

    .body {
        padding: 14px
    }

    .ph {
        flex-direction: column
    }
}

@media(prefers-reduced-motion:no-preference) {
    .btn, input, select {
        transition: border-color .15s,background-color .15s
    }
}
