@font-face {
    font-family: "Space Grotesk";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/static/fonts/space-grotesk/space-grotesk-latin-400-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Space Grotesk";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/static/fonts/space-grotesk/space-grotesk-latin-500-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Space Grotesk";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/static/fonts/space-grotesk/space-grotesk-latin-600-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Space Grotesk";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/static/fonts/space-grotesk/space-grotesk-latin-700-normal.woff2") format("woff2");
}

:root {
    --bg: #120c22;
    --bg-2: #0c0716;
    --grid-line: rgba(255, 255, 255, 0.03);
    --card: #1f1733;
    --panel: #261b3c;
    --panel-soft: rgba(36, 25, 58, 0.9);
    --border: #33224c;
    --muted: #c8bedc;
    --text: #f5f1ff;
    --accent: #7b3deb;
    --accent-2: #a76bfd;
    --accent-3: #6f45ff;
    --success: #6be3c8;
    --warning: #ffc861;
    --danger: #ff8a80;
    --canvas-fill: radial-gradient(circle at 20% 20%, rgba(114, 21, 201, 0.08), transparent 28%), rgba(255, 255, 255, 0.02);
    --radius: 14px;
    --shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
    --glow: 0 18px 52px rgba(123, 61, 235, 0.22);
}

* {
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(120% 120% at 20% 12%, rgba(123, 61, 235, 0.2), transparent 50%),
        radial-gradient(140% 140% at 80% 10%, rgba(68, 35, 118, 0.26), transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 65%);
    color: var(--text);
    font-family: "Space Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
    position: relative;
    overflow-x: auto;
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

.button {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    box-shadow: 0 16px 38px rgba(123, 61, 235, 0.35);
}

.button.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: rgba(255, 255, 255, 0.2);
}

.button.ghost {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: rgba(255, 255, 255, 0.14);
}

.button.small {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 10px;
}

.button.full {
    width: 100%;
    text-align: center;
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
}

select,
option {
    background: var(--panel);
    color: var(--text);
}
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--panel)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' fill='none' stroke='%23f5f1ff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        no-repeat right 12px center / 12px 12px;
    padding-right: 36px;
}
select::-ms-expand {
    display: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.chip.ok {
    background: rgba(107, 227, 200, 0.15);
    color: #9ff0dd;
}
.chip.warning {
    background: rgba(255, 200, 97, 0.16);
    color: #ffd993;
}
.chip.critical {
    background: rgba(255, 138, 128, 0.18);
    color: #ffc2b9;
}
.chip.unknown {
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted);
}

.chrome {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    min-height: 100vh;
    width: 100%;
    margin: 0;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.nav-rail {
    background: linear-gradient(180deg, rgba(33, 24, 51, 0.95), rgba(18, 11, 31, 0.92));
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.chrome.nav-collapsed {
    grid-template-columns: 86px 1fr;
}
.nav-rail.collapsed {
    width: 86px;
    padding: 12px 10px;
    gap: 8px;
}
.nav-rail.collapsed .rail-mark,
.nav-rail.collapsed .menu-item span:not(.menu-icon),
.nav-rail.collapsed .menu-label,
.nav-rail.collapsed .helper,
.nav-rail.collapsed .side-actions,
.nav-rail.collapsed .rail-select,
.nav-rail.collapsed .nav-tree,
.nav-rail.collapsed input,
.nav-rail.collapsed select,
.nav-rail.collapsed #dsList,
.nav-rail.collapsed .menu-panel,
.nav-rail.collapsed .logout-block,
.nav-rail.collapsed .menu-section .chevron {
    display: none !important;
}
.nav-rail.collapsed .rail-logo {
    justify-content: center;
    gap: 6px;
}
.nav-rail.collapsed .rail-toggle {
    transform: rotate(180deg);
}
.nav-rail.collapsed .menu-section {
    padding: 0;
}
.nav-rail.collapsed .menu-item {
    justify-content: center;
}
.nav-rail.collapsed details {
    border: none;
    background: transparent;
}

.rail-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(120deg, rgba(123, 61, 235, 0.2), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.rail-toggle {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 6px 8px;
    cursor: pointer;
    font-weight: 700;
    line-height: 1;
}
.rail-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}
.logo-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 6px rgba(123, 61, 235, 0.25);
}
.rail-mark {
    font-weight: 800;
    letter-spacing: 0.1em;
}

.rail-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-section {
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
}
.menu-section summary {
    list-style: none;
}
.menu-section summary::-webkit-details-marker {
    display: none;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    background: transparent;
    border: none;
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}
.menu-item.active,
.menu-item:hover {
    background: rgba(255, 255, 255, 0.04);
}
.menu-icon {
    width: 18px;
    text-align: center;
    color: var(--muted);
}
.chevron {
    margin-left: auto;
    color: var(--muted);
}

.menu-panel {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.logout-block .menu-panel {
    padding-top: 8px;
}
.menu-label {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}
.menu-label.spaced {
    margin-top: 8px;
}
.muted-block {
    color: var(--muted);
}

.rail-select,
.nav-rail input,
.nav-rail select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}
.rail-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 700;
    cursor: pointer;
}
.rail-btn.primary {
    border-color: rgba(255, 255, 255, 0.22);
}

