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

:root {
    color-scheme: dark;

    --bg: #08090c;
    --bg-sidebar: #0b0c10;
    --surface: #111318;
    --surface-2: #15181e;
    --surface-3: #1b1f27;
    --surface-4: #242934;
    --hover: rgba(255, 255, 255, 0.035);
    --hover-2: rgba(255, 255, 255, 0.06);

    --line: rgba(255, 255, 255, 0.065);
    --line-2: rgba(255, 255, 255, 0.095);
    --line-3: rgba(255, 255, 255, 0.14);

    --text: #eceef2;
    --text-2: #b3b8c4;
    --text-3: #808696;
    --text-4: #555b69;

    --accent: #8286f8;
    --accent-strong: #6366f1;
    --accent-soft: rgba(130, 134, 248, 0.13);
    --accent-line: rgba(130, 134, 248, 0.4);

    --good: #4ad596;
    --good-soft: rgba(74, 213, 150, 0.1);
    --good-line: rgba(74, 213, 150, 0.26);
    --warn: #f2b54b;
    --warn-soft: rgba(242, 181, 75, 0.1);
    --warn-line: rgba(242, 181, 75, 0.28);
    --bad: #f47a7a;
    --bad-soft: rgba(244, 122, 122, 0.1);
    --bad-line: rgba(244, 122, 122, 0.28);
    --info: #6fa8f2;
    --info-soft: rgba(111, 168, 242, 0.1);

    /* chart marks — validated against --surface for CVD separation and 3:1 contrast */
    --series-1: #3987e5;
    --series-2: #d95926;
    --st-good: #0ca30c;
    --st-warn: #fab219;
    --st-critical: #d03b3b;
    --grid: #1d2028;
    --axis: #2d313b;

    --r-sm: 6px;
    --r: 8px;
    --r-md: 10px;
    --r-lg: 12px;
    --r-xl: 16px;

    --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.3);
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

    --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;

    --sidebar-w: 232px;
    --rail-w: 64px;
    --topbar-h: 56px;
}

html,
body {
    height: 100%;
}

body {
    font-family: var(--sans);
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

::selection {
    background: rgba(130, 134, 248, 0.35);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--surface-4) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--surface-4);
    border: 3px solid transparent;
    border-radius: 10px;
    background-clip: padding-box;
}

::-webkit-scrollbar-track {
    background: transparent;
}

button,
input,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

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

.hidden {
    display: none !important;
}

.sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mono {
    font-family: var(--mono);
    font-size: 12px;
}

.num {
    font-variant-numeric: tabular-nums;
}

.nil {
    color: var(--text-4);
}

kbd {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 5px;
    font: 500 10.5px/1 var(--sans);
    color: var(--text-3);
    background: var(--surface-3);
    border: 1px solid var(--line-2);
    border-bottom-width: 2px;
}

/* ───────────── Buttons & inputs ───────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 32px;
    padding: 0 12px;
    border-radius: var(--r);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    color: var(--text-2);
    background: transparent;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.btn .i {
    width: 15px;
    height: 15px;
}

.btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.btn-ghost {
    background: var(--surface);
    border-color: var(--line-2);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--surface-3);
    border-color: var(--line-3);
    color: var(--text);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(180deg, #767af7, #5d61f0);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 0 1px rgba(99, 102, 241, 0.7), 0 4px 14px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #8185f8, #676bf2);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: 12.5px;
    gap: 6px;
}

.btn-sm .i {
    width: 14px;
    height: 14px;
}

.btn-lg {
    height: 40px;
    font-size: 14px;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-3);
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}

.icon-btn:hover:not(:disabled) {
    background: var(--hover-2);
    color: var(--text);
}

.icon-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.icon-btn-sm {
    width: 26px;
    height: 26px;
}

.icon-btn-sm .i {
    width: 14px;
    height: 14px;
}

.mini-btn {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-4);
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}

.mini-btn .i {
    width: 14px;
    height: 14px;
}

.mini-btn:hover {
    background: var(--hover-2);
    color: var(--text);
}

.search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 280px;
    max-width: 460px;
    min-width: 200px;
}

.search>.i {
    position: absolute;
    left: 11px;
    width: 15px;
    height: 15px;
    color: var(--text-4);
    pointer-events: none;
    transition: color 0.15s;
}

.search input {
    width: 100%;
    height: 34px;
    padding: 0 34px 0 34px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    font-size: 13px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.search input::placeholder {
    color: var(--text-4);
}

.search input:hover {
    border-color: var(--line-3);
}

.search input:focus {
    border-color: var(--accent-line);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search:focus-within>.i {
    color: var(--text-2);
}

.search input:not(:placeholder-shown) {
    background: var(--surface-2);
    border-color: var(--accent-line);
}

.search-kbd {
    position: absolute;
    right: 9px;
    pointer-events: none;
    transition: opacity 0.15s;
}

.search input:focus~.search-kbd,
.search input:not(:placeholder-shown)~.search-kbd {
    opacity: 0;
}

.search-user {
    flex: 0 0 132px;
    min-width: 0;
}

.search-user input {
    padding-right: 10px;
}

.select {
    height: 34px;
    padding: 0 32px 0 12px;
    appearance: none;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23808696' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px;
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    font-size: 13px;
    color: var(--text-2);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.select:hover {
    border-color: var(--line-3);
}

.select:focus {
    border-color: var(--accent-line);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.select.has-value {
    color: var(--text);
    background-color: var(--surface-2);
    border-color: var(--accent-line);
}

.select option {
    background: var(--surface-2);
    color: var(--text);
}

/* Segmented control */
.seg {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 9px;
    flex-shrink: 0;
}

