/* ==================== PROXMOX DASHBOARD CSS v2 ==================== */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #0f1525;
    --bg-card: rgba(15, 20, 40, 0.85);
    --bg-sidebar: #0d1220;
    --bg-header: rgba(13, 18, 32, 0.95);
    --bg-input: rgba(30, 41, 59, 0.8);
    --border: rgba(71, 85, 105, 0.3);
    --border-light: rgba(71, 85, 105, 0.15);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #475569;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --purple: #8b5cf6;
    --cyan: #06b6d4;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.4);
    border-radius: 3px;
}

::selection {
    background: rgba(59, 130, 246, 0.3);
}

/* ==================== LOADING ==================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    margin-bottom: 24px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.loading-bar {
    width: 200px;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin: 16px auto;
}

.loading-bar-fill {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    border-radius: 2px;
    animation: loadSlide 1.2s ease-in-out infinite;
}

@keyframes loadSlide {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(350%);
    }
}

.loading-content p {
    color: var(--text-muted);
    font-size: 13px;
}

/* ==================== LAYOUT ==================== */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-header {
    height: 56px;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    z-index: 100;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo i {
    font-size: 20px;
    color: var(--accent);
}

.header-logo span {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.header-center {
    flex: 1;
    max-width: 480px;
    margin: 0 auto;
}

.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.search-box input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 360px;
    overflow-y: auto;
    display: none;
    z-index: 200;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.search-results.show {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition);
}

.search-result-item:hover {
    background: rgba(59, 130, 246, 0.08);
}

.type-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
    flex-shrink: 0;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.build-badge {
    font-size: 11px;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    padding: 4px 8px;
    line-height: 1;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.server-count {
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(59, 130, 246, 0.1);
    padding: 5px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.server-count i {
    color: var(--accent);
}

.header-status-badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.header-status-badge.pve {
    border-color: rgba(59, 130, 246, 0.35);
    color: #93c5fd;
}

.header-status-badge.pbs {
    border-color: rgba(245, 158, 11, 0.35);
    color: #fcd34d;
}

.header-user {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 13px;
}

.header-user:hover {
    background: rgba(255, 255, 255, 0.05);
}

.header-user i {
    font-size: 20px;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-width: 160px;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 200;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: var(--transition);
}

.user-dropdown a:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
    flex-shrink: 0;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

.sidebar-section {
    padding: 8px;
}

.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent);
}

.sidebar-item i {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-item.child {
    padding-left: 42px;
    font-size: 12px;
}

.sidebar-server-group {
    margin-bottom: 4px;
}

.sidebar-server-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    margin: 4px 8px;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-server-header:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.sidebar-server-header.online {
    color: var(--text-primary);
    border-left: 2px solid var(--success);
}

.sidebar-server-header.offline {
    color: var(--text-muted);
    border-left: 2px solid var(--text-muted);
}

.server-type-pill {
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.server-type-pill.proxmox {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.18);
}

.server-type-pill.pbs {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.18);
}


.sidebar-chevron {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    width: 12px;
    text-align: center;
}

.sidebar-server-nodes {
    padding-left: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-left: auto;
    flex-shrink: 0;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.status-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.status-badge.stopped {
    color: var(--text-muted);
    background: rgba(71, 85, 105, 0.1);
    border: 1px solid var(--border-light);
}

.status-badge.running {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg-primary);
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 i {
    color: var(--accent);
    font-size: 20px;
}

.page-actions {
    display: flex;
    gap: 8px;
}

.health-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 4px;
}

.health-tab-btn {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.health-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.health-tab-btn.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.45);
}

.health-panel {
    display: none;
}

.health-panel.active {
    display: block;
}

.settings-subnav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
    padding: 4px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
}

.settings-tab-btn {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    border-radius: 7px;
    padding: 7px 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.settings-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.settings-tab-btn.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.45);
}

.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
}

.settings-switch {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    margin: 0 !important;
    color: var(--text-primary);
    cursor: pointer;
}

.settings-switch input {
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    accent-color: var(--accent);
}

.settings-alert-help {
    margin: -2px 0 12px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.settings-field-note {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 11px;
}

.settings-multi-select {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #10182c;
    overflow: hidden;
}

.settings-multi-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
}

#pwSelectedSummary {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

#pwSelectedMeta {
    color: var(--text-muted);
    font-size: 12px;
    text-align: right;
}

.settings-multi-dropdown {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    z-index: 1;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: block;
    margin-top: 0;
}

.settings-multi-select.open .settings-multi-dropdown {
    display: block;
}

.settings-multi-select.fixed-open .settings-multi-dropdown {
    display: block;
}

.settings-multi-top {
    padding: 10px;
    border-bottom: 1px solid var(--border-light);
}