.side-actions {
    display: flex;
    gap: 8px;
}
.side-actions.compact {
    gap: 6px;
}

.main-shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: radial-gradient(120% 120% at 40% 30%, rgba(123, 61, 235, 0.08), transparent 50%), transparent;
}

.page {
    padding: 32px;
    max-width: none;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: var(--canvas-fill);
}

.hero {
    background: linear-gradient(160deg, rgba(37, 26, 57, 0.92), rgba(24, 16, 40, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-size: 12px;
    margin: 0 0 6px 0;
}

.hero h1 {
    margin: 0 0 8px;
}

.lede {
    margin: 0;
    color: var(--muted);
}

.panel {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.panel > .panel-body {
    overflow: auto;
}
.panel .panel-body {
    width: 100%;
    height: 100%;
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}
.panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-actions.time-actions {
    margin-left: 0;
    gap: 12px;
    align-items: flex-start;
}
.panel-actions.push-right {
    margin-left: auto;
    justify-content: flex-end;
}
.panel-actions.time-actions label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    color: var(--muted);
}
.panel-actions .small-select {
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.helper {
    color: var(--muted);
    margin: 6px 0 0;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}
.card {
    padding: 16px;
    border-radius: var(--radius);
    background: linear-gradient(150deg, rgba(42, 30, 66, 0.9), rgba(22, 15, 37, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(220px 220px at 80% -10%, rgba(123, 61, 235, 0.2), transparent 60%);
    opacity: 0.8;
}
.card h3 {
    margin: 0 0 6px;
    font-size: 14px;
    color: var(--muted);
}
.card .value {
    font-size: 28px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}
.card .status {
    font-size: 12px;
    color: var(--muted);
    position: relative;
    z-index: 1;
}

.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
}
th,
td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
th {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.layout-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

.flux-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.flux-preview {
    background: linear-gradient(135deg, rgba(77, 54, 112, 0.9), rgba(35, 24, 54, 0.9));
    color: var(--text);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(210, 187, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow-x: auto;
    min-height: 180px;
    font-family: "SFMono-Regular", Consolas, monospace;
    white-space: pre-wrap;
}

.sidebar {
    background: linear-gradient(180deg, rgba(32, 22, 54, 0.95), rgba(18, 12, 34, 0.88));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}
.sidebar-title {
    font-size: 16px;
    font-weight: 700;
}
.sidebar-sub {
    margin: 4px 0 12px;
    color: var(--muted);
    font-size: 12px;
}
.sidebar-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.sidebar-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar input,
.sidebar select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.datasource-list,
.user-list {
    background: var(--panel-soft);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 40px;
}

.datasource-item,
.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.04);
}
.datasource-item .info,
.user-item .info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}
.datasource-item .type,
.user-item .type {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.datasource-actions {
    display: flex;
    gap: 6px;
}

.permissions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
    font-size: 12px;
    color: var(--muted);
}
.permissions label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-weight: 600;
    color: var(--text);
}
.permissions input[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}
.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 24px;
}
.pill {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.monitoring-grid {
    width: 100%;
}

.panel-canvas {
    position: relative;
    min-height: 0;
    min-width: 0;
    width: 100%;
    min-height: calc(100vh - 220px);
    height: auto;
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
    background: var(--canvas-fill);
    overflow: visible;
    backdrop-filter: blur(4px);
}

.panel-stage {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
}

.dash-panel {
    position: absolute;
    background: linear-gradient(165deg, rgba(15, 31, 68, 0.92), rgba(52, 36, 78, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    padding: 10px;
    color: var(--text);
    min-width: 240px;
    min-height: 160px;
    overflow: hidden;
}

.panel-canvas.edit-mode .dash-panel {
    outline: 1px dashed rgba(255, 255, 255, 0.22);
    outline-offset: -1px;
    overflow: visible;
}

.panel-canvas.edit-mode .dash-panel::after {
    content: "";
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 1px solid rgba(0, 0, 0, 0.85);
    border-radius: 12px;
    pointer-events: none;
}

.panel-canvas.edit-mode .dash-panel {
    box-shadow:
        0 0 0 5px rgba(0, 0, 0, 0.6),
        0 18px 40px rgba(0, 0, 0, 0.35);
}
.dash-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 700;
    margin-bottom: 6px;
}
.dash-panel header.hidden-title {
    margin: 0;
    padding: 0;
    min-height: 0;
}
.dash-panel .actions {
    display: flex;
    gap: 6px;
}
.dash-panel .body {
    height: calc(100% - 28px);
    overflow: hidden;
    container-type: size;
}
.dash-panel .body.no-header {
    height: 100%;
}
.dash-panel .placeholder {
    color: var(--muted);
}
.gauge-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    height: 100%;
}
.gauge-container canvas {
    width: 100% !important;
    height: 100% !important;
}
.gauge-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-align: center;
    pointer-events: none;
    gap: 6px;
    padding-bottom: 18px;
}
.gauge-host {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #e6e4f5;
}
.gauge-value {
    font-size: 32px;
    font-weight: 800;
    color: #ffffff;
}
.multi-gauge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    height: 100%;
    min-height: 0;
    align-content: stretch;
    grid-auto-rows: minmax(0, 1fr);
}
.multi-gauge-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.multi-gauge-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}
.gauge-mini {
    height: 100%;
    flex: 1;
    min-height: 0;
}
.gauge-mini .gauge-value {
    font-size: clamp(18px, 3cqh, 24px);
}
.metric-container {
    display: flex;
    align-items: center;
    justify-content: center;
}
.text-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    height: 100%;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    padding: 12px;
    line-height: 1.4;
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    grid-auto-rows: 1fr;
}
.stat-tile {
    background: linear-gradient(145deg, rgba(123, 61, 235, 0.12), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 12px;
    color: #f5f5ff;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-height: 120px;
}
.stat-tile .stat-name {
    font-size: clamp(10px, 1.6cqw, 14px);
    font-weight: 700;
    margin: 0;
    color: #e6e4f5;
    min-height: 2.4em;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    text-align: center;
}
.stat-tile .stat-value {
    font-size: clamp(16px, 2.4vw, 22px);
    font-weight: 800;
    margin-top: auto;
}

@container (max-width: 520px) {
    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 8px;
    }
    .stat-tile {
        padding: 10px 8px;
        min-height: 96px;
    }
}