.seg button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 28px;
    padding: 0 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-3);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.seg button:hover {
    color: var(--text);
    background: var(--hover);
}

.seg button.is-active {
    color: var(--text);
    background: var(--surface-4);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), inset 0 0 0 1px var(--line-2);
}

.seg-icon button {
    width: 30px;
    padding: 0;
    justify-content: center;
}

.seg-icon .i {
    width: 15px;
    height: 15px;
}

.seg-count {
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    color: var(--text-4);
}

.seg-count:empty {
    display: none;
}

.seg button.is-active .seg-count {
    color: var(--text-3);
}

/* ───────────── Brand ───────────── */

.logo {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #8b8ff9 0%, #4f46e5 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 14px rgba(99, 102, 241, 0.3);
}

.logo svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: #fff;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.logo-lg {
    width: 52px;
    height: 52px;
    border-radius: 15px;
}

.logo-lg svg {
    width: 32px;
    height: 32px;
}

.brand-name {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
    line-height: 1.2;
}

.brand-tag {
    font-size: 11.5px;
    color: var(--text-3);
    line-height: 1.3;
}

/* ───────────── Screens ───────────── */

#boot-screen,
#login-screen,
#app {
    display: none;
}

body[data-view="boot"] #boot-screen {
    display: grid;
}

body[data-view="login"] #login-screen {
    display: grid;
}

body[data-view="app"] #app {
    display: flex;
}

#boot-screen {
    height: 100vh;
    height: 100dvh;
    place-items: center;
}

#boot-screen .logo {
    animation: breathe 1.6s ease-in-out infinite;
}

/* ───────────── Login ───────────── */

#login-screen {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    place-items: center;
    padding: 24px 16px;
    overflow: auto;
}

.login-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(700px 420px at 50% 22%, rgba(99, 102, 241, 0.16), transparent 70%),
        radial-gradient(500px 360px at 78% 88%, rgba(57, 135, 229, 0.07), transparent 70%);
}

.login-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 60% 55% at 50% 40%, #000 10%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 40%, #000 10%, transparent 75%);
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 384px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 28px;
    background: rgba(17, 19, 24, 0.82);
    border: 1px solid var(--line-2);
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: rise 0.45s var(--ease);
}

.login-card.shake {
    animation: shake 0.4s;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 12px;
}

.login-title {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.login-sub {
    margin-top: -8px;
    color: var(--text-3);
    font-size: 13px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-2);
}

.caps-hint {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--warn);
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap>.i {
    position: absolute;
    left: 12px;
    color: var(--text-4);
    pointer-events: none;
    transition: color 0.15s;
}

.input-wrap:focus-within>.i {
    color: var(--text-2);
}

.input-wrap input {
    width: 100%;
    height: 42px;
    padding: 0 42px 0 38px;
    background: var(--bg);
    border: 1px solid var(--line-2);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input-wrap input::placeholder {
    color: var(--text-4);
}

.input-wrap input:hover {
    border-color: var(--line-3);
}

.input-wrap input:focus {
    border-color: var(--accent-line);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-action {
    position: absolute;
    right: 6px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-4);
}

.input-action:hover {
    color: var(--text);
    background: var(--hover-2);
}

#login-btn {
    margin-top: 6px;
}

#login-btn.is-busy .i {
    display: none;
}

#login-btn.is-busy::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.login-foot {
    margin-top: 4px;
    text-align: center;
    font-size: 12px;
    color: var(--text-4);
}

/* ───────────── App shell ───────────── */

#app {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

#sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--line);
    transition: width 0.2s var(--ease), transform 0.25s var(--ease);
    z-index: 40;
    overflow: hidden;
}

.sb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: var(--topbar-h);
    padding: 0 10px 0 16px;
    flex-shrink: 0;
}

.sb-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
    border-radius: 8px;
}

.sb-brand-text {
    min-width: 0;
    white-space: nowrap;
}

.sb-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sb-section {
    padding: 14px 10px 6px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-4);
    white-space: nowrap;
}

.sb-section:first-child {
    padding-top: 6px;
}

.nav-item,
.sb-help {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 34px;
    padding: 0 8px 0 10px;
    border: 0;
    border-radius: var(--r);
    background: transparent;
    color: var(--text-3);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}

.nav-item .i,
.sb-help .i {
    width: 17px;
    height: 17px;
}

.nav-item:hover,
.sb-help:hover {
    background: var(--hover);
    color: var(--text-2);
}

.nav-item.is-active {
    background: var(--surface-3);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--line);
}

.nav-item.is-active .i {
    color: var(--accent);
}

.nav-label {
    flex: 1;
    text-align: left;
}

.nav-item kbd,
.sb-help kbd {
    opacity: 0;
    transition: opacity 0.12s;
}

.nav-item:hover kbd,
.sb-help:hover kbd {
    opacity: 1;
}

