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

:root {
    --saga-primary: #6366f1;
    --saga-primary-dark: #4f46e5;
    --saga-secondary: #0f172a;
    --saga-accent: #10b981;
    --saga-bg: #f8fafc;
    --saga-card-bg: #ffffff;
    --saga-text-main: #1e293b;
    --saga-text-muted: #64748b;
    --saga-border: #e2e8f0;
    --saga-gradient: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    --saga-sidebar-bg: #0f172a;
    --saga-radius: 16px;
    --saga-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--saga-bg);
    margin: 0;
    color: var(--saga-text-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Login Page --- */
.login-page {
    height: 100vh;
    background: radial-gradient(circle at top right, #e0e7ff, transparent),
                radial-gradient(circle at bottom left, #f3e8ff, transparent),
                #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    padding: 60px 40px;
    border-radius: 32px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 460px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.5);
}

/* --- Dashboard Layout --- */
.master-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--saga-sidebar-bg);
    color: white;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 60px;
    padding: 0 12px;
}

.nav-menu { list-style: none; padding: 0; margin: 0; flex-grow: 1; }
.nav-item { margin-bottom: 12px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 14px;
    font-weight: 600;
    font-size: 15px;
}
.nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: white;
    transform: translateX(5px);
}
.nav-link.active {
    background: var(--saga-primary);
    color: white;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}
.nav-link.active i { color: white; }

.main-content {
    padding: 40px 60px;
    background: var(--saga-bg);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    background: white;
    padding: 10px 20px;
    border-radius: 16px;
    box-shadow: var(--saga-shadow);
}

/* --- Cards & Components --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 50px;
}

.stat-card {
    background: white;
    padding: 30px;
    border-radius: 24px;
    box-shadow: var(--saga-shadow);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-info { flex: 1; }
.stat-card label { font-size: 14px; font-weight: 700; color: var(--saga-text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; display: block; }
.stat-card .number { font-size: 32px; font-weight: 800; color: var(--saga-text-main); }

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.icon-blue { background: #eff6ff; color: #3b82f6; }
.icon-green { background: #ecfdf5; color: #10b981; }
.icon-purple { background: #f5f3ff; color: #8b5cf6; }

.table-container {
    background: white;
    border-radius: 30px;
    box-shadow: var(--saga-shadow);
    padding: 40px;
}

.saga-table { width: 100%; border-collapse: collapse; }
.saga-table th { 
    text-align: left; 
    padding: 18px 20px; 
    font-size: 13px; 
    color: var(--saga-text-muted); 
    font-weight: 800; 
    border-bottom: 2px solid #f1f5f9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.saga-table td { padding: 24px 20px; border-bottom: 1px solid #f1f5f9; }
.saga-table tr:last-child td { border-bottom: none; }
.saga-table tr:hover td { background-color: #f8fafc; }

.badge { 
    padding: 8px 16px; 
    border-radius: 12px; 
    font-size: 12px; 
    font-weight: 800; 
    display: inline-flex; 
    align-items: center; 
    gap: 6px; 
}
.badge-active { background: #dcfce7; color: #15803d; }
.badge-suspended { background: #fee2e2; color: #b91c1c; }

.btn-saga {
    background: var(--saga-primary);
    color: white;
    padding: 14px 28px;
    border-radius: 14px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}
.btn-saga:hover { background: var(--saga-primary-dark); transform: translateY(-2px); }

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1.5px solid var(--saga-border);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--saga-text-muted);
    cursor: pointer;
}
.btn-icon:hover { 
    border-color: var(--saga-primary); 
    color: var(--saga-primary); 
    background: #f5f3ff;
}

.tenant-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #f1f5f9;
    object-fit: contain;
    padding: 6px;
    border: 1px solid var(--saga-border);
}

/* --- Responsive Mobile Styles --- */
@media (max-width: 900px) {
    .master-layout {
        display: block;
    }
    
    .mobile-topbar {
        display: flex !important;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        padding: 20px;
        margin-bottom: 0;
        box-shadow: 4px 0 15px rgba(0,0,0,0.3);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-logo {
        margin-bottom: 30px;
        justify-content: flex-start;
    }

    .nav-menu {
        display: block;
        overflow-x: visible;
        padding-bottom: 0;
    }

    .nav-item {
        margin-bottom: 12px;
        flex: none;
    }

    .nav-link {
        padding: 14px 16px;
        font-size: 15px;
        white-space: normal;
        justify-content: flex-start;
    }

    .main-content {
        padding: 20px 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 30px;
    }

    .top-bar {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
        margin-bottom: 30px;
    }

    .table-container {
        padding: 20px 15px;
        overflow-x: auto;
        border-radius: 20px;
    }

    .saga-table {
        min-width: 600px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-card .number {
        font-size: 26px;
    }
}
