:root {
    --bg: #0b1020;
    --text: #e9eefc;
    --muted: #aeb9da;
    --grid: rgba(233, 238, 252, .12);
    --grid2: rgba(233, 238, 252, .18);
    --accent: #7aa2ff;
    --good: #55d6a8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
    background:
        radial-gradient(1200px 700px at 10% 0%, rgba(122, 162, 255, .18), transparent 60%),
        radial-gradient(900px 600px at 80% 20%, rgba(85, 214, 168, .12), transparent 60%),
        var(--bg);
    color: var(--text);
    line-height: 1.35;
}

.wrap {
    max-width: 1200px;
    margin: 28px auto 40px;
    padding: 0 18px;
}

header {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

h1 {
    font-size: 20px;
    margin: 0;
    letter-spacing: .2px;
}

.sub {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.legend {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    font-size: 12px;
    color: var(--muted);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--grid);
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(16, 26, 51, .55);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(122, 162, 255, .18);
}

.switchBar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

.switch {
    display: inline-flex;
    border: 1px solid var(--grid);
    border-radius: 999px;
    overflow: hidden;
    background: rgba(16, 26, 51, .55);
    margin: 10px 0;
}

.switch button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 8px 12px;
    font-weight: 700;
    letter-spacing: .8px;
    cursor: pointer;
    font-size: 18px;
}

.switch button.active {
    color: var(--text);
    background: rgba(122, 162, 255, .18);
    box-shadow: inset 0 0 0 1px rgba(122, 162, 255, .35);
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.tier {
    border: 1px solid var(--grid);
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(16, 26, 51, .85), rgba(14, 23, 48, .75));
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

.tierTop {
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--grid);
}

.tierHeaderRow {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
}

.headerBox {
    border: 1px solid var(--grid);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(16, 26, 51, .6);
    min-width: 220px;
}

.headerBox.tierId {
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.headerBox .label {
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 6px;
}

.headerBox .value {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .2px;
}

.headerBox .value strong {
    color: var(--good);
    font-weight: 900;
}

.headerBox .mini {
    margin-top: 6px;
    font-size: 11px;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    letter-spacing: .3px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(122, 162, 255, .18);
    border: 1px solid rgba(122, 162, 255, .35);
    width: fit-content;
}

.unit {
    color: var(--muted);
    font-size: 12px;
}

@media (min-width: 980px) {
    .tierHeaderRow {
        flex-wrap: nowrap;
    }

    .headerBox {
        min-width: 0;
    }

    .headerBox.tierId {
        width: 180px;
        flex: 0 0 180px;
    }

    .headerBox.kpiWide {
        flex: 1 1 0;
    }

    .headerBox.kpiNarrow {
        flex: 0 0 220px;
    }
}

@media (max-width: 979px) {
    .headerBox {
        flex: 1 1 260px;
        min-width: 0;
    }

    .headerBox.tierId {
        flex: 1 1 160px;
    }
}

@media (max-width: 720px) {
    .headerBox {
        width: 100%;
    }
}

.tierBody {
    padding: 12px 14px 14px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--grid);
    background: rgba(11, 16, 32, .25);
}

thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(16, 26, 51, .92);
    border-bottom: 1px solid var(--grid2);
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .8px;
    padding: 10px 10px;
    white-space: nowrap;
}

tbody td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--grid);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, .03);
}

.left {
    text-align: left;
    white-space: normal;
    min-width: 240px;
}

.num {
    text-align: right;
}

.noteRow {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12px;
}

.note {
    border: 1px dashed var(--grid);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(16, 26, 51, .35);
    flex: 1 1 320px;
}

.note strong {
    color: var(--text);
}

.error {
    border: 1px solid rgba(255, 120, 120, .35);
    background: rgba(255, 120, 120, .08);
    color: var(--text);
    padding: 12px 14px;
    border-radius: 12px;
}

code.inline {
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--grid);
    padding: 2px 6px;
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    color: var(--text);
}

.mobileOnly {
    display: none;
}

.desktopOnly {
    display: block;
}

@media (max-width: 640px) {
    .desktopOnly {
        display: none;
    }

    .mobileOnly {
        display: block;
    }

    .tierBody {
        padding: 12px 12px 14px;
    }

    .mobileLevels thead th {
        font-size: 11px;
        padding: 10px 8px;
        white-space: normal;
        line-height: 1.2;
    }

    .mobileLevels tbody td {
        padding: 9px 8px;
    }

    .mobileLevels .lvlCol {
        width: 64px;
        text-align: center;
        font-weight: 900;
    }

    .mobileLevels .valCol {
        text-align: right;
    }
}

.summaryHeaderRow {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
}

.summaryHeaderRow .headerBox {
    flex: 1 1 280px;
    min-width: 0;
}

.summaryTotalRow td {
    font-weight: 800;
    background: rgba(122, 162, 255, .12);
}

.summaryTotalRow td strong {
    color: var(--good);
}

.mutedCell {
    color: var(--muted);
}