.nav-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9px;
    background: var(--bad-soft);
    color: var(--bad);
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.nav-status {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-4);
    flex-shrink: 0;
}

.nav-status[data-status="healthy"] {
    background: var(--good);
    box-shadow: 0 0 0 3px var(--good-soft);
}

.nav-status[data-status="degraded"] {
    background: var(--warn);
    box-shadow: 0 0 0 3px var(--warn-soft);
}

.nav-status[data-status="critical"] {
    background: var(--bad);
    box-shadow: 0 0 0 3px var(--bad-soft);
    animation: blink 1.4s ease-in-out infinite;
}

.nav-item:hover .nav-badge+kbd,
.nav-item:hover .nav-status+kbd {
    display: none;
}

.sb-foot {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px 12px;
    border-top: 1px solid var(--line);
    flex-shrink: 0;
}

.sb-help {
    width: 100%;
    font-size: 13px;
}

.sb-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 2px 0 6px;
}

.avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(135deg, #8b8ff9, #b18cf6);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.sb-user-text {
    flex: 1;
    min-width: 0;
}

.sb-email {
    font-size: 12.5px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-role {
    font-size: 11.5px;
    color: var(--text-4);
}

#logout-btn:hover {
    color: var(--bad);
    background: var(--bad-soft);
}

/* Rail (collapsed) sidebar */
#sidebar.rail {
    width: var(--rail-w);
}

#sidebar.rail .sb-brand-text,
#sidebar.rail .nav-label,
#sidebar.rail kbd,
#sidebar.rail .sb-user-text,
#sidebar.rail .nav-badge {
    display: none;
}

#sidebar.rail .sb-head {
    flex-direction: column;
    justify-content: center;
    height: auto;
    gap: 6px;
    padding: 13px 0 4px;
}

#sidebar.rail .sb-nav {
    padding: 6px 12px;
}

#sidebar.rail .sb-section {
    height: 17px;
    padding: 0;
    font-size: 0;
    position: relative;
}

#sidebar.rail .sb-section::after {
    content: '';
    position: absolute;
    left: 8px;
    right: 8px;
    top: 8px;
    height: 1px;
    background: var(--line-2);
}

#sidebar.rail .sb-section:first-child {
    display: none;
}

#sidebar.rail .nav-item,
#sidebar.rail .sb-help {
    justify-content: center;
    width: 40px;
    padding: 0;
    margin: 0 auto;
}

#sidebar.rail .nav-status {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 6px;
    height: 6px;
}

#sidebar.rail .sb-foot {
    padding: 8px 12px 12px;
}

#sidebar.rail .sb-user {
    flex-direction: column;
    gap: 6px;
    padding: 4px 0 0;
}

#sidebar.rail .sb-collapse {
    transform: scaleX(-1);
}

#sb-backdrop {
    display: none;
}

#main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Topbar */
#topbar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topbar-h);
    padding: 0 20px 0 24px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    flex-shrink: 0;
    z-index: 20;
}

#menu-btn {
    display: none;
    margin-left: -6px;
}

.tb-titles {
    flex: 1;
    min-width: 0;
}

#page-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

#page-sub {
    font-size: 12.5px;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tb-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.tb-updated {
    margin-right: 4px;
    font-size: 12.5px;
    color: var(--text-3);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

body.is-loading #refresh-btn .i {
    animation: spin 0.9s linear infinite;
}

.live-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 12px 0 8px;
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.live-btn:hover {
    background: var(--surface-3);
    border-color: var(--line-3);
    color: var(--text);
}

.live-ring {
    position: relative;
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
}

.live-ring svg {
    position: absolute;
    inset: 0;
    transform: rotate(-90deg);
}

.lr-track,
.lr-prog {
    fill: none;
    stroke-width: 2;
}

.lr-track {
    stroke: var(--line-2);
}

.lr-prog {
    stroke: var(--good);
    stroke-dasharray: 50.27;
    stroke-dashoffset: 0;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--good);
}

.live-btn[aria-pressed="false"] .live-dot {
    background: var(--text-4);
}

.live-btn[aria-pressed="false"] .lr-prog {
    opacity: 0;
}

#progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

#progress i {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 35%;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    animation: indeterminate 1.1s ease-in-out infinite;
}

body.is-loading #progress {
    opacity: 1;
}

/* Banner */
.banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 24px 0;
    padding: 6px 6px 6px 14px;
    border-radius: var(--r-md);
    background: var(--bad-soft);
    border: 1px solid var(--bad-line);
    color: #fbb8b8;
    font-size: 13px;
    flex-shrink: 0;
    animation: rise 0.25s var(--ease);
}

#banner-text {
    flex: 1;
    min-width: 0;
}

.banner .btn-ghost {
    background: transparent;
    border-color: var(--bad-line);
    color: #fbb8b8;
}

.banner .icon-btn {
    color: #fbb8b8;
}

/* Content */
#content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 1680px;
    margin: 0 auto;
    padding: 20px 24px 32px;
    animation: pageIn 0.3s var(--ease);
}

