/* =========================================================
   Management Center Portal Core Design System
   ========================================================= */

/* SweetAlert2 ต้องอยู่เหนือ modal สมัครสมาชิก (z-index 100010) เสมอ */
.swal2-container { z-index: 100050 !important; }

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@300;400;500;600;700;800;900&family=Noto+Sans+Thai:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #080d19;
    --bg-secondary: #0d1527;
    --card-bg: rgba(17, 25, 46, 0.45);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;   /* bumped จาก #94a3b8 — body/label ผ่าน WCAG AA */
    --text-muted: #aab6c8;       /* bumped จาก #64748b (~3.8:1 ตก) → ~7:1 ผ่าน AA (ตรงกับ DOC token) */
    
    /* Premium Brand Colors */
    --primary: #8b5cf6;       /* Violet */
    --primary-glow: rgba(139, 92, 246, 0.25);
    --accent: #06b6d4;        /* Cyan */
    --accent-glow: rgba(6, 182, 208, 0.25);
    --success: #10b981;       /* Emerald */
    --warning: #f59e0b;       /* Amber */
    
    /* Motion */
    --ease-out-cubic: cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-smooth: all 0.35s var(--ease-out-cubic);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', 'Inter', 'Noto Sans Thai', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Background Gradients & Ambient Glows */
.ambient-glow {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(120px);
    opacity: 0.15;
}

.glow-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.glow-2 {
    width: 500px;
    height: 500px;
    background: var(--accent);
    bottom: -150px;
    right: -100px;
}

/* =========================================================
   LOGIN SCREEN LAYOUT
   ========================================================= */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    z-index: 1;
    background: radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.06) 0%, transparent 40%), radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 40%);
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 28px;
    width: 100%;
    max-width: 1060px;
    min-height: 620px;
    display: flex;
    flex-direction: row;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    animation: slideUp 0.6s var(--ease-out-cubic) both;
}

/* Left Column: Branding and Features */
.login-left-pane {
    flex: 1.15;
    padding: 3.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
    position: relative;
    background: radial-gradient(circle at 0% 0%, rgba(16, 185, 129, 0.07) 0%, transparent 55%), radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.04) 0%, transparent 55%);
}

.branding-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.branding-logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.45rem;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.branding-info {
    display: flex;
    flex-direction: column;
}

.branding-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: var(--text-primary);
}

.branding-subtitle {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.system-slogan {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.4;
    color: var(--text-primary);
    margin-top: 1.8rem;
    margin-bottom: 2rem;
}

.system-slogan span {
    background: linear-gradient(135deg, #34d399, #a7f3d0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Features List */
.feature-list {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: var(--transition-smooth);
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(16, 185, 129, 0.18);
    transform: translateX(4px);
}

.feature-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10b981;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.feature-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.feature-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.feature-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Bottom Stats */
.stat-row {
    display: flex;
    gap: 2.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: #10b981;
}

.stat-lbl {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Right Column: Login Form */
.login-right-pane {
    flex: 1;
    padding: 3.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(8, 13, 25, 0.2);
}

.login-pane-header {
    margin-bottom: 2rem;
}

.login-pane-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.login-pane-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Form Controls */
.form-group {
    text-align: left;
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

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

.input-container i:first-child {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 46px 14px 46px; /* Space for both left icon and right eye icon */
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: var(--transition-smooth);
}

.form-control:focus {
    border-color: #10b981;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.2);
    background: rgba(0, 0, 0, 0.35);
}

.input-container .toggle-password {
    position: absolute;
    right: 16px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-container .toggle-password:hover {
    color: var(--text-primary);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
    margin-top: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.45);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-manual {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 0.75rem;
}

.btn-manual:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.82rem;
    margin-bottom: 1.5rem;
    display: none;
}

/* Demo Accounts Quick Login Section */
.demo-section {
    margin-top: 2.2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.demo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.demo-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.demo-title i {
    color: #10b981;
}

.demo-badge {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
}

.demo-roles-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 0.75rem;
}

.demo-role-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.demo-role-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(16, 185, 129, 0.25);
    transform: translateY(-2px);
}

.demo-icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: white;
}

.demo-icon-circle.admin {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.demo-icon-circle.operator {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
}

.demo-icon-circle.viewer {
    background: linear-gradient(135deg, #a855f7, #9333ea);
}

.demo-role-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
}

.demo-username {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: monospace;
}

.demo-footer-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

/* =========================================================
   RESPONSIVE DESIGN revamps
   ========================================================= */

@media (max-width: 992px) {
    .login-card {
        flex-direction: column;
        max-width: 480px;
        min-height: auto;
    }
    
    .login-left-pane {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        padding: 2.5rem;
    }
    
    .login-right-pane {
        padding: 2.5rem;
    }
}


/* =========================================================
   PORTAL DASHBOARD LAYOUT
   ========================================================= */

/* Top Navbar */
.portal-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    padding: 0 2.5rem;
    background: rgba(8, 13, 25, 0.7);
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    position: relative;
    z-index: 10;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-name {
    font-size: 0.88rem;
    font-weight: 600;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.25);
    transform: scale(1.05);
}

/* Dashboard Body Container */
.portal-container {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 2.5rem;
    position: relative;
    z-index: 1;
}

.portal-header {
    margin-bottom: 2.5rem;
    animation: fadeIn 0.6s var(--ease-out-cubic) both;
}

.portal-title {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-bottom: 0.4rem;
}

.portal-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Project Cards Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
    animation: slideUp 0.8s var(--ease-out-cubic) both;
}

/* Project Selection Card */
.project-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 250px;
    transition: var(--transition-smooth);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 100% 0%, var(--glow-color, rgba(139, 92, 246, 0.08)) 0%, transparent 60%);
    pointer-events: none;
    transition: var(--transition-smooth);
}