@container (max-height: 360px) {
    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 6px;
    }
    .stat-tile {
        padding: 8px;
        min-height: 84px;
    }
}
.stat-tile.running .stat-value {
    color: #37d96f;
}
.stat-tile.stopped .stat-value {
    color: #ff8a80;
}
.stat-tile.stopped .stat-value {
    color: #ff6b6b;
}
.stat-tile.unknown .stat-value {
    color: #aab5c7;
}
.stat-tile.metric .stat-value {
    color: #f6c344;
}
.stat-tile.metric {
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    width: 100%;
}
.stat-tile .metric-value {
    font-size: 48px;
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
    width: 100%;
    color: #fff;
}
.stat-tile .metric-name {
    text-transform: uppercase;
    letter-spacing: 1.4px;
    font-size: 14px;
    text-align: center;
    color: #f1ecff;
}

.metric-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px;
    background: linear-gradient(145deg, rgba(123, 61, 235, 0.16), rgba(34, 195, 200, 0.12));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    width: 100%;
    height: 100%;
    flex: 1;
}
.metric-panel.metric-center {
    align-items: center;
    text-align: center;
    justify-content: center;
}
.metric-panel .metric-value {
    font-size: 44px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.metric-panel .metric-label {
    font-size: 14px;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.metric-panel .metric-meta {
    font-size: 12px;
    color: #cfd2dd;
    opacity: 0.7;
}

.table-panel {
    width: 100%;
    overflow: auto;
}
.table-panel table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
    font-size: 13px;
}
.table-panel th,
.table-panel td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.table-panel th {
    text-align: left;
    color: var(--muted);
}
.table-panel td {
    white-space: nowrap;
}
.table-panel td:nth-child(2) {
    white-space: normal;
}

.resize-handle {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 12px;
    height: 12px;
    border-right: 2px solid rgba(255, 255, 255, 0.3);
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal-overlay.hidden {
    display: none;
}
.modal-overlay#userModal {
    justify-content: center;
    align-items: center;
    padding: 0 16px;
}
.side-modal {
    margin: 0 auto;
    width: min(620px, 96vw);
}
.modal {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: var(--shadow);
    width: min(720px, 92vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}
.modal-header,
.modal-footer {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    justify-content: space-between;
}
.modal-body {
    padding: 16px 18px;
    overflow-y: auto;
}
.modal-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.modal-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
}
.modal-grid input,
.modal-grid select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}
.modal-grid textarea {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    min-height: 160px;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    font-family: "Space Grotesk", "Segoe UI", monospace;
}