.page-fill {
    height: 100%;
    min-height: 600px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.toolbar-wrap {
    flex-wrap: wrap;
}

.toolbar-note {
    font-size: 12.5px;
    color: var(--text-3);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.grid-wide {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
    gap: 16px;
}

/* ───────────── Cards ───────────── */

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
    overflow: hidden;
}

.card-fill {
    flex: 1;
    min-height: 340px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px 10px 18px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.card-head-line {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.card-head-compact {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.card-titles {
    min-width: 0;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.005em;
    line-height: 1.35;
}

.card-sub {
    margin-top: 1px;
    font-size: 12.5px;
    color: var(--text-3);
}

.card-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tools-label {
    font-size: 12.5px;
    color: var(--text-3);
}

.count-pill {
    display: inline-flex;
    align-items: center;
    height: 19px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

.count-warn {
    background: var(--warn-soft);
    color: var(--warn);
}

.count-bad {
    background: var(--bad-soft);
    color: var(--bad);
}

/* ───────────── KPI tiles ───────────── */

.kpis {
    display: grid;
    gap: 12px;
    flex-shrink: 0;
}

.kpis-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.kpis-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.kpi {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 14px 16px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
    overflow: hidden;
}

.kpi-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-3);
}

.kpi-value {
    margin-top: 6px;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.15;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.kpi-value .unit {
    margin-left: 3px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--text-3);
}

.kpi-value.is-bad {
    color: var(--bad);
}

.kpi-value.is-warn {
    color: var(--warn);
}

.kpi-value.is-good {
    color: var(--good);
}

.kpi-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 20px;
    margin-top: 6px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
}

.kpi-sub {
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-delta:empty {
    display: none;
}

.delta {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 20px;
    padding: 0 6px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    background: var(--surface-3);
    color: var(--text-2);
}

.delta-good {
    background: var(--good-soft);
    color: var(--good);
}

.delta-bad {
    background: var(--bad-soft);
    color: var(--bad);
}

.kpi-spark {
    height: 34px;
    margin: auto -16px -14px;
}

.kpi-spark svg {
    display: block;
}

.kpi-meter {
    height: 4px;
    margin-top: auto;
    border-radius: 2px;
    background: var(--surface-3);
    overflow: hidden;
}

.kpi-meter i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 2px;
    background: var(--st-good);
    transition: width 0.6s var(--ease), background 0.3s;
}

/* ───────────── Charts ───────────── */

.legend {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12.5px;
    color: var(--text-2);
}

.lg {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.sw {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--text-4);
}

.sw-line {
    width: 14px;
    height: 2px;
    border-radius: 1px;
}

.sw-series1 {
    background: var(--series-1);
}

.sw-series2 {
    background: var(--series-2);
}

.sw-critical {
    background: var(--st-critical);
}

.sw-good {
    background: var(--st-good);
}

.sw-warn {
    background: var(--st-warn);
}

.viz {
    position: relative;
    height: 268px;
    margin: 0 4px 6px 0;
    outline: none;
    transition: opacity 0.2s;
}

.viz:focus-visible {
    box-shadow: inset 0 0 0 2px var(--accent-line);
    border-radius: 8px;
}

.viz svg {
    display: block;
    overflow: visible;
}

.viz.is-stale,
.status-dist.is-stale,
.health-hero.is-stale {
    opacity: 0.55;
}

.viz text {
    font-family: var(--sans);
    font-size: 11px;
    fill: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.viz .end-label {
    font-size: 11.5px;
    font-weight: 600;
    fill: var(--text-2);
}

.grid-line {
    stroke: var(--grid);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.base-line {
    stroke: var(--axis);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.bar-s {
    fill: var(--series-1);
}

.bar-f {
    fill: var(--st-critical);
}

.hover-band {
    fill: rgba(255, 255, 255, 0.045);
    opacity: 0;
}

.hover-band.on {
    opacity: 1;
}

.crosshair {
    stroke: var(--line-3);
    stroke-width: 1;
    shape-rendering: crispEdges;
    opacity: 0;
}

.crosshair.on,
.hover-dot.on {
    opacity: 1;
}

.hover-dot {
    opacity: 0;
    stroke: var(--surface);
    stroke-width: 2;
}

.line {
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.viz-skeleton {
    position: absolute;
    inset: 12px 12px 30px 48px;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--surface-2) 0, var(--surface-3) 40%, var(--surface-2) 80%);
    background-size: 300% 100%;
    animation: shimmer 1.4s linear infinite;
    opacity: 0.6;
}

.viz-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--text-3);
    font-size: 13px;
}

.viz-table {
    max-height: 268px;
    margin-bottom: 6px;
    overflow: auto;
    border-top: 1px solid var(--line);
}

/* Tooltip */
#viz-tip {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 90;
    min-width: 168px;
    padding: 10px 12px;
    background: rgba(27, 30, 38, 0.97);
    border: 1px solid var(--line-3);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-pop);
    font-size: 12.5px;
    color: var(--text-2);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s, visibility 0s 0.12s;
}

#viz-tip.show {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.12s;
}

.tt-title {
    margin-bottom: 7px;
    font-size: 11.5px;
    color: var(--text-3);
    white-space: nowrap;
}

.tt-row {
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.85;
    white-space: nowrap;
}

.tt-key {
    width: 12px;
    height: 2px;
    border-radius: 1px;
    flex-shrink: 0;
}