.project-card:hover {
    transform: translateY(-6px);
    border-color: var(--hover-border, rgba(139, 92, 246, 0.3));
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
}

.project-card:hover::before {
    opacity: 1.5;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.project-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    transition: var(--transition-smooth);
}

.project-card:hover .project-icon {
    background: var(--hover-icon-bg, rgba(139, 92, 246, 0.15));
    border-color: var(--hover-border, rgba(139, 92, 246, 0.3));
    color: var(--hover-icon-color, var(--primary));
    transform: scale(1.05);
}

/* Pulse Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.status-badge.online {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-badge.online .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}

.card-details {
    margin-bottom: 2rem;
    flex-grow: 1;
}

.project-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.2px;
}

.project-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.project-card:hover .card-footer {
    color: var(--hover-icon-color, var(--primary));
}

.card-footer i {
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.project-card:hover .card-footer i {
    transform: translateX(4px);
}

/* =========================================================
   ANIMATIONS & KEYFRAMES
   ========================================================= */

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Responsive adjust */
@media (max-width: 768px) {
    .portal-navbar {
        padding: 0 1rem;
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
        gap: 8px;
        row-gap: 6px;
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .portal-container {
        padding: 1.25rem 1rem;
    }
    .login-card {
        padding: 2.5rem 1.5rem;
    }

    /* แบรนด์/หัวข้อบน navbar — ย่อให้พอดีจอ */
    .brand-icon { width: 32px; height: 32px; border-radius: 9px; font-size: 1rem; }
    .brand-name { font-size: 0.95rem !important; }
    .brand-subtitle { display: none; }
    .brand-group + * { flex-shrink: 0; }

    /* หัวข้อในเนื้อหา (เผื่อหน้าอื่นยังมี portal-header) */
    .portal-title { font-size: 1.5rem; line-height: 1.2; margin-bottom: 0.3rem; }
    .portal-subtitle { font-size: 0.85rem; }

    /* การ์ดโครงการ — กริดคอลัมน์เดียว + กระชับ + ไอคอนเล็กลง */
    .projects-grid { grid-template-columns: 1fr; gap: 1rem; }
    .project-card { padding: 1.25rem; min-height: 0; border-radius: 16px; }
    .card-top { margin-bottom: 1rem; }
    .project-icon { width: 38px; height: 38px; font-size: 1.15rem; border-radius: 10px; }
    .card-details { margin-bottom: 1.1rem; }
    .project-title { font-size: 1.05rem; }
    .project-desc { font-size: 0.8rem; line-height: 1.45; }
    .card-footer { padding-top: 0.85rem; font-size: 0.78rem; }

    /* แถบผู้ใช้บน navbar — ลดช่องไฟ ซ่อนชื่อยาวเหลือ avatar */
    .navbar-user { gap: 8px; margin-left: auto; }
    .navbar-user .user-name { display: none; }
}

@media (max-width: 420px) {
    .brand-name { font-size: 0.88rem !important; }
    .project-card { padding: 1.1rem; }
    .project-icon { width: 34px; height: 34px; font-size: 1.05rem; }
    .project-title { font-size: 1rem; }
}

/* =========================================================
   ROLE BADGES & USER MANAGEMENT
   ========================================================= */

.role-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.role-badge.admin {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: #a78bfa;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.15);
}
.role-badge.operator {
    background: rgba(6, 182, 208, 0.15);
    border-color: rgba(6, 182, 208, 0.3);
    color: #22d3ee;
    box-shadow: 0 0 12px rgba(6, 182, 208, 0.15);
}
.role-badge.viewer {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.3);
    color: #cbd5e1;
}