.user-modal-layout {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 12px;
    align-items: start;
}
.user-list-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.modal-footer .spacer {
    flex: 1;
}
.modal-status {
    margin-top: 10px;
    font-size: 13px;
    color: var(--muted);
}
.modal-status.success {
    color: var(--success);
}
.modal-status.error {
    color: var(--danger);
}

.panel-modal {
    z-index: 101;
}

.panel-modal .modal {
    width: min(520px, 90vw);
}

.panel-modal .modal-grid {
    grid-template-columns: 1fr;
}

.panel-canvas .placeholder {
    color: var(--muted);
    padding: 12px;
}
.placeholder.no-alerts {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 700;
    padding: 24px;
    min-height: 160px;
}
.placeholder-inline {
    text-align: center;
    font-weight: 700;
}

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

.input-error {
    border-color: #ff8a80 !important;
    box-shadow: 0 0 0 1px rgba(255, 138, 128, 0.35);
}

/* Login layout */
.login-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(120% 120% at 50% 0%, rgba(104, 65, 214, 0.28), transparent),
        radial-gradient(110% 110% at 20% 35%, rgba(82, 53, 156, 0.2), transparent),
        linear-gradient(180deg, #120a26 0%, #0a0518 55%, #070314 100%);
    color: #f5f1ff;
    font-family: "Space Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
    padding: 40px 16px 60px;
    overflow: hidden;
}

.login-shell {
    width: 100%;
    max-width: 1240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.login-banner {
    width: min(900px, 100%);
    text-align: center;
    padding: 12px 16px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
    color: #d5cee9;
    font-weight: 600;
}

.login-title {
    margin: 0;
    font-size: 26px;
    letter-spacing: 0.02em;
    text-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}

.login-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(360px, 1fr));
    gap: 18px;
    width: 100%;
    justify-items: stretch;
}

.login-card {
    background: linear-gradient(165deg, rgba(25, 16, 45, 0.92), rgba(16, 10, 32, 0.9));
    border: 1px solid rgba(161, 120, 255, 0.2);
    border-radius: 14px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05), 0 0 60px rgba(123, 77, 255, 0.14);
    padding: 18px 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 290px;
    position: relative;
}

.login-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(220px 180px at 20% 20%, rgba(123, 77, 255, 0.12), transparent 60%);
    opacity: 0.9;
    pointer-events: none;
}

.login-card-right::before {
    background: radial-gradient(260px 200px at 70% 10%, rgba(123, 77, 255, 0.16), transparent 60%);
}

.login-pill {
    align-self: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f5f1ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    position: relative;
    z-index: 1;
}

.login-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.login-card-title {
    font-size: 18px;
    font-weight: 700;
}

.login-role {
    display: flex;
    gap: 12px;
    color: #d5cee9;
    font-size: 13px;
}

.login-role input {
    accent-color: #b17cff;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #d5cee9;
    font-size: 12px;
}

.login-form input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #f8f4ff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.login-button {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #f8f4ff;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.login-button.primary {
    background: linear-gradient(135deg, #9f6bff, #7c4dff);
    border: 1px solid rgba(161, 120, 255, 0.6);
    box-shadow: 0 10px 30px rgba(126, 79, 255, 0.35);
}

.login-button.ghost {
    background: rgba(255, 255, 255, 0.05);
}

.login-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-button:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.25);
}

.login-sub,
.login-note {
    margin: 0;
    color: #d5cee9;
    font-size: 13px;
    position: relative;
    z-index: 1;
    text-align: center;
}

.login-note {
    font-size: 12px;
}

.login-error {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.35);
    color: #ffb4aa;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

@media (max-width: 1100px) {
    .chrome {
        grid-template-columns: 1fr;
    }
    .nav-rail {
        position: relative;
        height: auto;
    }
}

@media (max-width: 900px) {
    .page {
        padding: 20px;
    }
    .layout-grid {
        grid-template-columns: 1fr;
    }
    .login-columns {
        grid-template-columns: 1fr;
    }
    .chrome {
        max-width: 100%;
    }
}
