:root {
    --bg-base: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --bg-panel-hover: rgba(51, 65, 85, 0.8);
    --border-color: transparent;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --backdrop-blur: blur(12px);
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    
    /* Subtle gradient background */
    background: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
                radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.1), transparent 25%),
                var(--bg-base);
    background-attachment: fixed;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: none;
    box-shadow: var(--shadow-glass);
}

.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }

/* Typography */
h1, h2, h3 { font-weight: 600; margin-bottom: 0.5rem; }
p { color: var(--text-secondary); line-height: 1.5; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: none;
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: none;
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

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

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 50%;
}
.btn-icon:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

.w-full { width: 100%; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}
.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-lg);
    padding: 2rem;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.hidden .modal {
    transform: translateY(20px) scale(0.95);
}

.modal-sm { max-width: 380px; text-align: center; }

.modal-header {
    text-align: center;
    margin-bottom: 2rem;
}
#account-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    margin-bottom: 1.5rem;
}
.icon-large {
    width: 48px; height: 48px;
    margin-bottom: 1rem;
}

/* Forms */
.input-group { margin-bottom: 1.2rem; text-align: left; }
.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-wrapper i {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    width: 20px; height: 20px;
}
.input-wrapper input {
    padding-left: 2.5rem;
}

input[type="text"], input[type="password"], input[type="email"], input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}
input:focus {
    outline: none;
    border: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.checkbox-group label { margin: 0; font-size: 0.9rem; cursor: pointer; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.error-msg {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
}
.hidden { display: none !important; }

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    border-right: none;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}
.brand { margin-bottom: 2.5rem; }
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.menu { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 500;
}
.menu-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}
.menu-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    position: relative;
}
.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 15%; bottom: 15%;
    width: 3px;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: 72px;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}
.topbar-left h1 { font-size: 1.25rem; margin: 0; }
.topbar-right { display: flex; gap: 1rem; }

.content-wrapper {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Accounts Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.acc-card {
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.acc-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px 0 rgba(0,0,0,0.4);
    background: var(--bg-panel-hover);
}

.acc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}
.acc-icon {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
}
.acc-menu { display: flex; gap: 0.25rem; }

.acc-info h3 { font-size: 1.1rem; margin-bottom: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.acc-info p { font-size: 0.85rem; }

.acc-status {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.status-Stopped { background: rgba(148, 163, 184, 0.1); color: var(--text-secondary); }
.status-Running { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-Error { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.status-Connecting\.\.\. { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-Reconnecting\.\.\. { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
}
.status-Stopped .status-dot { background: var(--text-secondary); }
.status-Running .status-dot { background: var(--success); box-shadow: 0 0 8px var(--success); animation: pulse 2s infinite; }
.status-Error .status-dot { background: var(--danger); }
.status-Connecting\.\.\. .status-dot { background: var(--warning); }
.status-Reconnecting\.\.\. .status-dot { background: var(--warning); }

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* Loading State */
.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--text-secondary);
}
.spin { animation: spin 1s linear infinite; margin-bottom: 1rem;}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Skeleton Loaders */
.skeleton {
    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: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

.skeleton-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); }
.skeleton-title { width: 60%; height: 20px; margin-bottom: 0.5rem; }
.skeleton-text { width: 40%; height: 14px; }
.skeleton-badge { width: 80px; height: 24px; border-radius: 20px; }
.skeleton-btn { width: 60px; height: 32px; border-radius: var(--radius-sm); }

/* Logs View */
.logs-panel {
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
}
.logs-header {
    padding: 1.25rem 1.5rem;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.terminal-logs {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #a3b8cc;
    background: rgba(0,0,0,0.2);
}
.log-entry {
    margin-bottom: 0.25rem;
    word-break: break-all;
}
.log-entry:hover {
    background: rgba(255,255,255,0.02);
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    .brand { margin-bottom: 0; }
    
    .menu {
        flex-direction: row;
        flex: none;
    }
    
    .menu-item span { display: none; }
    .menu-item { padding: 0.5rem; }
    .menu-item.active::before { display: none; }
    .menu-item.active { border-bottom: 2px solid var(--accent); border-radius: 0; }
    
    .topbar {
        padding: 0 1rem;
        height: auto;
        padding-top: 1rem;
        padding-bottom: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .content-wrapper { padding: 1rem; }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .modal { padding: 1.5rem; width: 95%; max-width: none; margin: auto; }
    .grid-2 { grid-template-columns: 1fr; }
    
    .logs-panel {
        height: calc(100vh - 200px);
    }
}