.nav-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition-smooth);
}
.nav-link-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: #a78bfa;
    transform: translateY(-1px);
}
.nav-link-btn i {
    font-size: 1rem;
}

/* Modal Overlay & Card styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 7, 15, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.3s var(--ease-out-cubic) both;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    width: 100%;
    max-width: 800px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: slideUp 0.4s var(--ease-out-cubic) both;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.modal-header-title i {
    font-size: 1.5rem;
    color: var(--primary);
}
.modal-header-title h2 {
    font-size: 1.35rem;
    font-weight: 800;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-smooth);
}
.modal-close-btn:hover {
    color: #f87171;
}

.modal-body {
    padding: 2rem;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.user-table th, .user-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-table th {
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.user-table tbody tr {
    transition: var(--transition-smooth);
}

.user-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.user-table td {
    color: var(--text-primary);
}

.user-table td .status-badge {
    padding: 4px 10px;
    font-size: 0.65rem;
}

/* ── Dynamic Health Status Badge Variants ── */
.status-badge.online {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}
.status-badge.online .status-dot {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.status-badge.offline {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}
.status-badge.offline .status-dot {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.status-badge.starting {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}
.status-badge.starting .status-dot {
    background: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
    animation: statusPulse 1.5s ease-in-out infinite;
}

.status-badge.maintenance {
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.4);
    color: #fb923c;
}
.status-badge.maintenance .status-dot {
    background: #f97316;
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.6);
}

.status-badge.error {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.4);
    color: #c084fc;
}
.status-badge.error .status-dot {
    background: #a855f7;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
}

.status-badge.unknown,
.status-badge.loading {
    background: rgba(107, 114, 128, 0.12);
    border: 1px solid rgba(107, 114, 128, 0.3);
    color: #9ca3af;
}
.status-badge.unknown .status-dot,
.status-badge.loading .status-dot {
    background: #6b7280;
    animation: statusPulse 1s ease-in-out infinite;
}

.status-badge.vpn-required {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}
.status-badge.vpn-required .status-dot {
    background: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
    animation: statusPulse 1.5s ease-in-out infinite;
}

.status-badge.no-permission {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
}
.status-badge.no-permission .status-dot {
    background: #ef4444;
}

.project-card.card-locked {
    opacity: 0.6;
    cursor: not-allowed !important;
    background: rgba(17, 25, 46, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.04) !important;
}
.project-card.card-locked::before {
    background: radial-gradient(circle at 100% 0%, rgba(239, 68, 68, 0.03) 0%, transparent 60%) !important;
}

/* Loading shimmer on project card */
.project-card.card-loading {
    pointer-events: none;
    opacity: 0.7;
}
.project-card.card-loading .card-footer span::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

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

.latency-text {
    font-family: 'Inter', monospace;
}

/* =========================================================
   SUCCESS LOGIN OVERLAY & LOADING SPINNER
   ========================================================= */

.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 13, 25, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.success-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.success-spinner-container {
    position: relative;
    width: 80px;
    height: 80px;
}

.success-spinner {
    width: 80px;
    height: 80px;
    border: 4px dashed #10b981;
    border-radius: 50%;
    animation: spin 2.5s linear infinite;
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.2);
}

.success-icon-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.6rem;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
    animation: scaleCheck 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.success-text {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    text-align: center;
    margin-top: 0.5rem;
    animation: fadeIn 0.5s ease both;
    animation-delay: 0.2s;
}

.success-subtext {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: -0.8rem;
    animation: fadeIn 0.5s ease both;
    animation-delay: 0.3s;
}

.inline-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes scaleCheck {
    0% { transform: translate(-50%, -50%) scale(0); }
    100% { transform: translate(-50%, -50%) scale(1); }
}