.settings-multi-search {
    position: relative;
}

.settings-multi-search i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
}

#page-settings .settings-multi-search input {
    width: 100%;
    padding: 8px 32px 8px 30px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
    font-family: inherit;
}

#page-settings .settings-multi-search input:focus {
    border-color: var(--accent);
}

.settings-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.settings-search-clear:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.settings-multi-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.settings-multi-actions button {
    border: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 4px 9px;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
}

.settings-multi-actions button:hover {
    color: var(--text-primary);
    border-color: rgba(59, 130, 246, 0.45);
}

.settings-server-options {
    max-height: 560px;
    min-height: 300px;
    overflow: auto;
    padding: 8px;
    display: grid;
    gap: 6px;
}

.settings-server-option {
    display: grid;
    grid-template-columns: 16px 1fr;
    gap: 4px 10px;
    align-items: center;
    padding: 8px 9px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    cursor: pointer;
    margin-bottom: 0 !important;
}

#page-settings .form-group .settings-server-option {
    display: grid;
    grid-template-columns: 16px 1fr;
}

.settings-server-option:hover {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.04);
}

.settings-server-option input {
    grid-row: span 2;
    width: 14px !important;
    height: 14px !important;
    min-width: 14px;
    padding: 0 !important;
    margin: 0;
    border: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    appearance: auto;
    accent-color: var(--accent);
}

.settings-server-main {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.settings-server-sub {
    color: var(--text-muted);
    font-size: 11px;
}

.settings-server-empty {
    color: #94a3b8;
    text-align: center;
    padding: 14px 10px;
    font-size: 12px;
    border: 1px dashed var(--border-light);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.45);
}

.settings-selected-chips {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.settings-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.16);
    border: 1px solid rgba(59, 130, 246, 0.34);
    color: #bfdbfe;
    font-size: 11px;
}

#page-settings .form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

#page-settings .form-group input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

#page-settings .form-group input:focus {
    border-color: var(--accent);
}

.profile-overview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.profile-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-size: 12px;
}

.profile-pill b {
    color: var(--text-primary);
    font-weight: 600;
}

.profile-divider {
    border-top: 1px dashed var(--border-light);
    margin: 14px 0;
}

.profile-result {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 12px;
}

.profile-2fa-email-row {
    display: flex;
}

.profile-2fa-email-group {
    width: 100%;
    max-width: 520px;
}

.profile-device-main {
    color: var(--text-primary);
    font-weight: 600;
}

.profile-device-sub {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 2px;
    max-width: 440px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-state-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    font-size: 11px;
    padding: 4px 8px;
    border: 1px solid transparent;
}

.device-state-badge.current {
    color: #22d3ee;
    border-color: rgba(34, 211, 238, 0.45);
    background: rgba(34, 211, 238, 0.14);
}

.device-state-badge.active {
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.16);
}

.device-state-badge.revoked {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.16);
}

.admin-only-settings[style*="display: none"],
.admin-only-settings-panel[style*="display: none"] {
    display: none !important;
}

.profile-2fa-modal {
    max-width: 420px;
}

#profile2faModalHint {
    color: var(--text-secondary);
}

/* ==================== BUTTONS ==================== */
.btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #000;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.action-btns {
    display: flex;
    gap: 4px;
}

.action-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--transition);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.action-btn.start:hover {
    color: var(--success);
    border-color: var(--success);
}

.action-btn.stop:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.action-btn.console:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.action-btn.snapshot:hover {
    color: var(--purple);
    border-color: var(--purple);
}

/* ==================== STATS GRID ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    flex-shrink: 0;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-badge {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 20px;
}

.stat-badge.online,
.stat-badge.running {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* ==================== CHARTS ==================== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 0;
}

.chart-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-header h3 i {
    color: var(--accent);
    font-size: 14px;
}

.chart-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-body {
    padding: 8px 12px 12px;
    height: 160px;
}

.pbs-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    padding: 14px 18px 10px;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.pbs-kpi {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px;
}

.pbs-kpi .k {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    margin-bottom: 6px;
}

.pbs-kpi .v {
    display: block;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.pbs-kpi.kpi-good {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.06);
}

.pbs-kpi.kpi-warn {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.06);
}

.pbs-kpi.kpi-crit {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.08);
}

.pbs-tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 0;
}

.pbs-tables-grid .table-body {
    border-right: 1px solid var(--border-light);
}

.pbs-tables-grid .table-body:last-child {
    border-right: none;
}

/* ==================== TABLES ==================== */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-light);
}

.table-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-header h3 i {
    color: var(--accent);
}

