body {
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    color: #1f2937;
    background: #f3f6fb;
}

.app-body {
    min-height: 100vh;
    overflow-x: hidden;
}

/* Public / setup / login */
.setup-wrapper,
.auth-wrapper {
    background:
        radial-gradient(circle at top left, rgba(30, 64, 175, 0.12), transparent 35%),
        radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.10), transparent 30%),
        linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
}

.setup-left-panel,
.auth-left-panel {
    background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 100%);
}

.setup-badge,
.auth-badge {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.card {
    border-radius: 24px !important;
}

.form-control-lg {
    min-height: 52px;
    border-radius: 12px;
}

.btn-primary {
    min-height: 52px;
    border-radius: 12px !important;
    background: #1d4ed8;
    border-color: #1d4ed8;
    font-weight: 600;
}

.btn-primary:hover {
    background: #1e40af;
    border-color: #1e40af;
}

/* Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 1025;
}

/* App layout */
.app-sidebar {
    width: 260px;
    min-height: 100vh;
    position: fixed;
    inset: 0 auto 0 0;
    background: var(--sidebar-bg);
    color: #cbd5e1;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.08);
    transition: width 0.25s ease, transform 0.25s ease;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 20px 20px 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 84px;
    display: flex;
    align-items: center;
}

.sidebar-brand a {
    color: #ffffff;
    text-decoration: none;
    width: 100%;
}

.sidebar-brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.10) 100%);
    color: #ffffff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-brand-image {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.10);
    padding: 4px;
}

.sidebar-brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.sidebar-brand-subtitle {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.70);
    white-space: nowrap;
}

.sidebar-nav {
    padding: 16px 14px;
    flex: 1;
}

.sidebar-section-title {
    color: rgba(255, 255, 255, 0.40);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 10px 12px 8px 12px;
    white-space: nowrap;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 6px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.sidebar-link i {
    font-size: 1rem;
    width: 18px;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer-box {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px;
}

.app-main {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}

.app-navbar {
    min-height: 72px;
    background: var(--topbar-bg);
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1020;
    gap: 16px;
}

.app-navbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.navbar-brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.navbar-brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.85);
    padding: 4px;
    flex-shrink: 0;
}

.sidebar-toggle-btn {
    width: 44px;
    height: 44px;
    border: 1px solid #dbe3ee;
    background: #ffffff;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
    font-size: 1.35rem;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.app-navbar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.1;
}

.app-navbar-subtitle {
    font-size: 0.86rem;
    color: #64748b;
}

.app-navbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 8px 14px;
    color: #0f172a;
    font-weight: 600;
}

.app-content {
    padding: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    margin-bottom: 4px;
    font-size: 1.65rem;
    font-weight: 700;
    color: #0f172a;
}

.page-subtitle {
    color: #64748b;
    margin-bottom: 0;
}

.dashboard-meta-chip,
.dashboard-refresh-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border-radius: 999px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #334155;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.metric-card {
    position: relative;
    height: 100%;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.metric-card::after {
    content: "";
    position: absolute;
    inset: auto -30px -30px auto;
    width: 120px;
    height: 120px;
    border-radius: 999px;
    opacity: 0.08;
}

.metric-card-cpu::after {
    background: #2563eb;
}

.metric-card-ram::after {
    background: #7c3aed;
}

.metric-card-disk::after {
    background: #ea580c;
}

.metric-card-network::after {
    background: #059669;
}

.metric-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    font-size: 1.35rem;
    color: #0f172a;
}

.metric-title {
    font-size: 0.95rem;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 600;
}

.metric-value {
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 8px;
}

.network-main-value {
    font-size: 1.45rem;
}

.metric-subtext {
    color: #64748b;
    font-size: 0.92rem;
    min-height: 44px;
}

.metric-progress {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #e5e7eb;
}

.metric-progress .progress-bar {
    border-radius: 999px;
}

.metric-card-cpu .progress-bar {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}

.metric-card-ram .progress-bar {
    background: linear-gradient(90deg, #8b5cf6, #6d28d9);
}

.metric-card-disk .progress-bar {
    background: linear-gradient(90deg, #f97316, #ea580c);
}

.metric-badge,
.summary-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-good {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.14);
}

.badge-normal {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.14);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.14);
}

.badge-critical {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.14);
}

.badge-neutral {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
    border-color: rgba(100, 116, 139, 0.14);
}

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

.network-mini-box {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px;
}

.network-mini-box .label {
    display: block;
    color: #64748b;
    font-size: 0.82rem;
    margin-bottom: 4px;
}

.network-mini-box strong {
    font-size: 1rem;
    color: #0f172a;
}

.content-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.content-card h5 {
    font-weight: 700;
    color: #0f172a;
}

.small-stat-card {
    height: 100%;
}

.small-stat-label {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.small-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 8px;
    word-break: break-word;
}

.small-stat-subtext {
    color: #64748b;
    font-size: 0.9rem;
}

.chart-card {
    height: 100%;
}

.chart-card-header {
    margin-bottom: 16px;
}

.chart-wrap {
    position: relative;
    height: 260px;
}

.dashboard-summary-table thead th {
    color: #64748b;
    font-size: 0.84rem;
    font-weight: 700;
    border-bottom-width: 1px;
}

.dashboard-summary-table tbody td {
    vertical-align: middle;
    border-color: #edf2f7;
    color: #334155;
}

