:root {
    --header-height: 48px;
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 56px;
    --modern-bg: #11111d;
    --card-bg: #1e1e2d;
    --border-color: rgba(255, 255, 255, 0.08);
    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-info: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    --page-background: radial-gradient(circle at 10% 10%, rgba(79, 70, 229, 0.08), transparent 45%),
    radial-gradient(circle at 90% 0%, rgba(6, 182, 212, 0.08), transparent 40%),
    #0f0f17;
    --table-surface: rgba(18, 18, 28, 0.92);
    --table-border: rgba(255, 255, 255, 0.08);
    --table-header-bg: rgba(22, 22, 36, 0.95);
    --table-filter-bg: rgba(16, 16, 26, 0.9);
    --table-row-bg: rgba(15, 15, 24, 0.7);
    --table-row-alt-bg: rgba(20, 20, 32, 0.75);
    --table-row-hover: rgba(255, 255, 255, 0.04);
    --rz-primary: #4f46e5;
    --rz-secondary: #64748b;
    --rz-success: #10b981;
    --rz-warning: #f59e0b;
    --rz-danger: #ef4444;
    --rz-info: #06b6d4;
    --rz-base-background-color: var(--modern-bg);
    --rz-body-background-color: var(--modern-bg);
    --rz-border-color: var(--border-color);
    --rz-text-color: rgba(255, 255, 255, 0.88);
    --rz-panel-menu-item-selected-background-color: rgba(79, 70, 229, 0.15);
    --rz-panel-menu-item-selected-color: #a5b4fc;
}

html, body, #app {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Manrope", "Segoe UI", system-ui, sans-serif;
    background: var(--page-background);
    color: rgba(255, 255, 255, 0.88);
}

h1, h2, h3, .app-title {
    font-family: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
}

.app-loading {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 20%, rgba(79, 70, 229, 0.2), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(6, 182, 212, 0.15), transparent 40%),
    var(--modern-bg);
}

.app-loading-card {
    background: rgba(30, 30, 45, 0.9);
    border: 1px solid var(--border-color);
    padding: 24px 32px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.app-loading-spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: #4f46e5;
    animation: spin 1s linear infinite;
}

.app-loading-title {
    font-weight: 600;
    letter-spacing: 0.02em;
}

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

.header-modern {
    background: rgba(30, 30, 45, 0.98) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color) !important;
    z-index: 1001;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2) !important;
    height: var(--header-height) !important;
}

.sidebar-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--sidebar-collapsed-width);
    height: var(--header-height);
    border-right: 1px solid var(--border-color);
}