.table-filter select {
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

.table-body {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

tbody td {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

tbody tr:hover {
    background: rgba(59, 130, 246, 0.03);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ==================== BADGES ==================== */
.type-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-badge.node {
    background: rgba(139, 92, 246, 0.15);
    color: var(--purple);
}

.type-badge.qemu {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
}

.type-badge.lxc {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.type-badge.storage-type {
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
}

.status-badge i {
    font-size: 6px;
}

.status-badge.running {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.status-badge.stopped {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.status-badge.warning {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.12);
}

.status-badge.recovery {
    color: var(--success);
    background: rgba(16, 185, 129, 0.12);
}

.status-badge.online {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.server-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
}

.server-label.proxmox {
    color: var(--purple);
    background: rgba(139, 92, 246, 0.08);
}

.server-label.pbs {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.14);
}


.server-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
}

.server-type-badge.proxmox {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.28);
}

.server-type-badge.pbs {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.28);
}


/* ==================== PROGRESS BARS ==================== */
.progress-bar {
    width: 80px;
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-bar-fill.success {
    background: var(--success);
}

.progress-bar-fill.warning {
    background: var(--warning);
}

.progress-bar-fill.danger {
    background: var(--danger);
}

.progress-text {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==================== INFO BAR ==================== */
.node-info-bar,
.vm-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.info-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.chip-label {
    color: var(--text-muted);
}

.chip-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* ==================== VM TABS ==================== */
.vm-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 4px;
    width: fit-content;
}

.tab-btn {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.vm-action-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==================== CONFIG CARD ==================== */
.vm-config-card {
    margin-top: 20px;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1px;
    padding: 16px;
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.config-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
}

.config-value {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    text-align: right;
    word-break: break-all;
    max-width: 60%;
}

/* ==================== CONSOLE ==================== */
.console-container {
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 560px;
    height: auto;
}

.console-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(30, 41, 59, 0.9);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.console-toolbar-left,
.console-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.console-status {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.console-status i {
    font-size: 8px;
}

.console-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.console-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.console-screen {
    position: relative;
    background: #0f172a;
    padding: 0;
    flex: 1;
    min-height: 0;
}

.console-screen .xterm {
    height: 100%;
    min-height: 100%;
}

.console-screen .xterm-viewport {
    overflow-y: auto !important;
}

.console-container:fullscreen .console-screen {
    height: calc(100vh - 50px);
    min-height: 0;
}

.console-container:fullscreen .console-screen .xterm {
    height: calc(100vh - 60px);
    min-height: 0;
}

#page-vm.console-mode .page-header {
    margin-bottom: 12px;
}

#page-vm.console-mode .vm-info-bar {
    display: none;
}

#page-vm.console-mode .vm-tabs {
    margin-bottom: 10px;
}

#page-vm.console-mode .console-container {
    min-height: 680px;
}

.console-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 12px;
    z-index: 5;
}

.console-placeholder i {
    font-size: 48px;
    opacity: 0.3;
}

.console-placeholder p {
    font-size: 13px;
}

/* ==================== STORAGE ==================== */
.storage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.storage-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
}

.storage-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.storage-icon {
    width: 42px;
    height: 42px;
    background: rgba(6, 182, 212, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cyan);
    font-size: 18px;
}

.storage-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.storage-type-label {
    font-size: 11px;
    color: var(--text-muted);
}

.storage-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.storage-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s, background 0.3s;
}

.storage-progress-fill.success {
    background: linear-gradient(90deg, #10b981, #22c55e);
}

.storage-progress-fill.warning {
    background: linear-gradient(90deg, #f59e0b, #f97316);
}

.storage-progress-fill.danger {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.storage-details {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.storage-percent.success {
    color: var(--success);
}

.storage-percent.warning {
    color: var(--warning);
}

.storage-percent.danger {
    color: var(--danger);
}

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    color: var(--accent);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.modal-body {
    padding: 20px 24px;
}

.modal-body .form-group {
    margin-bottom: 16px;
}

.modal-body .form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 6px;
}

.modal-body .form-group input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.modal-body .form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.modal-body .form-group input::placeholder {
    color: var(--text-muted);
}

.form-row {
    margin-bottom: 0;
}

.form-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
}

/* ==================== NOTIFICATIONS ==================== */
.notifications {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: notifIn 0.3s ease;
    min-width: 260px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.notification.info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.notification.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.notification.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.notification.removing {
    animation: notifOut 0.3s ease forwards;
}

@keyframes notifIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes notifOut {
    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 56px;
        height: calc(100vh - 56px);
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }

    .header-center {
        display: none;
    }

    .header-info {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 16px;
    }

    .console-container {
        height: calc(100vh - 240px);
        min-height: 420px;
    }

    #page-vm.console-mode .console-container {
        min-height: 420px;
    }
}