.tt-val {
    min-width: 42px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.tt-name {
    color: var(--text-3);
}

.tt-foot {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--line-2);
    color: var(--text-3);
    white-space: nowrap;
}

/* Status distribution */
.status-dist {
    padding: 2px 18px 14px;
    transition: opacity 0.2s;
}

.sd-total {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 4px 0 12px;
}

.sd-total-num {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.15;
    color: var(--text);
}

.sd-total-label {
    font-size: 13px;
    color: var(--text-3);
}

.sd-bar {
    display: flex;
    gap: 2px;
    height: 12px;
    margin: 0 0 14px;
}

.sd-seg {
    height: 100%;
    min-width: 3px;
    transition: filter 0.12s;
}

.sd-seg:first-child {
    border-radius: 4px 0 0 4px;
}

.sd-seg:last-child {
    border-radius: 0 4px 4px 0;
}

.sd-seg:only-child {
    border-radius: 4px;
}

.sd-seg:hover {
    filter: brightness(1.2);
}

.sd-row {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto 54px 16px;
    align-items: center;
    gap: 10px;
    margin: 0 -8px;
    padding: 9px 8px;
    border-top: 1px solid var(--line);
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.12s;
}

.sd-row:hover {
    background: var(--hover);
}

.sd-row .i {
    width: 14px;
    height: 14px;
    color: var(--text-4);
    opacity: 0;
    transition: opacity 0.12s;
}

.sd-row:hover .i {
    opacity: 1;
}

.sd-sw {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.sd-name {
    color: var(--text);
    font-weight: 500;
}

.sd-desc {
    margin-left: 6px;
    color: var(--text-3);
    font-weight: 400;
}

.sd-count {
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.sd-pct {
    color: var(--text-3);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ───────────── Tables ───────────── */

.table-fill {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.table-capped {
    max-height: 520px;
    overflow: auto;
}

.table-capped-sm {
    max-height: 380px;
    min-height: 180px;
}

.dt-host {
    transition: opacity 0.2s;
}

.dt-host.is-stale {
    opacity: 0.55;
}

.dt {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 13px;
}

.dt th {
    position: sticky;
    top: 0;
    z-index: 2;
    height: 36px;
    padding: 0 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--line-2);
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
}

.dt th.sortable {
    cursor: pointer;
    transition: color 0.12s;
}

.dt th.sortable:hover {
    color: var(--text-2);
}

.dt th.is-sorted {
    color: var(--text);
}

.sort-ind {
    display: inline-block;
    margin-left: 4px;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.12s;
}

.dt th.sortable:hover .sort-ind {
    opacity: 0.5;
}

.dt th.is-sorted .sort-ind {
    opacity: 1;
    color: var(--accent);
}

.dt td {
    height: 38px;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.08s;
}

.dt th:first-child,
.dt td:first-child {
    padding-left: 18px;
}

.dt th:last-child,
.dt td:last-child {
    padding-right: 18px;
}

.dt .r {
    text-align: right;
}

.dt td.r {
    font-variant-numeric: tabular-nums;
}

.dt tbody tr {
    cursor: pointer;
    scroll-margin-top: 40px;
    scroll-margin-bottom: 4px;
}

.dt tbody tr:last-child td {
    border-bottom-color: transparent;
}

.dt tbody tr:hover td {
    background: var(--hover);
}

.dt tbody tr.is-error td:first-child {
    box-shadow: inset 2px 0 0 var(--bad);
}

.dt tbody tr.is-selected td {
    background: var(--accent-soft);
}

.dt tbody tr.is-selected td:first-child {
    box-shadow: inset 2px 0 0 var(--accent);
}

#ov-errors .dt th {
    position: static;
}

.dt-static tbody tr {
    cursor: default;
}

.dt-static td {
    height: 34px;
}

.dt-static tbody tr:hover td {
    background: transparent;
}

.t-strong {
    color: var(--text) !important;
}

.t-dim {
    color: var(--text-3) !important;
}

.t-err {
    color: #f3a3a3 !important;
}

.unit {
    margin-left: 2px;
    font-size: 11px;
    color: var(--text-4);
}

.ms-warn {
    color: var(--warn) !important;
}

.ms-slow {
    color: var(--bad) !important;
}

.ms-warn .unit,
.ms-slow .unit {
    color: inherit;
    opacity: 0.6;
}

.method {
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.m-get {
    color: #7db4f7;
}

.m-post {
    color: #5fd3a0;
}

.m-put {
    color: #f2be5c;
}

.m-patch {
    color: #baa8fa;
}

.m-delete {
    color: #f58b8b;
}

.m-other {
    color: var(--text-3);
}

.method-lg {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 8px;
    border-radius: 6px;
    background: var(--surface-3);
    font-size: 12px;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 21px;
    padding: 0 7px;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1;
    vertical-align: middle;
}

.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-lg {
    height: 24px;
    padding: 0 9px;
    font-size: 12px;
}

.status-lg .status-reason {
    font-family: var(--sans);
    font-weight: 500;
    opacity: 0.85;
}

.st-good {
    color: var(--good);
    background: var(--good-soft);
}

.st-info {
    color: var(--info);
    background: var(--info-soft);
}

.st-warn {
    color: var(--warn);
    background: var(--warn-soft);
}

.st-bad {
    color: var(--bad);
    background: var(--bad-soft);
}

.st-none {
    color: var(--text-3);
    background: var(--surface-3);
}

.user-ref {
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

.user-ref::before {
    content: '#';
    color: var(--text-4);
}

/* Inline meters in tables */
.share {
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-track {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--surface-3);
    overflow: hidden;
}

.share-track i {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--series-1);
}

.share-track.is-bad i {
    background: var(--st-critical);
}

.share-track.is-warn i {
    background: var(--st-warn);
}

.share-val {
    width: 46px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text-2);
}

.lat {
    position: relative;
    height: 8px;
    border-radius: 4px;
    background: var(--surface-3);
    overflow: hidden;
}

.lat i {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 4px;
    background: var(--series-1);
}

.lat .lat-p99 {
    opacity: 0.3;
}

.lat .lat-p95 {
    opacity: 0.55;
}

.lat .lat-max {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: var(--text-3);
    border-radius: 1px;
}

/* Skeleton & empty states */
.sk {
    display: block;
    height: 9px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--surface-3) 0, var(--surface-4) 40%, var(--surface-3) 80%);
    background-size: 300% 100%;
    animation: shimmer 1.4s linear infinite;
}