.dashboard-system-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dashboard-system-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
}

.dashboard-system-item .label {
    color: #64748b;
    font-size: 0.9rem;
}

/* Settings */
.settings-page-card {
    padding: 28px;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.settings-tabs {
    gap: 10px;
    flex-wrap: wrap;
}

.settings-tabs .nav-link {
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

.settings-tabs .nav-link.active {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    color: #ffffff;
    border-color: #1d4ed8;
    box-shadow: 0 10px 24px rgba(29, 78, 216, 0.18);
}

.settings-section-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 22px;
    height: 100%;
}

.settings-section-header {
    margin-bottom: 18px;
}

.settings-section-header h5 {
    margin-bottom: 6px;
    font-weight: 700;
    color: #0f172a;
}

.settings-section-header p {
    margin-bottom: 0;
    color: #64748b;
}

.settings-placeholder-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-placeholder-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

.settings-side-info-card {
    background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 100%);
    color: #ffffff;
    border-radius: 18px;
    padding: 24px;
    height: 100%;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

.settings-side-info-card h6 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.settings-side-info-card p {
    color: rgba(255, 255, 255, 0.82);
}

.settings-info-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    font-size: 1.35rem;
    margin-bottom: 16px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.status-badge.planned {
    background: rgba(59, 130, 246, 0.10);
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.16);
}

.status-badge.next {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.16);
}

.settings-toggle-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.settings-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    cursor: pointer;
}

.settings-toggle-title {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.settings-toggle-desc {
    color: #64748b;
    font-size: 0.92rem;
}

.settings-toggle-item .form-check-input {
    width: 3rem;
    height: 1.5rem;
    cursor: pointer;
}

.settings-color-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-color-input {
    width: 64px;
    min-width: 64px;
    height: 48px;
    padding: 4px;
    border-radius: 12px;
    cursor: pointer;
}

.settings-color-text {
    min-height: 48px;
    border-radius: 12px;
    background: #ffffff;
}

.appearance-preview-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 18px;
}

.appearance-preview-header {
    margin-bottom: 16px;
}

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

.appearance-preview-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
}

.appearance-preview-item .label {
    display: block;
    color: #64748b;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.appearance-color-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.appearance-color-box {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    flex-shrink: 0;
}

.appearance-logo-item {
    grid-column: 1 / -1;
}

.appearance-logo-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    padding: 12px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

.appearance-logo-preview img {
    max-height: 48px;
    max-width: 220px;
    object-fit: contain;
}

/* Desktop collapsed */
body.sidebar-collapsed .app-sidebar {
    width: 86px;
}

body.sidebar-collapsed .app-main {
    margin-left: 86px;
}

body.sidebar-collapsed .sidebar-brand-title,
body.sidebar-collapsed .sidebar-brand-subtitle,
body.sidebar-collapsed .sidebar-section-title,
body.sidebar-collapsed .sidebar-link span,
body.sidebar-collapsed .sidebar-footer {
    display: none;
}

body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding-left: 12px;
    padding-right: 12px;
}

body.sidebar-collapsed .sidebar-brand-logo {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-nav {
    padding-left: 10px;
    padding-right: 10px;
}

body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding-left: 12px;
    padding-right: 12px;
}

body.sidebar-collapsed .sidebar-link i {
    margin-right: 0;
}

/* Mobile / tablet */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: 260px;
        min-height: 100vh;
        position: fixed;
    }

    .app-main {
        margin-left: 0;
    }

    .app-navbar {
        padding: 12px 16px;
        min-height: 72px;
        height: auto;
        flex-wrap: wrap;
    }

    .app-navbar-right {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
    }

    .app-content {
        padding: 16px;
    }

    .settings-page-card {
        padding: 18px;
    }

    body.sidebar-mobile-open .app-sidebar {
        transform: translateX(0);
    }

    body.sidebar-mobile-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 767.98px) {
    .metric-value {
        font-size: 1.7rem;
    }

    .network-main-value {
        font-size: 1.2rem;
    }

    .network-mini-stats {
        grid-template-columns: 1fr;
    }

    .dashboard-system-item,
    .settings-placeholder-item,
    .settings-toggle-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .small-stat-value {
        font-size: 1.25rem;
    }

    .chart-wrap {
        height: 220px;
    }

    .user-chip {
        width: 100%;
        justify-content: center;
    }

    .app-navbar-right .btn {
        width: 100%;
    }

    .settings-tabs .nav-link {
        width: 100%;
        justify-content: flex-start;
        text-align: left;
    }

    .settings-color-input-wrap {
        flex-direction: column;
        align-items: flex-start;
    }

    .appearance-preview-grid {
        grid-template-columns: 1fr;
    }

    .navbar-brand-block {
        min-width: 0;
    }
}

.settings-readonly-box {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #334155;
    font-weight: 600;
    word-break: break-all;
}

.settings-file-status-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 18px;
}

.settings-file-status-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid #eef2f7;
}

.settings-file-status-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.settings-file-status-row .label {
    color: #64748b;
    font-size: 0.9rem;
    min-width: 110px;
}

.settings-file-path {
    max-width: 100%;
    color: #334155;
    font-weight: 600;
    word-break: break-all;
    text-align: right;
}
.settings-file-status-row {
    flex-direction: column;
    align-items: flex-start;
}

.settings-file-path {
    text-align: left;
}