.header-brand-container {
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-container {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.app-title {
    font-weight: 700 !important;
    color: #fff !important;
    font-size: 1.1rem !important;
    margin: 0 !important;
    letter-spacing: -0.01em;
}

.user-profile-container {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px 4px 6px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

.user-name {
    color: white !important;
    font-weight: 600 !important;
    margin: 0 !important;
    font-size: 0.8rem !important;
}

.user-email {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 0.65rem !important;
    margin: 0 !important;
}

.header-action-btn {
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.8) !important;
}

.sidebar-modern {
    background: linear-gradient(180deg, rgba(17, 17, 29, 0.98) 0%, rgba(14, 14, 24, 0.98) 100%) !important;
    border-right: 1px solid var(--border-color) !important;
    width: var(--sidebar-width) !important;
    height: calc(100vh - var(--header-height)) !important;
    position: fixed !important;
    top: var(--header-height) !important;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.rz-layout {
    min-height: 100vh;
    background: transparent;
}

.rz-body {
    padding: 0 !important;
    background: transparent !important;
}

.rz-sidebar:not(.rz-sidebar-expanded) {
    width: 0 !important;
    transform: translateX(-100%) !important;
}

.page-content-wrapper {
    background: var(--page-background);
    min-height: calc(100vh - var(--header-height));
}

.page-content {
    padding: 1.5rem;
    max-width: 1920px;
    margin: 0 auto;
}

.body-expanded {
    padding-left: var(--sidebar-width) !important;
}

.body-collapsed {
    padding-left: 0 !important;
}

.header-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.modern-panel-menu {
    background: transparent !important;
    border: none !important;
}

.menu-item-modern {
    margin: 2px 8px !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
}

.menu-item-modern .rz-navigation-item-link {
    padding: 8px 12px !important;
    min-height: 36px !important;
}

.menu-item-modern .rz-navigation-item-icon {
    font-size: 1.25rem !important;
    margin-right: 12px !important;
}

.menu-item-modern .rz-navigation-item-text {
    font-size: 0.85rem !important;
    font-weight: 500 !important;
}

.nav-section-header {
    padding: 12px 20px 4px 20px;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-scroll {
    flex: 1;
    overflow: auto;
    padding-bottom: 12px;
}

.sidebar-footer {
    padding: 12px 10px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.system-status-card {
    margin: 0 0 4px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

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

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
}

.status-name {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    flex-grow: 1;
}

.status-latency {
    font-size: 10px;
    font-family: monospace;
    color: rgba(255, 255, 255, 0.4);
}

.unified-footer-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.footer-pill-text {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.status-dot.offline {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.header-icon-container {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.18), rgba(6, 182, 212, 0.12));
    border-radius: 14px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.section-card {
    border-radius: 16px;
    background: #1e1e2d;
    border: 1px solid #2b2b40;
    padding: 1.5rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.metric-card-modern {
    border-radius: 16px;
    transition: transform 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.metric-card-modern:hover {
    transform: translateY(-4px);
}

.stat-primary {
    background: var(--gradient-primary);
    color: white;
}

.stat-warning {
    background: var(--gradient-warning);
    color: white;
}

.stat-success {
    background: var(--gradient-success);
    color: white;
}

.stat-info {
    background: var(--gradient-info);
    color: white;
}

.stat-danger {
    background: var(--gradient-danger);
    color: white;
}

.stat-icon-bg {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 8px;
}

.info-card-modern {
    border-radius: 12px;
    padding: 1rem !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.group-info {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(6, 182, 212, 0.05) 100%);
}

.host-info {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(79, 70, 229, 0.05) 100%);
}

.info-icon-container {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
}

.info-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 2px;
}

.info-value {
    font-weight: 700;
    color: #fff;
}

.info-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.75rem 0;
}

.info-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    line-height: 1.5;
}

.modern-grid {
    --rz-grid-header-background-color: #1a1a2e;
    --rz-grid-header-color: rgba(255, 255, 255, 0.7);
    --rz-grid-cell-color: rgba(255, 255, 255, 0.85);
    --rz-grid-hover-background-color: rgba(255, 255, 255, 0.03);
    --rz-grid-selected-background-color: rgba(79, 70, 229, 0.1);
    background-color: var(--table-surface) !important;
    border: 1px solid var(--table-border) !important;
    border-radius: 16px !important;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.modern-grid .rz-datatable-thead th {
    background: var(--table-header-bg) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 10px 14px !important;
    font-size: 11px !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    vertical-align: middle;
}

.modern-grid .rz-datatable-filter-row th {
    background: var(--table-filter-bg) !important;
    padding: 8px 12px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.modern-grid .rz-datatable-filter-row input,
.modern-grid .rz-datatable-filter-row .rz-inputtext,
.modern-grid .rz-datatable-filter-row .rz-dropdown,
.modern-grid .rz-datatable-filter-row .rz-numeric,
.modern-grid .rz-datatable-filter-row .rz-datepicker {
    width: 100%;
    background: rgba(10, 10, 18, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 10px !important;
    color: rgba(255, 255, 255, 0.85) !important;
    padding: 6px 10px !important;
    font-size: 0.8rem;
}

.modern-grid .rz-datatable-filter-row ::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.modern-grid .rz-datatable-data td {
    padding: 8px 14px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    background: transparent;
    vertical-align: middle;
}

.modern-grid .rz-datatable-data td .rz-cell-data:has(.rz-button),
.modern-grid .rz-datatable-data td .rz-cell-data:has(.rz-switch) {
    display: inline-flex;
    align-items: center;
}

.modern-grid .rz-datatable-data td .rz-button.rz-button-sm {
    min-height: 28px;
}

.modern-grid .rz-datatable-data td .rz-button.rz-button-sm.rz-button-icon-only {
    width: 28px;
    height: 28px;
}

.modern-grid .rz-datatable-data tr {
    background: var(--table-row-bg);
}

.modern-grid .rz-datatable-data tr:nth-child(even) {
    background: var(--table-row-alt-bg);
}

.modern-grid .rz-datatable-data tr:hover {
    background: var(--table-row-hover);
}

.modern-grid .rz-paginator {
    background: rgba(15, 15, 24, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 10px 14px;
}

.modern-grid .rz-paginator .rz-paginator-pages button {
    border-radius: 8px;
}

.loading-shimmer {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: loading-shimmer-animation 1.5s infinite linear;
}

@keyframes loading-shimmer-animation {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes pulse-soft {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.result-wrapper {
    padding: 2rem 0;
}

.result-icon {
    font-size: 3.5rem;
}

.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.12), transparent 45%),
    radial-gradient(circle at 80% 30%, rgba(6, 182, 212, 0.12), transparent 40%),
    var(--modern-bg);
}

.auth-card {
    width: min(420px, 92vw);
    background: rgba(30, 30, 45, 0.96);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
}

.auth-card-section {
    padding: 1.5rem;
}

.auth-card-title {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-footer {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

.state-badge {
    font-size: 0.7rem;
    padding: 2px 8px !important;
}

.dialog-surface {
    position: relative;
}

.dialog-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 23, 0.7);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