.dt .r .sk {
    margin-left: auto;
}

.sk-row td {
    cursor: default;
}

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 100%;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-3);
    animation: fadeIn 0.25s ease;
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 8px;
    border-radius: 12px;
    background: var(--surface-3);
    color: var(--text-3);
    box-shadow: inset 0 0 0 1px var(--line);
}

.empty-icon .i {
    width: 19px;
    height: 19px;
}

.empty-icon.good {
    background: var(--good-soft);
    color: var(--good);
    box-shadow: inset 0 0 0 1px var(--good-line);
}

.empty-icon.bad {
    background: var(--bad-soft);
    color: var(--bad);
    box-shadow: inset 0 0 0 1px var(--bad-line);
}

.empty-title {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
}

.empty-sub {
    max-width: 340px;
    font-size: 12.5px;
}

.empty .btn {
    margin-top: 12px;
}

/* Pager */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px 8px 18px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--text-3);
    flex-shrink: 0;
}

.pager-btns {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pager-page {
    min-width: 92px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.pager-page strong,
.pager-info strong {
    color: var(--text-2);
    font-weight: 500;
}

/* Requests */
.req-summary {
    font-size: 12.5px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.req-summary strong {
    color: var(--text-2);
    font-weight: 500;
}

.scan {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.scan-bar {
    width: 140px;
    height: 4px;
    border-radius: 2px;
    background: var(--surface-3);
    overflow: hidden;
}

.scan-bar i {
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.25s var(--ease);
}

/* ───────────── Health ───────────── */

[data-status] {
    --st: var(--text-4);
    --st-soft: var(--surface-3);
    --st-line: var(--line-2);
}

[data-status="healthy"] {
    --st: var(--good);
    --st-soft: var(--good-soft);
    --st-line: var(--good-line);
}

[data-status="degraded"] {
    --st: var(--warn);
    --st-soft: var(--warn-soft);
    --st-line: var(--warn-line);
}

[data-status="critical"] {
    --st: var(--bad);
    --st-soft: var(--bad-soft);
    --st-line: var(--bad-line);
}

.health-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 9px 12px 9px 14px;
    border-radius: var(--r-md);
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 13px;
    color: var(--text-3);
    text-decoration: none;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}

.health-strip:hover {
    border-color: var(--line-3);
}

.health-strip[data-status="degraded"],
.health-strip[data-status="critical"] {
    background: linear-gradient(90deg, var(--st-soft), transparent 70%), var(--surface);
    border-color: var(--st-line);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--st);
    flex-shrink: 0;
    box-shadow: 0 0 0 3px var(--st-soft);
}

[data-status="healthy"] .status-dot,
[data-status="degraded"] .status-dot,
[data-status="critical"] .status-dot {
    animation: ping 2.4s ease-out infinite;
}

.hs-label {
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
}

.hs-detail {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.hs-detail::before {
    content: '·';
    margin-right: 10px;
    color: var(--text-4);
}

.hs-detail:empty {
    display: none;
}

.hs-link {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    padding-left: 12px;
    font-size: 12.5px;
    color: var(--text-3);
    white-space: nowrap;
    transition: color 0.15s;
}

.hs-link .i {
    width: 14px;
    height: 14px;
}

.health-strip:hover .hs-link {
    color: var(--text);
}

.health-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, auto);
    align-items: center;
    gap: 20px;
    padding: 22px 24px;
    border-radius: 14px;
    background: radial-gradient(ellipse 420px 180px at 0% 50%, var(--st-soft), transparent 70%), var(--surface);
    border: 1px solid var(--st-line);
    flex-shrink: 0;
    transition: opacity 0.2s, border-color 0.3s;
}

.hh-pulse {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--st-soft);
}

.hh-pulse span {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--st);
    animation: ping 2.4s ease-out infinite;
}

.hh-eyebrow {
    font-size: 12px;
    color: var(--text-3);
}

.hh-label {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--text);
}

.hh-sub {
    font-size: 12.5px;
    color: var(--text-3);
}

.hh-warnings {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 520px;
}

.hh-warning,
.hh-ok {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-2);
}

.hh-warning .i {
    margin-top: 1px;
    color: var(--warn);
}

.hh-ok .i {
    margin-top: 1px;
    color: var(--good);
}

.history {
    padding: 4px 18px 18px;
}

.hist-bars {
    display: flex;
    align-items: stretch;
    gap: 3px;
    height: 40px;
}

.hist-bar {
    flex: 1;
    min-width: 2px;
    border-radius: 3px;
    background: var(--surface-3);
    transition: transform 0.12s, filter 0.12s;
}

.hist-bar.healthy {
    background: var(--st-good);
}

.hist-bar.degraded {
    background: var(--st-warn);
}

.hist-bar.critical {
    background: var(--st-critical);
}

.hist-bar.unknown {
    background: var(--text-4);
}

.hist-bar:not(.vacant):hover {
    filter: brightness(1.25);
    transform: scaleY(1.08);
}

.hist-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--text-4);
    font-variant-numeric: tabular-nums;
}

.hist-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--text-3);
}

.hist-summary strong {
    color: var(--text);
    font-weight: 500;
}

/* ───────────── Drawer ───────────── */

#drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: min(580px, 100vw);
    background: var(--surface);
    border-left: 1px solid var(--line-2);
    box-shadow: -28px 0 60px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.28s var(--ease), visibility 0s 0.28s;
}

body.drawer-open #drawer {
    transform: none;
    visibility: visible;
    transition: transform 0.28s var(--ease);
}

.dw-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: var(--topbar-h);
    padding: 0 12px 0 20px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.dw-title {
    font-size: 13.5px;
    font-weight: 600;
}

.dw-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.dw-pos {
    margin-right: 8px;
    font-size: 12px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.dw-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 20px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.dw-body>* {
    flex-shrink: 0;
    animation: fadeIn 0.2s ease;
}

.d-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.d-dur {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 8px;
    border-radius: 6px;
    background: var(--surface-3);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

.d-dur .i {
    width: 13px;
    height: 13px;
    opacity: 0.7;
}

.d-dur.ms-warn {
    background: var(--warn-soft);
}

.d-dur.ms-slow {
    background: var(--bad-soft);
}

.d-path {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 12px;
}

.d-path code {
    flex: 1;
    min-width: 0;
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
    color: var(--text);
    word-break: break-all;
}

.d-path .mini-btn {
    margin-top: -1px;
}

.d-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.d-heading-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--surface-3);
    color: var(--text-2);
}

.d-heading-icon.bad {
    background: var(--bad-soft);
    color: var(--bad);
}

.d-heading-icon.warn {
    background: var(--warn-soft);
    color: var(--warn);
}

.d-when {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--text-3);
}

.d-when span {
    color: var(--text-4);
}

.kv {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
}

.kv>div {
    min-width: 0;
    padding: 10px 14px 11px;
    background: var(--surface);
}

.kv .wide {
    grid-column: 1 / -1;
}

.kv dt {
    margin-bottom: 3px;
    font-size: 11.5px;
    color: var(--text-3);
}

.kv dd {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    min-height: 24px;
    font-size: 13.5px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.kv dd code {
    font-family: var(--mono);
    font-size: 12.5px;
}

.kv dd .val {
    min-width: 0;
    overflow-wrap: anywhere;
}

.kv dd .mini-btn {
    opacity: 0;
    transition: opacity 0.12s;
}

.kv>div:hover .mini-btn,
.kv dd .mini-btn:focus-visible {
    opacity: 1;
}

.kv dd .sub {
    color: var(--text-3);
    font-size: 12.5px;
}

.callout {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 8px 10px 12px;
    border-radius: var(--r-md);
    font-size: 13px;
    line-height: 1.5;
}

.callout>.i {
    margin-top: 2px;
}

.callout>div {
    flex: 1;
    min-width: 0;
}

.callout-title {
    font-weight: 600;
}

.callout-text {
    overflow-wrap: anywhere;
}

.callout-bad {
    background: var(--bad-soft);
    border: 1px solid var(--bad-line);
    color: #fbb8b8;
}

.callout-bad .mini-btn {
    color: #fbb8b8;
    opacity: 0.6;
}

.callout-bad .mini-btn:hover {
    opacity: 1;
    background: rgba(244, 122, 122, 0.15);
}

.callout-warn {
    background: var(--warn-soft);
    border: 1px solid var(--warn-line);
    color: #f8d595;
}

.d-section-title {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-3);
}

.d-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.action {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    background: var(--surface-2);
    font-size: 13px;
    color: var(--text-2);
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.action>span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.action .i {
    color: var(--text-3);
}

.action .action-arrow {
    width: 14px;
    height: 14px;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.15s, transform 0.15s;
}

.action:hover {
    background: var(--surface-3);
    border-color: var(--line-3);
    color: var(--text);
}

.action:hover .action-arrow {
    opacity: 1;
    transform: none;
}

.code {
    border: 1px solid var(--line-2);
    border-radius: var(--r-md);
    background: var(--bg);
    overflow: hidden;
}

.code+.code {
    margin-top: 12px;
}

.code-head {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 6px 0 12px;
    background: var(--surface-2);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
}

.code-head>span:first-child {
    flex: 1;
}

.code-meta {
    font-weight: 400;
    color: var(--text-4);
    font-variant-numeric: tabular-nums;
}

.code pre {
    max-height: 440px;
    margin: 0;
    padding: 12px 14px;
    overflow: auto;
    border-top: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.65;
    color: var(--text-2);
    white-space: pre-wrap;
    word-break: break-word;
    tab-size: 2;
}

.code-empty .code-head {
    background: transparent;
}

.j-key {
    color: #9dbaf6;
}

.j-str {
    color: #8fd5a6;
}

.j-num {
    color: #f2c27b;
}

.j-bool {
    color: #c6a5f8;
}

.j-null {
    color: var(--text-3);
}

.code-skeleton {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 14px;
}

.lat-ladder {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}

.ll-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 84px;
    align-items: center;
    gap: 12px;
    font-size: 12.5px;
}

.ll-name {
    color: var(--text-3);
}

.ll-track {
    height: 8px;
    border-radius: 4px;
    background: var(--surface-3);
    overflow: hidden;
}

.ll-track i {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--series-1);
}

.ll-val {
    text-align: right;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    height: 28px;
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid var(--line-2);
    background: var(--surface-2);
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-2);
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.chip span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.chip:hover {
    background: var(--surface-3);
    border-color: var(--line-3);
    color: var(--text);
}

/* ───────────── Overlay sheet ───────────── */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(4, 5, 8, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 0.15s ease;
}

.sheet {
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-pop);
    animation: pop 0.22s var(--ease);
}

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px 12px 20px;
    border-bottom: 1px solid var(--line);
}

.sheet-head h2 {
    font-size: 14px;
    font-weight: 600;
}

.shortcuts {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 20px 20px;
}

.sc-title {
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-3);
}

.sc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-2);
}

.sc-row+.sc-row {
    border-top: 1px solid var(--line);
}

.sc-row>span:last-child {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-4);
}

/* ───────────── Toasts ───────────── */

#toasts {
    position: fixed;
    left: 50%;
    bottom: 22px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px 0 12px;
    background: var(--surface-4);
    border: 1px solid var(--line-3);
    border-radius: 999px;
    box-shadow: var(--shadow-pop);
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    animation: toastIn 0.22s var(--ease);
}

.toast .i {
    width: 15px;
    height: 15px;
    color: var(--good);
}

.toast.is-error .i {
    color: var(--bad);
}

.toast.out {
    animation: toastOut 0.2s ease forwards;
}

/* ───────────── Animations ───────────── */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

@keyframes pop {
    from {
        opacity: 0;
        transform: scale(0.97) translateY(6px);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateY(4px);
    }
}

@keyframes shimmer {
    from {
        background-position: 100% 0;
    }

    to {
        background-position: -50% 0;
    }
}

@keyframes indeterminate {
    from {
        left: -35%;
    }

    to {
        left: 100%;
    }
}

@keyframes ping {
    0% {
        box-shadow: 0 0 0 0 var(--st-line);
    }

    70%,
    100% {
        box-shadow: 0 0 0 8px transparent;
    }
}

@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(0.94);
        opacity: 0.7;
    }
}

@keyframes blink {
    50% {
        opacity: 0.4;
    }
}

@keyframes shake {

    20%,
    60% {
        transform: translateX(-6px);
    }

    40%,
    80% {
        transform: translateX(6px);
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* ───────────── Responsive ───────────── */

@media (max-width: 1280px) {
    .kpis-5 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .sb-collapse {
        display: none;
    }

    .grid-wide,
    .grid-2 {
        grid-template-columns: minmax(0, 1fr);
    }

    .kpis-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    #sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 264px;
        transform: translateX(-100%);
        box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5);
    }

    body.sb-open #sidebar {
        transform: none;
    }

    #sb-backdrop {
        position: fixed;
        inset: 0;
        z-index: 35;
        background: rgba(4, 5, 8, 0.6);
    }

    body.sb-open #sb-backdrop {
        display: block;
        animation: fadeIn 0.2s ease;
    }

    .nav-item kbd,
    .sb-help {
        display: none;
    }

    #menu-btn {
        display: inline-grid;
    }

    #topbar {
        gap: 8px;
        padding: 0 12px 0 16px;
    }

    #page-sub,
    .tb-updated,
    #refresh-btn .btn-label {
        display: none;
    }

    #refresh-btn {
        width: 32px;
        padding: 0;
    }

    .banner {
        margin: 12px 16px 0;
    }

    .page {
        padding: 16px 16px 28px;
        gap: 12px;
    }

    .kpis-3,
    .kpis-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kpi-value {
        font-size: 22px;
    }

    .health-hero {
        grid-template-columns: auto minmax(0, 1fr);
        padding: 18px;
    }

    .hh-warnings {
        grid-column: 1 / -1;
    }

    .hs-detail {
        display: none;
    }

    .search {
        flex-basis: 100%;
        max-width: none;
    }

    .search-kbd {
        display: none;
    }

    .pager-info {
        display: none;
    }

    .pager {
        justify-content: center;
    }

    .kv {
        grid-template-columns: minmax(0, 1fr);
    }
}
